-
16f648 and Porta control
Hello Folks, Using 16f648a chip.
I cannot figure out why my chip will not run, if I toggle individual pins in PortA, But if I assign the Porta to a value (that represents the toggle), it works as required. I also realize the first program has some redundance in variables, but I didn't want to mess with removing them.
'Rspin Var Porta.1
'Enpin Var Porta.0
TRISa=%00000000
TRISb=%00000000
Counter1 var byte
Counter2 var byte
Result var word
Var1 var byte
Var4 var byte
Var0 var byte
Var5 var byte
Var1=1
Var4=4
Var0=0
Var5=5
Pause 500
Porta=Var0
Portb=13 'clear lcd
Porta=Var1
Pause 100
Porta=Var0
Porta.1=1
Pause 1000
Porta.1=0
For Counter2=65 to 95 step 1
Portb=Counter2
Porta=Var4
Pause 20
Porta=Var5
Pause 10
Porta=Var4
Pause 30
if Counter2=80 then
Porta=Var0
Portb=2 'clear lcd
Porta=Var1
Pause 100
Porta=Var0
endif
Next
end
'Rspin Var Porta.1
'Enpin Var Porta.0
TRISa=%00000000
TRISb=%00000000
Counter1 var byte
Counter2 var byte
Var1 var byte
Var4 var byte
Var0 var byte
Var5 var byte
Var1=1
Var4=4
Var0=0
Var5=5
Pause 500
Porta.0=0
Portb=13 'clear lcd
Porta.0=1
Pause 100
Porta.0=0
Porta.1=1
Pause 1000
Porta.1=0
For Counter2=65 to 95 step 1
Portb=Counter2
Porta.2=1
Pause 20
'if Portb>95 then portb=65
Porta.0=1
Pause 10
Porta.0=0
Porta.2=0
Pause 30
if Counter2=80 then
Porta.0=0
Portb=2 'clear lcd
Porta.0=1
Pause 100
Porta.0=0
endif
Next
end
-
Hello Folks
Finally found the problem...
Seems to be with Porta.2
Code is as follows:
Porta=Var5
Pause 10
Porta=Var4
I can change the Value of Porta.2 as follows;
Porta=5
But I cannot Change the Value of Porta.2 as follows.
Porta.2=1
I had to move my wire to a different pin.
Can someone explain to me why this is so?
Dwayne