Author Topic: PIC18F BTFSS, BTFSC  (Read 1891 times)

0 Members and 1 Guest are viewing this topic.

Offline davorinTopic starter

  • Supporter
  • ****
  • Posts: 922
  • Country: ch
PIC18F BTFSS, BTFSC
« on: October 08, 2014, 02:33:10 pm »
It is a while though since I last did some PIC assembly....but this one is driving me nuts the whole afternoon (o;

After reset I poll an input for a time pulse from an external device....so a combination of btfss/btfsc is the solution:

Code: [Select]
Pulse_1:
    BTFSC   PORTA, 4
    GOTO    Pulse_1

    CALL    Wait_0
Pulse_2:
    BTFSS   PORTA, 4
    GOTO    Pulse_2

    CALL    Wait_1
Pulse_3:
    BTFSC   PORTA, 4
    GOTO    Pulse_3

So this one works...but not always...sometimes hangs before "Pulse_3"...

When I try the other way around:

Code: [Select]
Pulse_1:
    BTFSS   PORTA, 4
    GOTO    Pulse_1

    CALL    Wait_0
Pulse_2:
    BTFSC   PORTA, 4
    GOTO    Pulse_2

    CALL    Wait_1
Pulse_3:
    BTFSS   PORTA, 4
    GOTO    Pulse_3

..it always hangs before "Pulse_3"....the "CALL Wait_1" and "CALL Wait_2" are just subroutines displaying LED debugging information...

Is there something special about the PIC18F4550?

Think I have configured the PORTA correctly...

Code: [Select]
    MOVLW   0Fh
    MOVWF   ADCON1
    MOVLW   7
    MOVWF   CMCON
    MOVLW   h'ff'
    MOVWF   TRISA


 

Offline davorinTopic starter

  • Supporter
  • ****
  • Posts: 922
  • Country: ch
Re: PIC18F BTFSS, BTFSC
« Reply #1 on: October 08, 2014, 06:11:45 pm »
Stupid me (o;

Of course btfsc/btfss continues with an external 1Hz pulse (o;

Just realized that the GPS module already sends data to the UART, causing to overrun....
therefore a new character received was never detected...so it just hanged...

Seem clearing bit CREN in RXSTA seems to solve the problem....

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf