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:
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

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

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


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

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


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

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

           MOVF PORTB,0    ;PORTB IN W
           MOVWF TANKOD

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