Hi,
I now know what PBP means
Anyway! I got a simple timer working, here is the code I used:
'03.01.14
'Test 12F683
OSCCON = %01100000 'Internal 4MHz osc
ADCON0 = 0 'A/D off
CMCON0 = 7 'Comparators off
ANSEL = 0 'Set all digital
WPU = 0 'Internal pull-ups = off
OPTION_REG = %10000000 'Pull-ups = off, GPIO.2 = I/O, prescaler to Timer1
GPIO = %00000000 'All outputs = 0 on boot
TRISIO = %00001000 'GPIO,0=data in, GPIO,1=IRLED out, GPIO,2,3,4,5 unused
Dim s As Byte 'Seconds
'needs reset>>>>>>>>>>>>>>>>>>>>>>>.
start:
If GP3 = 1 Then
Gosub sequence
Endif
Goto start
End
sequence:
GP5 = 1
WaitMs 200
GP5 = 0
WaitMs 200
GP5 = 1
WaitMs 200
GP5 = 0
WaitMs 200
For s = 0 To 52
WaitMs 1000 '50 seconds
Next s
GP5 = 1
WaitMs 200
GP5 = 0
WaitMs 200
GP5 = 1
WaitMs 200
GP5 = 0
WaitMs 200
s = 0
Return
I noticed on the data sheet, it said "GP3 is only input" so I changed my input to GP3 and it works. I'm sure if I understood better, I could get more inputs though.
Cheers, Camerart
Bookmarks