Searching \ for 'Keypad problems reading from PORTB' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/ios.htm?key=port
Search entire site for: 'Keypad problems reading from PORTB'.

Truncated match.
PICList Thread
'Keypad problems reading from PORTB'
1999\04\16@094857 by Andreas Magnusson

picon face
Hello!

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
button).

Simple I thought....


This code worked nice....
*****************************
TEST
            BTFSS PORTB,4
            GOTO TEST
            MOVLW .90
            CALL BEEP
            MOVLW .255
            CALL DELAY


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.

TEST
            MOVF PORTB,TANKOD
            BTFSS TANKOD,4
            GOTO TEST
            MOVLW .90
            CALL BEEP
            MOVLW .255
            CALL DELAY

Why!!??

Can't I move the contents of portb to a register like I did?


Tnx for help

/Andreas Magnusson

1999\04\16@100144 by Adolfo Cobo

flavicon
face
Hi,
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:

   movf  portb,0
   movwf tank0d

Adolfo.

1999\04\16@114741 by engelec

picon face
Andreas Magnusson wrote:

{Quote hidden}

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,w
               movwf    TANKOD


Andre Abelian



{Quote hidden}

1999\04\16@205742 by paulo macedo

flavicon
face
>TEST
>             MOVF PORTB,TANKOD
>             BTFSS TANKOD,4
>             GOTO TEST

TESTE
           MOVF PORTB,0    ;PORTB IN W
           MOVWF TANKOD
           .
           .

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...