Page 6 of 10

Re: RTC for Miac(Part One)

Posted: Sun Oct 14, 2012 8:27 pm
by Enamul
In my most of products I use 3 push switch (SET, UP & DOWN) for user interface which consumes only 3 pins but can give same feature of KEYPAD. I am posting RTC program here with same setting feature using just three active low (pin is pulled up by 4.7 K) momentary switches.
This program also restrict user from wrong date or time entry and the date and time entered in decimal is converted to hex like last one. To maintain real-time RTC should have coin battery back-up..Default set time is 00:00:00 and date is 01/01/00 but anyone can change that to any value.
Note: in the code 4*20 LCD is used in PORTD

Re: RTC for Miac(Part One)

Posted: Sun Oct 14, 2012 8:31 pm
by acestu
yes Enamul that's right I did not change program just connected it up properly ( I know I'm an idiot)....

thanks
Acestu

Re: RTC for Miac(Part One)

Posted: Sun Oct 14, 2012 8:37 pm
by acestu
Hi Enamul,

I now have 3 boards, the RTC board, The Master board and the slave board,

I take it that the program you have just posted is for the RTC board ?

thanks
Acestu

Re: RTC for Miac(Part One)

Posted: Sun Oct 14, 2012 9:25 pm
by Enamul
Hi Stuart,
Actually your salve will be RTC board later on..because RTC with set menu will send time and date to Master and finally your master will be Miac. For the time being you can test new RTC program in your RTC board.

Re: RTC for Miac(Part One)

Posted: Sun Oct 14, 2012 9:31 pm
by Enamul
I forgot to ask..do you have any 4*20 LCD or I need to modify my code to fit in 2*16 LCD?
Note: It is bit tough to change to 2*16 not so straight forward..

Re: RTC for Miac(Part One)

Posted: Sun Oct 14, 2012 9:35 pm
by acestu
Thanks Enamul, I will do that

Acestu

Re: RTC for Miac(Part One)

Posted: Sun Oct 14, 2012 10:29 pm
by acestu
Hi Enamul,

I have just ordered a 4 x 20 lcd module and it should be here in a couple of days, I don't want to cause you any problems rewriting the code.

thanks again
Acestu

Re: RTC for Miac(Part One)

Posted: Sun Oct 14, 2012 10:40 pm
by Enamul
Hi Stuart,
I have modified the code already for you..The attached code is for 2*16..Hope that it helps.

Note: It good that you ordered 4*20 as it is helpful in many projects to have that LCD.

Re: RTC for Miac(Part One)

Posted: Mon Oct 15, 2012 5:59 pm
by acestu
Hi Enamul,

just to be sure, I am using this new code for the slave, is that right ?

And the 3 switches, how are they wired ?,

thanks
Acestu

Re: RTC for Miac(Part One)

Posted: Mon Oct 15, 2012 8:20 pm
by Enamul
And the 3 switches, how are they wired ?,
Switches are active low so the pins is pulled up by 4.7 K and momentary switches connected from pin to GND.
just to be sure, I am using this new code for the slave, is that right ?
You can now test the code in your RTC board just by adding 3 switches there..as your RTC module is already connected with that.

Re: RTC for Miac(Part One)

Posted: Mon Oct 15, 2012 8:46 pm
by acestu
Thanks Enamul, I will give that a go now...

Acestu

Re: RTC for Miac(Part One)

Posted: Mon Oct 15, 2012 9:07 pm
by acestu
Hi Enamul,

just wondering will this program work on my RTC board because the chip is an 18f458 and not an 18f4580
and when I try to program it says it is wrong device..

good news is though I powered up the rtc board after ages and the date and time is spot on.

thanks
Acestu

Re: RTC for Miac(Part One)

Posted: Mon Oct 15, 2012 9:51 pm
by Enamul
Actually we will no more use that pic18f458 as we will use pic18f4580. So you can use the program I've posted and use your slave chip to test this program as we will not test slave program any more.

Re: RTC for Miac(Part One)

Posted: Tue Oct 16, 2012 9:49 am
by Enamul
Hi stuart,
Have you tested my last code and how is it behaving? I have tested the 4line version in hardware not the 2 line version..but should work smoothly.

Re: RTC for Miac(Part One)

Posted: Tue Oct 16, 2012 7:26 pm
by acestu
Hi Enamul,

I have just finished programming the slave with the new code, I have put the 3 switches on but when I power up the board it says Mode : Set but it dosen't do anything when I push the buttons, I have put a 4.7k resister on pins RB4, RB5 and RB6 to +5volts and then the switches connect the pins to ground...

thanks
Acestu

Re: RTC for Miac(Part One)

Posted: Tue Oct 16, 2012 7:34 pm
by Enamul
SET button is RB4 which button you have pressed to enter in set mode? I have tested this program should work..PORTB<0:4> can be set as A/D pin in this chip which I have disabled in configuration..which programmer you are using to program? If that is enabled for any reason SET will not work.

Re: RTC for Miac(Part One)

Posted: Tue Oct 16, 2012 7:48 pm
by acestu
Hi Enamul,

I have programmed the chip straight from flowcode to Pickit 3

Thanks
Acestu

Re: RTC for Miac(Part One)

Posted: Tue Oct 16, 2012 7:52 pm
by Enamul
It should work then straight way..please.check wiring.

Re: RTC for Miac(Part One)

Posted: Tue Oct 16, 2012 8:00 pm
by acestu
Ok, I notice that the programme should say set mode for about 5 seconds and then display time and date, but when I power up the board it just says set mode and stays like that, all I did was reprogram and add the 3 switches to pins 37, 38, and 39

thanks
Acestu

Re: RTC for Miac(Part One)

Posted: Tue Oct 16, 2012 9:00 pm
by acestu
Hi Enamul,

I have removed the switches and just left the resisters in , but still the lcd just says Mode : Set

thanks
acestu

Re: RTC for Miac(Part One)

Posted: Tue Oct 16, 2012 9:30 pm
by Enamul
Hi stuart,
The code is written in that way..It stays for 5 seconds in SET mode if you not press SET button. If you press set it will direct you to SET mode menu..which you are not getting. so removing switches will not remove set from LCD..rather can you put RB4 to GND so that I can be certain that nothing wrong with switch wiring..

Re: RTC for Miac(Part One)

Posted: Tue Oct 16, 2012 9:44 pm
by acestu
Hi Enamul,

I have connected RB4 to ground but nothing happens, all I can think is that it has not programmed properly....

thanks
Acestu

Re: RTC for Miac(Part One)

Posted: Tue Oct 16, 2012 9:46 pm
by Enamul
OK. I am checking the set option in my hardware and let you know in few minutes..

Re: RTC for Miac(Part One)

Posted: Tue Oct 16, 2012 10:22 pm
by Enamul
Although my 2*16 LCD was busy in other project, I have disconnected that and connect for your program..the program works fine for me. I would have posted video to show that program is ok..nothing wrong with it..I am sending hex for you..if any issue in that..Can you please swap your chip?

I am also sending the same code using your last RTC chip PIC18f458..so that you can test that.

Re: RTC for Miac(Part One)

Posted: Tue Oct 16, 2012 10:26 pm
by acestu
Sorry Enamul, I didn't mean it was a problem with your programming, I meant maybe my programmer had not programmed the chip properly, don't go to any more trouble with this, I can wait for the LCD module and try the original 4*20 version


thanks
Acestu