S
tarting work on a data logger based on Peter Anderson’s design. First interfaced two switches to inputs 0 and 1 and made them drive a pair of leds to show the state. These switches will handle telling the data logger to
- (0,0) Nothing
- (0,1) Clear memory and reset
- (1,1) Take Data
- (1,0) write data to serial port
Once that was working I interfaced a 10K pot to act as a voltage divider into Pin 2. Any form of analog input that is conditioned to 0-5 Volts could be input here. (Note keep currents reasonable but that shouldn’t be a problem for most analog inputs!)
Following Peter’s code I read from the ADC and store it into the EEPROM on the Pic. I made several changes to his code.
- You don’t need to reset the PIC to do a new command. Once it is initialized it waits for a command. Press button 1 to read out. Press button 2 to clear memory or Press both buttons to start data logging.
During the data logging you may press and hold button 1 to stop logging and readout. You can then either press button 2 reset, or press both buttons to restart the datalogging from the previous point.- Two LEDs now signal commands if you are not connected. LED 1 signals readout, LED 2 signals reset, Both LEDS flashing signals initialization. LED 2 flashing signals data collection.
- Program produces comma delimited output which is more friendly to graphing programs.
My code is available here: datalogger.txt
