Hi Mike, Welcome to the forum. You have analog stuff to turn off on PortA.
ADCON0 = 0 'disable A/D module disabled
ADCON1 = 127 'AN1 through AN6 as digital
Hmmm no CMCON or CMCON0 . . . . still looking . . . .
Ok now I looked at the Data sheet on the junebug. PortA is used as outputs, so let's start here:
Code:
ADCON0 = 0 'disable A/D module disabled
ADCON1 = 127 'AN1 through AN6 as digital
DEFINE OSC 4 ' or some other number as fits you
PortA = %00000000 ' a zero for each pin drives LATA registers all low so when made an output they will all be @ ground
TRISA = %00000000 ' All portA pins as outputs
PortA = %10000001 , Light 1 on
Pause 200
TRISA.7 = 1 ' Tristates PortA.7
PortA = %01000000 'Light2 on
pause 200
TRISA = %00000001 ' Tristates RA0
portA = %01000000 ' Light3 on
and so on, here is untested code
Different methods shown above.
A better way might be to use 2 lookup tables and a for next loop to display this somewhat unusual LED Array.
Code:
ADCON0 = 0 'disable A/D module disabled
ADCON1 = 127 'AN1 through AN6 as digital
DEFINE OSC 4 ' or some other number as fits you
TrisVar Var Byte
PortVar Var Byte
index Var Byte
PortA = %00000000 ' a zero for each pin drives LATA registers all low so when made an output they will all be @ ground
TRISA = %00000000 ' All portA pins as outputs
main:
For index = 0 to 5
lookup index,[%00000000,%00000000,%00000001,%00000001,%01000000,%01000000], TrisVar
lookup index,[%00000001,%01000000,%01000000,%10000000,%10000000,%00000001], PortVar
PortA = PortVar
TrisA = TrisVar
Pause 200
next index
GoTo Main
end
Bookmarks