Page 3 of 10
Re: RTC for Miac
Posted: Fri Sep 28, 2012 9:47 pm
by Enamul
Hi,
I have checked the diagram of the module..there is no pull-up resistor in the diagram..But strange issue is that in the wiring example there is no pull-up resistor is shown but according to datasheet it is essential..
Another issue is, even if RTC is not working..you should see something like..
45:85:85
45/25/2165
Should not conflict with LCD..it seems to me that DS1307 is damaged somehow.
Can you check whether DS1307 IC is on the module or any other IC..as device address is very important and address 0x68 for DS1307 which is used in the code.
Edit: you can try without pull-up resistors as well..as in none of the tutorial of the link you given showed pull-up resistor

Re: RTC for Miac
Posted: Fri Sep 28, 2012 9:52 pm
by acestu
Hi Enamul, this is weird, I read an article that said that the batteries in the module were shorting out, so i took out the battery and tried programming again but nothing, then I removed the usb lead from the pickit 3 and plugged it back in again and the LCD lit up with:
41:73:73
36/20/2050
?
thanks
Acestu
Re: RTC for Miac
Posted: Fri Sep 28, 2012 10:01 pm
by Enamul
Ok..nice so it's your Programmer issue..that's why I was stick to EB006..a nice reliable programmer..I am suggesting you to buy one to run smooth R&D..bcz pickit I don't have and always see lots of issue in forum..
If you think battery is doing something wrong..just remove battery as you did..and make sure terminal 3 (Vbatt) is GNDed to see clock running..
Re: RTC for Miac
Posted: Fri Sep 28, 2012 10:35 pm
by acestu
Hi Enamul,
How do I see the clock running ? , sorry for asking but where is terminal 3 vbatt ?
thanks
Acestu
ps I will buy one of the programmers that you suggested when my piggy bank is full again, I am a bit skint after paying £390.00 for Flowcode and DB lol
Re: RTC for Miac
Posted: Fri Sep 28, 2012 10:40 pm
by Enamul
No problem..
Actually the 3rd pin of IC is Vbat..but in the module its connected to positive terminal of battery..so can you just put the battery in place in holder..and measure voltage in pin3 of DS1307 IC whether it is 3V plus or not..
If not, remove the battery and some how connect the 3rd pin of DS1307 to GND..One thing forget to ask, did you put back pull-up resistors in place or not..you have to connect pull-up resistors.
Re: RTC for Miac
Posted: Fri Sep 28, 2012 10:46 pm
by acestu
Hi,
the voltage between ground and the + batt terminal is 3.172 v and pin 3 on the ds1307 chip is the same
thanks
Acestu
Re: RTC for Miac
Posted: Fri Sep 28, 2012 10:51 pm
by Enamul
In that case nothing wrong with your battery, just connect pull-up resistor and battery in holder..run the program again don't re-write if you already have those number in display..it seems only programmer issue.
Re: RTC for Miac
Posted: Fri Sep 28, 2012 11:00 pm
by acestu
Well I put in the resisters and I got a row of black blocks on lcd then a blank screen, so I dissconected the programmer and the display read
00:00:00
01/01/0200
and it began to count minutes and seconds, is that right, have I reset it somehow ?
ps I can turn off the psu and back on again and it is keeping time.
thanks
Acestu
Re: RTC for Miac
Posted: Fri Sep 28, 2012 11:14 pm
by Enamul
Ok. great..you are close now.
The program I have sent to you has this facility already but because of your programmer problem you didn't get that. You now need to re-write the program in the chip..remove your programmer connections to chip which you need to program..power on the circuit..you will see right UK time..If power turns off..turn on you will see time is keeping fine.
Use the attached code..same as before just time corrected
Re: RTC for Miac
Posted: Fri Sep 28, 2012 11:25 pm
by acestu
OK, definitely a programmer problem, anyway I have managed to program the chip it now has correct time and date yipee !!
How does the chip get the right time and date, was the current time and date in the code you just sent me ?
So how does it interface with the MIAC, do you connect it on the Canbus High and Low with termination resisters ?
ps i take it the keypad on the miac can alter the clock via canbus ?
Thank you Enamul
Acestu
Re: RTC for Miac
Posted: Fri Sep 28, 2012 11:31 pm
by Enamul
Hi,
How does the chip get the right time and date, was the current time and date in the code you just sent me ?
Yes..I have corrected time. But you can do that before programming your IC..Just find out the FIRST_TIME macro in the code..you will see following in the calculation box..
Code: Select all
HOUR = 0x3F AND 0x23
MIN = 0x20
SEC = 0x59
DATE = 0x28
MONTH = 0x09
YEAR = 0x12
Don't change 0x3F of HOUR..just put HOUR in place of 0x23 in 24-hour clock system..rest of them is just put properly according to time and date.
So how does it interface with the MIAC, do you connect it on the Canbus High and Low with termination resisters ?
Wait..wait..long way to go..still specially with you programmer problem..We will start tomorrow morning again.
Re: RTC for Miac
Posted: Fri Sep 28, 2012 11:37 pm
by acestu
OK thats brilliant Enamul, I feel like grasshopper now waiting for his next task...the bug for knowledge..
I am really grateful to you for taking the time to teach me this and would like to say Thanks for being patient with me....
Cheers
Acestu
Re: RTC for Miac
Posted: Fri Sep 28, 2012 11:44 pm
by Enamul
Actually the problem we were facing is not because of you..it just happened due to programmer..Now it's known to us. We can deal with that.
You can't imagine I have spent my whole day for debugging a fuel monitoring system which is working fine but can't deliver data to Master module via RS232..just few minute earlier while I was dealing your issue I found that it because of a bug in RXINT.
Re: RTC for Miac
Posted: Sat Sep 29, 2012 12:02 am
by acestu
A good problem keeps the brain fit Enamul, I love a good challenge, not on your level yet though lol
cheers
Acestu
Re: RTC for Miac
Posted: Sat Sep 29, 2012 12:04 am
by Enamul
Hi,
Have a sound sleep..we will start CAN test tomorrow..not directly from RTC..rather we will start basic CAN communication between MIAC and PIC18f458
Re: RTC for Miac
Posted: Sat Sep 29, 2012 12:09 am
by acestu
OK thanks
Speak to you tomorrow
cheers
Acestu
Re: RTC for Miac
Posted: Sat Sep 29, 2012 9:03 pm
by acestu
Hi Enamul
I powered up the breadboard today and the RTC unit is stil running with current time and date.
cheers
Acestu
Re: RTC for Miac
Posted: Sat Sep 29, 2012 10:39 pm
by Enamul
Hi stuart,
Glad to know that RTC is working fine. Do you have MIAC and already have some experience of programming MIAC or just bought that one..didn't program yet. Please let me know I have to plan my post accordingly.
Re: RTC for Miac
Posted: Sat Sep 29, 2012 11:12 pm
by acestu
Hi Enamul, I have not purchased the MIAC yet, I wanted to see if it was possible to give it a battery backup before I used it really...
thanks
Acestu
Re: RTC for Miac
Posted: Sat Sep 29, 2012 11:18 pm
by Enamul
You want to have battery backup just keeping real-time? In that case you don't need that any more..you can simply use this external module with coin battery which can maintain time minimum 9 years. what's your next plan. I have been looking to post CAN transmission program for you. I have checked just now using PIC18f458..but one issue is although PIC18f458 has internal CAN but flowcode don't show that. I have manged to change in FCD and I can see internal CAN option with new FCD. But I don't have PIC18f458 with me that's why I don't know whether it will work in hardware or not.
So easy option is if you bought already two PIC18f458..I can post program to check internal CAN provided that you have two MCP2551 and two 20MHz crystal in hand.
Re: RTC for Miac
Posted: Sat Sep 29, 2012 11:24 pm
by acestu
Hi Enamul,
Yes to make up the minimum order I purchased 2 x transceiver chips and I do have more 20 meg crystals, and the second pic18f458...
thanks
Acestu
Re: RTC for Miac
Posted: Sat Sep 29, 2012 11:32 pm
by Enamul
Hi,
I have just tried to compile internal CAN but it doesn't compile..seems need support from MM. so we have three options left..
1. Wait till Monday and see if Ben could give an instant solution to enable the internal CAN of PIC18f458.
2. You can order two MCP2515 CAN controller which will help to use SPI CAN which is possible to use in PIC18f458 with existing flowcode.
3. You can order two PIC18f4580 which I am using in couple of my recent projects and have internal CAN and I have tested that and I have this IC in hand
Among those 3 options I prefer 1 if not 3
Re: RTC for Miac
Posted: Sat Sep 29, 2012 11:38 pm
by acestu
Hi Enamul,
I have 2 x can controller chips so should I get 2 of these ?
http://uk.farnell.com/jsp/displayProduc ... price=true
cheers
Acestu
Re: RTC for Miac
Posted: Sat Sep 29, 2012 11:43 pm
by Enamul
Yes, please. That will be great.
Re: RTC for Miac
Posted: Sat Sep 29, 2012 11:49 pm
by acestu
Ok, I will order them now...
thanks
Acestu