PDA

View Full Version : Real Time clock and Basic StampPLC



Plitch
03-25-2007, 11:08 PM
Noobie stuff:

I am considering using a StampPLC as part of a data logging operation. It will communication via rs-232 port (via radio link) with a PC that will keep a database.

The records are some simple values, date and time. There is only 1 reading (1 data record) generated per hour. These will be kept on the PC for distribution via LAN. Of course, the PC application can receive the data from the StampPLC and add a local (to the PC) date and time. That would be the simple way! But there might be a problem with that simple method of time stamping records.....

I am considering the possibility of coding to hold records in memory at the PLC so that should the link fail, retransmission would be an option. In fact, the radio modems will do this automatically (local buffer, not in the PLC of course). Should this occur, it might be best if the date and time stamp was generated by the StampPLC when it created the record so that in the case of transmission delays the record times were accurate. It might be possible, for example, to have a number of records transmitted at once after a lengthy delay and time stamped the same by the PC on receipt thus messing up the accuracy of the data. This couldn't happen if records were time stamped when created by the StampPLC.

I am considering the use of the DS1302 real time clock chip or something similar. I need an accurate date and time, hopefully with auto adjustments for daylight savings, leap years, etc. Any other that would meet this cirteria would be considered.

The Problem: The DS1302 seems to interface to the Stamp pins 0,1,and 2. The terminals on the StampPLC and the diagrams in the StampPLC documentation have quite different names since, I believe, we are dealing with UARTs and ADCs in between the case terminals and the Stamp chip itself. I will be using the standard serial pins (Sout,Sin,ATN) to communicate with the programming PC and the radio modem while in use, so using the standard serial port is not an option.

Of course, I would have to have "both ways" communications between the PLC and the chip so that the date, time and options culd be downloaded to the clock chip as well as uploading the date and time info to the PLC.

Any suggestions as to how to connect a real time clock to the StampPLC without using the standard serial port would be appreciated. By the way, if the real time clock could be used to wake up a sleeping Basic Stamp PLC every hour on the hour, that would be even better! Your choice of clock and connections.

Many Thanks.