Page 1 of 10

RTC for Miac(Part One)

Posted: Tue Sep 25, 2012 11:32 pm
by acestu
Hi,

Does anybody have a schematic for RTC for Miac please...

thanks in advance
Acestu

Re: RTC for Miac

Posted: Wed Sep 26, 2012 12:29 am
by Enamul
Hi Stuart,
MIAC has it's CAN transceiver on board..so you will see MIAC has two connection point labeled L and H which are for CAN bus. You can follow this datasheet..
http://www.matrixmultimedia.com/resourc ... C-60-2.pdf
But you have to follow the following link for more about MIAC hardware...
http://www.matrixmultimedia.com/resourc ... -guide.pdf
In page 11 of above document, you will see MIAC already has MCP2551 in it which produces CAN bus and this is needed to be connected with your RTC custom module.
You need to know a bit about CAN bus before proceeding to use that. One important issue is terminating impedance..If you have only MIAC and RTC module in the CAN bus in that case it's pretty straight forward..You can simply connect TA and TB of MIAC to have that terminating resistor in act(which actually connect 120 ohm resistor between L & H line of CAN bus)..but in RTC module end you will need to put.
I am suggesting you to read carefully the operation and programming guide..At the same time if you have RTC module in hand and PIC18f4580 or 458, you can try to interface RTC with the PIC. If you need help for that please let me know.. John's post on RTC is a good point to start :)

Re: RTC for Miac

Posted: Wed Sep 26, 2012 7:29 am
by medelec35
Hi Stuart,
I would like to add that if you want to connect a RTC up directly to a MIAC, with no can skills at all (you don't even have to drag a CAN component macro on to your flowchart, as the can part is already built in and woks behind the scenes) then there is the MIAC Advance expansion Module:

http://www.matrixmultimedia.com/product ... PHPSESSID=

I have created a flowchart that works with MIAC Advance expansion Module to enable you to set time and date which I can post if your interested.

Re: RTC for Miac

Posted: Wed Sep 26, 2012 8:05 am
by Enamul
But Martin I guess you missed Stuart's earlier post regarding RTC in MIAC..he wants have a cheap solution.

Re: RTC for Miac

Posted: Wed Sep 26, 2012 9:26 am
by Benj
Hello,

For my two pence you could always use a timer interrupt on the MIAC to monitor the passing of time. Obviously if the power goes off then the time and date will have to be reconfigured but this is the cheapest solution. The next best option would probably be to get a low cost CAN based RTC module (if they exist) though there might be other options.

Re: RTC for Miac

Posted: Wed Sep 26, 2012 9:14 pm
by acestu
Thanks for the ideas guys, I created this post knowing that Enamul was going to show me how to build a canbus rtc module for the MIAC, we agreed to do a post in this section so that it would be helpful to others. Enamul has already given me a shopping list of components which I have now received in the post. It should be a handy post for a lot of people and I can't wait to get started....

Thanks to all
Acestu

Re: RTC for Miac

Posted: Wed Sep 26, 2012 9:33 pm
by acestu
Hi Enamul, you mention John's thread on RTC, do you have a link for that please.

thanks
Acestu

Re: RTC for Miac

Posted: Wed Sep 26, 2012 10:10 pm
by Enamul
Hi Stuart,
The following link is for John's thread...
http://www.matrixmultimedia.com/mmforum ... hilit=+rtc
I have attached here a schematic for RTC module interfacing with PIC...
LCD is connected to PORTD so that PORTB remains free as CAN bus is in PORTB.
In the code there is macro called FIRST_TIME in which you can set initial time which will be tracked by EEPROM..so if power cut happened and RTC module has it's coin battery..Time will be maintained and next time when powers up you will see real time.

Re: RTC for Miac

Posted: Wed Sep 26, 2012 10:40 pm
by acestu
Hi Enamul,
On your schematic the ds1307 connections are different than my connections on the RTC module that i bought, I will post a pic of it so you can see what i mean..
I have SDA but not the SCK
thanks
acestu
RTCmod.jpg
RTCmod.jpg (16.89 KiB) Viewed 19604 times

Re: RTC for Miac

Posted: Wed Sep 26, 2012 10:50 pm
by Enamul
Hi Stuart,
SCK and SCL are same; so SCL will be connected to RC3 and SDA will be connected to RC4 and make sure that both are pull up to Vcc (+5v) by 4.7 K (which should be already in your RTC module that's why I haven't shown in diagram)

Re: RTC for Miac

Posted: Wed Sep 26, 2012 11:07 pm
by medelec35
Enamul wrote:But Martin I guess you missed Stuart's earlier post regarding RTC in MIAC..he wants have a cheap solution.
Sorry, I did not read that post prior to reading first post within this thread.

Re: RTC for Miac

Posted: Wed Sep 26, 2012 11:08 pm
by acestu
Thanks Enamul

I will have a go at building this on a breadboard tomorrow

Acestu

Re: RTC for Miac

Posted: Wed Sep 26, 2012 11:11 pm
by acestu
That's ok Martin, the more suggestions the better for me, I was going to ask you about your expansion module method anyway ie:

"I have created a flowchart that works with MIAC Advance expansion Module to enable you to set time and date which I can post if your interested."

cheers
Acestu

Re: RTC for Miac

Posted: Wed Sep 26, 2012 11:22 pm
by Enamul
@Martin,
No problem :) No doubt that the expansion modules will make life much easier. I have a look in the operation guide and seems me superb modules.
This thread is actually Stuart has made to have idea about RTC without expansion modules. I could reply him in PM but I want to have expert opinions like MM and you guys.
@Stuart,
I guess you will be using your new HP-488 Board for programming the PIC IC. There is a 18f4580.FCD fix for PORTD LCD in minor fix list if you didn't download that yet..

Re: RTC for Miac

Posted: Wed Sep 26, 2012 11:24 pm
by acestu
Thanks Enamul, I will have a look for that fix now

cheers
Acestu

Re: RTC for Miac

Posted: Wed Sep 26, 2012 11:37 pm
by acestu
Where would I find that fix Enamul, I have tried a search and looked in the forum but I can't find it...

thanks
Acestu

Re: RTC for Miac

Posted: Wed Sep 26, 2012 11:42 pm
by Enamul
Hi Stuart,
Here is the link for FCD fix...
http://www.matrixmultimedia.com/mmforum ... 46&t=11000

and this is for all minor fix..
http://www.matrixmultimedia.com/mmforum ... 46&t=11214

Re: RTC for Miac

Posted: Wed Sep 26, 2012 11:53 pm
by acestu
Hi Enamul, thinking about it will I need these fixes because I have only just bought Flowcode 5 and it is version 5.4.

thanks
Acestu

Re: RTC for Miac

Posted: Wed Sep 26, 2012 11:59 pm
by Enamul
Actually your version I think is 5.4 what you bought. Although you bought recently, still you need those fix as in next release may be 5.5 or later those fixes are going to be effective..so your version is same as us..And need those fix.

Re: RTC for Miac

Posted: Thu Sep 27, 2012 12:06 am
by acestu
Ok I will update it tomorrow...

thanks
Acestu

Re: RTC for Miac

Posted: Thu Sep 27, 2012 8:18 pm
by acestu
Hi Enamul, I downloaded the fixes but how do I install them, do I just overwrite the originals in the Flowcode folder ?

thanks
Acestu

Re: RTC for Miac

Posted: Thu Sep 27, 2012 8:23 pm
by Enamul
Hi,
In the Flowcode folder you will get an FCD folder..just overwrite the existing one with the new one..I guess you did that right..

Re: RTC for Miac

Posted: Thu Sep 27, 2012 8:54 pm
by acestu
HI Enamul, No I haven't done it yet I thought I would ask you first, I will do it now.

Thanks
Acestu

Re: RTC for Miac

Posted: Thu Sep 27, 2012 9:58 pm
by acestu
Hi Enamul, I think I may have the wrong chip, it says pic18f458-I/P on it and not pic18f4580 when I try to programme it with my pickit 3 it says invalid device, have you any ideas ?

thanks
Acestu

Re: RTC for Miac

Posted: Thu Sep 27, 2012 10:12 pm
by Enamul
Hi,
That's why I asked you earlier which one you bought. I will change the code and check fcd and config..Just wait for a while..