Does any of this make any sense and am I at all on the right track or at least headed in the right direction or did I hit a dead end?
looks like a dead end to me . try this way
code is for a 12f1822 so uses porta and porta.3 is input only . but you get the idea
Code:
'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 29/11/2014 *
'* Version : 1.0 *
'* Notes : *
'* : pic12f1822 *
'****************************************************************
#CONFIG
cfg1 = _FOSC_INTOSC
cfg1&= _WDTE_ON
cfg1&= _PWRTE_OFF
cfg1&= _MCLRE_ON
cfg1&= _CP_OFF
cfg1&= _CPD_OFF
cfg1&= _BOREN_ON
cfg1&= _CLKOUTEN_OFF
cfg1&= _IESO_ON
cfg1&= _FCMEN_ON
__CONFIG _CONFIG1, cfg1
cfg2 = _WRT_OFF
cfg2&= _PLLEN_OFF
cfg2&= _STVREN_ON
cfg2&= _BORV_19
cfg2&= _LVP_OFF
__CONFIG _CONFIG2, cfg2
#ENDCONFIG
osccon=$6a '4 mhz
anselA=0
trisa=000
a var byte
b var byte
c var byte
d var byte
pin_mode var byte
x var byte
a=0
b=1
c=2
d=4
pin_mode=0
action:
for x = 1 to 5
lata.0[a] = 1
lata.0[b] = 1
lata.0[c]= 0
lata.0[d]= 0
pause 200
lata.0[a] = 0
lata.0[b] = 0
lata.0[c]= 0
lata.0[d]= 0
pause 200
next x
for x = 1 to 5
lata.0[a] = 0
lata.0[b] = 0
lata.0[c]= 1
lata.0[d]= 1
pause 200
lata.0[a] = 0
lata.0[b] = 0
lata.0[c]= 0
lata.0[d]= 0
pause 200
next x
gosub shuffle
goto action
shuffle :
pin_mode=pin_mode+1
select case pin_mode
case 1
a=4 ;a var portb.3
b=2 ;b var portb.2
c=1 ;c var portb.1
d=0 ;d var portb.0
case 2
a=0 ;a var portb.0
b=4 ;b var portb.3
c=2 ;c var portb.2
d=1 ;d var portb.1
case 3
a=0 ;a var portb.0
b=2 ;b var portb.2
c=1 ;c var portb.1
d=4 ;d var portb.3
case 4
a=0 ;a var portb.0
b=1 ;b var portb.1
c=2 ;c var portb.2
d=4 ;d var portb.3
pin_mode=0
end select
return
Bookmarks