// Name : BLINK_1.BAS
Device = 18F1320
Clock = 4 // 4MHz clock
Include "junebug.bas"
Dim Count As Byte
Dim GO As ADCON0.1
OSCCON = $62 // select 4MHz internal clock
ADCON1 = %11110101 // digital I/O except RA1 & RA3
ADCON0 = %00000101 //A2D on and select AN1
ADCON2 = %00110101 //Left justify - Fosc/16
While True
Count = 1
While Count < 6
GO = 1 //start conversion
While(GO=1) //wait for it to complete
Wend
LED(Count) // light LED(1..6) or none LED(0)
DelayMS(ADRESh+10) // delay in 1000s of a second
Inc(Count)
Wend
While Count > 1
GO = 1 //start conversion
While(GO=1) //wait for it to complete
Wend
LED(Count) // light LED(1..6) or none LED(0)
DelayMS(ADRESh+100) // delay in 1000s of a second
Dec(Count)
Wend
Wend
End