Code:
'****************************************************************
'* Name : charlieplex.pbp *
'* Author : richard *
'* Notice : *
'* : *
'* Date : *
'* Version : 16f84A *
'* Notes : *
'* : *
'*
'****************************************************************
#CONFIG
cfg = _XT_OSC
cfg&= _WDT_ON
cfg&= _PWRTE_OFF
cfg&= _CP_OFF
__CONFIG cfg
#ENDCONFIG
define osc 10
led var byte
tmp var byte
' tris port
'1 1100 0010 12,2
'2 1100 0001 12,1
'3 1001 0100 9,4
'4 1001 0010 9,2
'5 0011 1000 3,8
'6 0011 0100 3,4
'7 1010 0100 10,4
'8 1010 0001 10,1
'9 0101 1000 5,8
'10 0101 0010 5,2
'11 0110 1000 6,8
'12 0110 0001 6,1
mainloop:
for led=0 to 11
lookup led,[12,12,9,9,3,3,10,10,5,5,6,6],tmp
TRISA = $f0|tmp
lookup led,[ 2, 1,4,2,8,4, 4, 1,8,2,8,1],tmp
PORTA = tmp
pause 400
next
for led = 0 to 11
lookup led,[12,9,3,10,5,6,6,5,10,3,9,12],tmp
TRISA = $f0|tmp
lookup led,[ 2,4,8, 4, 8,8,1,2,1,4,2,1],tmp
PORTA = tmp
pause 400
next
;leds 2,9
tmp=255
while tmp
TRISA = $f0|12
PORTA = 1
pause 5
TRISA = $f0|5
PORTA = 8
pause 5
tmp=tmp-1
wend
;leds 10,12
tmp=255
while tmp
TRISA = $f0|5
PORTA = 2
pause 5
TRISA = $f0|6
PORTA = 1
pause 5
tmp=tmp-1
wend
;leds 4,8
tmp=255
while tmp
TRISA = $f0|9
PORTA = 2
pause 5
TRISA = $f0|10
PORTA = 1
pause 5
tmp=tmp-1
wend
;leds 7,11
tmp=255
while tmp
TRISA = $f0|10
PORTA = 4
pause 5
TRISA = $f0|6
PORTA = 8
pause 5
tmp=tmp-1
wend
goto mainloop
Hope you can run the above.
Bookmarks