I am building a data logger using a PIC18LF252 that shall interface with an ethernet controller (EN28J60). Guess I overlooked the Date/Time stamp of the logged data and now need to add a RTC to my circuit.
I am using 3xA/D inputs, 1x D output, the 3-wire SPI for the ENC28J60,
RX-TX for RS232 and ICSP pins for ICD2 programmer.
Crystals: PIC18LF252@20MHz and ENC28J60@25MHz
Thanks....
The PIC being used only has one i2c / SPI interface and i'm using that for the ethernet controller. Is there another way to add a RTC to my existing circuit?
Do they all use i2c?
That seems an interesting and probably the best way of doing it. I could generate some code to keep track of the date and time and save it into memory.
As far as interupts are concerned I have not got that far yet so I'm not sure what interupts are going to be used. I know the Ethernet side of the circuit will use an interupt at the least.
Could I not possible collect the date and time from the network? This will only be wise if the circuit is continuosly on the network and if the PC's date/time is correct.
Thinking about it, that is probably the best option. My suggestion of using timer1/3 has the disadvantage that it needs resetting whenever power is cut. Futurelec do a nice little RTC module that may get you up and running and only $7.
Im sort of a beginner to all this pic programming... would adding a crystal to timer1/3 be able to serve the purpose of a RTC without compramising any other issues, bare in mind i am connecting to a ENC28J60 and implemeting the TCP/IP stack on the pic to handle the network interface....(i guess this is going to use alot of resources?)
edit: sorry didnt see the reply posts.....just busy thinking thru erics routine...
I see that PORTC 3 and 4 are *currently used for the SPI as a default. Can i just change it to two free ports say PORTB?
Does the code need any adjusting for inserting it into C18?