Timer Function? Not sure what I need here.
I need to call a sub on a schedule, say every 30 minutes. The sub reads 8 ADC's into a VAR Array and sets PORTB based on those numbers.
I dont need it so accurate that I would need a RTC, but I would like to get in the neiborhood of 30 minutes. and I need it to do this like an interupt where it will fire even in a pause mode.
Here is what I need to call every 30 minutes (and optional on button would be nice but PORTB INT's are being used)
Code:
ReadVolts:
For X = 0 to 7
PORTE = X 'Activates Binary Relays
PAUSE 100 ' Allow Relay contacts to settle before ADC Conversion
ADCIN 0, VOLTS[X] ' Read Channel 0 data
VOLTS[X] = VOLTS[X] / 13 ' 64k = ~5000 mv (temporary math)
if VOLTS[X] > 4000 then
PORTB.0[X] = 1
ELSE
PORTB.0[X] = 0
ENDIF
PauseUS 100 ' Pause for ADC Refresh
NEXT X
RETURN
PORTB uses Bipolar LEDs for status indicators. I am going to assume I need to use one of the internal timers, but I have never used them. So if anyones got any ideas or code samples....
Chris
Any man who has accomplished anything in electronics at one time or another has said... " STOP! WAIT! NOOO! Dangit.... Oh Well, Time to start over..."
Bookmarks