Problem with BTFSC instruction Pic16f877A in PICC

Discussion in 'Embedded Systems and Microcontrollers' started by anhnha, May 24, 2012.

  1. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    Hi everyone,
    I have a problem with BTFSC in PICC with pic16f877A.I used the following code but it seem that BTFSC do not work.Both bits of portc always is set.
    Code ( (Unknown Language)):
    2. BTFSC 0x4F,1
    3. bsf portc, 5
    4. bsf portc, 6
    Could you help me this?
    Thanks in advance.
  2. John P

    AAC Fanatic!

    Oct 14, 2008
    Does anything ever clear Portc 5 and 6? If you only set them and never clear them, you shouldn't be surprised if they're always set.
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    How did you test this? Did you just simulate or test it in a circuit. It is hard to tell anything from the code you posted. For all I know you can be in the wrong memory bank. Or the TRISC register may have the wrong setting. Can you post all your code?