'Keypad problems reading from PORTB'
I have a problem. I am constructing a "controll system" for my robot. I use
a keypad wich generate a high level on a pin when any of the buttons are
pushed down. I want to read this byte and If it is set I check out wich
button who was pushed down (the card gives out 4 bits that tells wich
Simple I thought....
This code worked nice....
But when I first moved the contents of portb to the register "TANKOD" and
then checked portb,4 in that register It didn't worked at all.
Can't I move the contents of portb to a register like I did?
Tnx for help
I think that the code "MOVF PORTB,TANKOD" doesn't move portb to the
register TANK0D, but to the working register W or to portb itself depending
of the address of tank0d. Well, I'm not sure, but try:
Andreas Magnusson wrote:
this line doesn't look right if TANKOD is a register then that is the
problem you can't move PORTB like that but if TANKOD is = 0 then it
means you are loading it in W register. correct way is
> MOVF PORTB,TANKOD
> BTFSS TANKOD,4
> GOTO TEST
MOVF PORTB,0 ;PORTB IN W
More... (looser matching)
- Last day of these posts
- In 1999
, 2000 only
- New search...