Is that the whole program that you have coded?
'cause I don't see ANY of the ADC DEFINEs as shown in the PBP manual there, not that they're really needed, but could be helpful.
Also, are you sure the program is even running? (i.e. blinky LED?)
Is that the whole program that you have coded?
'cause I don't see ANY of the ADC DEFINEs as shown in the PBP manual there, not that they're really needed, but could be helpful.
Also, are you sure the program is even running? (i.e. blinky LED?)
Try this. I've used something similar to it on a 12F675 and had no problems. You should be able to turn on the LED for up to 255 seconds (the maximum byte value).
CMCON = 7 'comparators off
trisio = %11111111 'ALL INPUTS - HIGH & LOW COMMANDS CONVERT TO OUTPUTS
DEFINE OSCCAL_1K 1 'Set OSCCAL for 1K device
POTVALUE VAR BYTE 'POTENTIOMETER VALUE VARIABLE
LEDTIMER VAR BYTE 'LED TIMER VARIABLE
START:
LET LEDTIMER = 0 'RESET TIMER TO 0
Low GPIO.4 'TURN OFF LED ON GPIO.4
PAUSE 5000 'STAY OFF FOR AT LEAST 5 SECONDS
ADCIN 1,POTVALUE 'READ VALUE OF POT
IF POTVALUE = 0 THEN START 'STAY HERE OFF UNTIL POT IS TURNED
LEDON:
High GPIO.4 'TURN ON LED FOR 1 SECOND INCREMENTS
PAUSE 1000
LET LEDTIMER = (LEDTIMER + 1) 'COUNT SECONDS
ADCIN POTVALUE 'READ POT VALUE
IF POTVALUE > LEDTIMER THEN LEDON 'STAY HERE ON UNTIL LEDTIMER = POTVALUE
GOTO START 'LEDTIMER = POTVALUE GOTO START & RESET
Last edited by peterdeco1; - 17th June 2008 at 20:14. Reason: FORGOT LINE
Bookmarks