RTC for Miac(Part One)

For MIAC users to discuss projects, applications, and any other issues related to the MIAC unit.

Moderators: Benj, Mods

Post Reply
User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for Miac(Part One)

Post 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
Attachments
RTC_SET_18f4580_V5.fcf
(119.26 KiB) Downloaded 309 times
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for Miac(Part One)

Post 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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for Miac(Part One)

Post 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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for Miac(Part One)

Post 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.
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for Miac(Part One)

Post 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..
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for Miac(Part One)

Post by acestu »

Thanks Enamul, I will do that

Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for Miac(Part One)

Post 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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for Miac(Part One)

Post 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.
Attachments
RTC_SET_18f4580_V5_2Line.fcf
(120.05 KiB) Downloaded 284 times
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for Miac(Part One)

Post 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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for Miac(Part One)

Post 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.
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for Miac(Part One)

Post by acestu »

Thanks Enamul, I will give that a go now...

Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for Miac(Part One)

Post 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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for Miac(Part One)

Post 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.
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for Miac(Part One)

Post 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.
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for Miac(Part One)

Post 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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for Miac(Part One)

Post 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.
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for Miac(Part One)

Post by acestu »

Hi Enamul,

I have programmed the chip straight from flowcode to Pickit 3

Thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for Miac(Part One)

Post by Enamul »

It should work then straight way..please.check wiring.
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for Miac(Part One)

Post 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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for Miac(Part One)

Post 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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for Miac(Part One)

Post 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..
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for Miac(Part One)

Post 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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for Miac(Part One)

Post by Enamul »

OK. I am checking the set option in my hardware and let you know in few minutes..
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for Miac(Part One)

Post 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.
Attachments
RTC_SET_18f458_V5_2Line.hex
458 hex
(21.46 KiB) Downloaded 204 times
RTC_SET_18f458_V5_2Line.fcf
PIC458 flowcode
(120.1 KiB) Downloaded 202 times
RTC_SET_18f4580_V5_2Line.hex
PIC4580 hex
(21.46 KiB) Downloaded 205 times
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for Miac(Part One)

Post 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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

Post Reply