RTC for Miac(Part One)
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: RTC for Miac
Ok..fine. Here I am attaching two programs for CAN trans-reception..if you can have a look in the attached programs by the time you get the chips. It will be easy to test. The core idea is to test bidirectional CAN transmission here..Master send data to slave and returned back the same to master..so we can confirm both are working.
You can go through the help file of CAN component..
You can go through the help file of CAN component..
- Attachments
-
- CAN_BD_Receive_SEND_Slave.fcf
- (16 KiB) Downloaded 378 times
-
- CAN_BD_Send_Receive_Master.fcf
- (19 KiB) Downloaded 425 times
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: RTC for Miac
Hi Stuart,
Please read also the following post..where lots of information regarding use of internal CAN is mentioned. I have started from this page before using internal CAN.
http://www.matrixmultimedia.com/mmforum ... bus#p19222
Please read also the following post..where lots of information regarding use of internal CAN is mentioned. I have started from this page before using internal CAN.
http://www.matrixmultimedia.com/mmforum ... bus#p19222
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac
Thanks Enamul,
I| will have a read of that and give you a shout when the parts come....
thanks
Acestu
I| will have a read of that and give you a shout when the parts come....
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.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac(Part One)
Hi Enamul,
I had a bit of a problem with the chip order but they are here now....
thanks
Acestu
I had a bit of a problem with the chip order but they are here now....
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.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: RTC for Miac(Part One)
Hi Stuart,
Good...you got your ICs..We can now start to test CAN bus. Do you have two LCD or one LCD? If yes, we can easily test bi-directional communication between two chips. If not, we can still test bi-directional communication but we have to connect LCD with Master first and see the result and if everything according to expectation we can swap LCD to slave module and see the result. After that we can move to RTC and CAN based communication of time and date data to Master module. If that works fine then we will finalize code for Miac (Master) and slave RTC communication in that stage you need to order a Miac module.
Hope our plan is clear
Good...you got your ICs..We can now start to test CAN bus. Do you have two LCD or one LCD? If yes, we can easily test bi-directional communication between two chips. If not, we can still test bi-directional communication but we have to connect LCD with Master first and see the result and if everything according to expectation we can swap LCD to slave module and see the result. After that we can move to RTC and CAN based communication of time and date data to Master module. If that works fine then we will finalize code for Miac (Master) and slave RTC communication in that stage you need to order a Miac module.
Hope our plan is clear

- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac(Part One)
Hi Enamul,
Yes I have 2 or 3 lcd modules here, so that is ok
thanks
Acestu
Yes I have 2 or 3 lcd modules here, so that is ok
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.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: RTC for Miac(Part One)
Great! Did you test the program I have up-loaded or you need a bit of explanation about connection and program?
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac(Part One)
Hi Enamul,
Sorry it has been a while, which program am I looking at now ?
thanks
Acestu
Sorry it has been a while, which program am I looking at now ?
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.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: RTC for Miac(Part One)
The above two programs...
CAN_BD_Receive_SEND_Slave.fcf
CAN_BD_SEND_Receive_MASTER.fcf
CAN_BD_Receive_SEND_Slave.fcf
CAN_BD_SEND_Receive_MASTER.fcf
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac(Part One)
Hi Enamul,
Yes I have looked at the 2 x programs but I am not sure what the little square can represents as it is connected to port C6, is this the little Can tranceiver chip only I am not sure how to hardwire it...
thanks
Acestu
Yes I have looked at the 2 x programs but I am not sure what the little square can represents as it is connected to port C6, is this the little Can tranceiver chip only I am not sure how to hardwire it...
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.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: RTC for Miac(Part One)
Hi Stuart,
You have to connect the MCP2551 IC for both the PIC..according to the attached schematic. Then you have to connect terminal 1 of CAN bus with terminal 1 and terminal 2 with 2.
You have to connect the MCP2551 IC for both the PIC..according to the attached schematic. Then you have to connect terminal 1 of CAN bus with terminal 1 and terminal 2 with 2.
- Attachments
-
- CAN_circuit.jpg
- (110.25 KiB) Downloaded 3180 times
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac(Part One)
Sorry Enamul,
What I meant was: In the Flowcode programs that you uploaded the little graphic can bus says that "Chip Select is connected to port C6 " but on your schematic C6 is not connected to anything.
thanks
Acestu
What I meant was: In the Flowcode programs that you uploaded the little graphic can bus says that "Chip Select is connected to port C6 " but on your schematic C6 is not connected to anything.
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.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac(Part One)
Hi Enamul,
This is a diagram I did of the RTC Module Interface that I did once I got things working, it might be helpful for others...
thanks
Acestu
This is a diagram I did of the RTC Module Interface that I did once I got things working, it might be helpful for others...
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.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: RTC for Miac(Part One)
Yes, it will be helpful to others.
Here is a the schematic I have from forum...
We are going to use internal CAN of PIC18f4580 which don't use chip select. This is for external CAN and so we are simply ignoring that. We need two connection RB2 and RB3 for CAN connection and those are fixed for this chip.What I meant was: In the Flowcode programs that you uploaded the little graphic can bus says that "Chip Select is connected to port C6 " but on your schematic C6 is not connected to anything.
Here is a the schematic I have from forum...
- Attachments
-
- 134053036.png
- (448.64 KiB) Downloaded 7813 times
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac(Part One)
Hi Enamul,
I have just ordered some breadboards, some 1N4148 diodes and an lm35dz sensor so that I can build all of this, I have the rest of the components, hopefully these should not take long to come... can I just ask though you said we were using 2 x lcd modules so does the collector have an lcd on the same port C ? , and which flowcode program is for which node ?
thanks
Acestu
I have just ordered some breadboards, some 1N4148 diodes and an lm35dz sensor so that I can build all of this, I have the rest of the components, hopefully these should not take long to come... can I just ask though you said we were using 2 x lcd modules so does the collector have an lcd on the same port C ? , and which flowcode program is for which node ?
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.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: RTC for Miac(Part One)
Sorry Stuart..I have posted the picture with schematic to give you an idea..but you don't need LM35Dz for the RTC project..But it's a nice temperature sensor which might be useful in other project. You can simply put wiper (center of pot) in ADC pin to get a variable ADC value. If you don't have 1N4148, no problem for testing..you can use that in final product.
LCD in the diagram shown in PORTC but I have told I guess earlier to connect it in PORTD for both node..Because you can't use PORTC for LCD later on as PORTC will be used for RTC module. So, this schematic is not according to program I have posted but to give you an idea of your CAN connection..
Collector node is Master and Display node is slave. you can connect LCD for both and connect POT in Master and can see the change of ADC value in slave.
LCD in the diagram shown in PORTC but I have told I guess earlier to connect it in PORTD for both node..Because you can't use PORTC for LCD later on as PORTC will be used for RTC module. So, this schematic is not according to program I have posted but to give you an idea of your CAN connection..
Collector node is Master and Display node is slave. you can connect LCD for both and connect POT in Master and can see the change of ADC value in slave.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac(Part One)
Not a problem Enamul, I can always use the extra parts but it is the breadboards that I need really because I only have the one that you have seen in the pic and it has the RTC module on it...
thanks
Acestu
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.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac(Part One)
Hi Enamul,
I now have the breadboards etc, you said that we could use 2 x LCD modules, do I connect the second LCD to the same ports ?
thanks
Acestu
I now have the breadboards etc, you said that we could use 2 x LCD modules, do I connect the second LCD to the same ports ?
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.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: RTC for Miac(Part One)
Thanks for letting me know. In the posted codes, LCD in both the case are connected to PORTD..your LCD is 16*2 or 20*4?
In the program LCD is 20*4, please change that to 16*2 if that in your case.
Edit: In that case I have to change in code also..please let me know.
In the program LCD is 20*4, please change that to 16*2 if that in your case.
Edit: In that case I have to change in code also..please let me know.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac(Part One)
Hi Enamul,
Yes my LCD modules are 16 x 2 so I will change it in the flowcode program, I will have a go at putting them together now.
thanks
Acestu
Yes my LCD modules are 16 x 2 so I will change it in the flowcode program, I will have a go at putting them together now.
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.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac(Part One)
Hi Enamul,
Could you tell me what size the crystals are please , I can't read the schematic it's a bit small...
thank you
Acestu
Could you tell me what size the crystals are please , I can't read the schematic it's a bit small...
thank you
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.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: RTC for Miac(Part One)
Hi,
I have changed the code for 2*16 LCD...20MHz crystal
I have changed the code for 2*16 LCD...20MHz crystal
- Attachments
-
- CAN_BD_Send_Receive_Master.fcf
- (23.87 KiB) Downloaded 265 times
-
- CAN_BD_Receive_SEND_Slave.fcf
- (19.85 KiB) Downloaded 295 times
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac(Part One)
Hi Enamul,
I am a bit confused, on your schematic you have the crystal on pins 9 and 10, but my datasheet for the 18f4580 says that the osc1 and osc2 pins are 13 and 14
thanks
Acestu
I am a bit confused, on your schematic you have the crystal on pins 9 and 10, but my datasheet for the 18f4580 says that the osc1 and osc2 pins are 13 and 14
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.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: RTC for Miac(Part One)
Sorry all these because of editing...my schematic that I post just above the one you are following. you can see xtal should be in 13 & 14..
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RTC for Miac(Part One)
Thanks Enamul,
I have just tried to program the chip on my new dev board but it would not program and gave me the enclosed error messages
thanks
Acestu
I have just tried to program the chip on my new dev board but it would not program and gave me the enclosed error messages
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.
Computers are like air conditioners. They work fine until you start opening windows.