PIC Assembly Program Help

Discussion in 'Embedded Systems and Microcontrollers' started by ozirock, Feb 3, 2011.

  1. ozirock

    Thread Starter Member

    Jan 13, 2011
    44
    0
    Hi,

    I'm trying to interpret a signal from an RC receiver using a PIC16f627. I'm going on the receiver sending a pulse every 20ms and the length of that pulse determining the position of the joystick on the controller. I'd just like to know if I have the timing of my pin testing correct, my code is:

    Code ( (Unknown Language)):
    1. ;**** All Input Pulse Test ****
    2. Pulse_Check     MOVLW   D'10'
    3.                 MOVWF   T_10
    4.         MOVLW   D'10'
    5.                 MOVWF   Ind_T                
    6.         MOVLW   D'210'
    7.                 MOVWF   IN1_S
    8.                 MOVLW   D'210'
    9.                 MOVWF   IN2_S
    10.                 MOVLW   D'210'
    11.                 MOVWF   IN3_S
    12. INC_T2          MOVLW   D'200'
    13.                 MOVWF   T_200                
    14. IN1_Check   call    Servo_Delay
    15.         BTFSC   PORTA,IN1
    16.         DECFSZ  IN1_S,1    
    17.         goto    IN2_Check      
    18. IN2_Check   BTFSC   PORTA,IN2
    19.         DECFSZ  IN2_S,1    
    20.         goto    IN3_Check
    21. IN3_Check   BTFSC   PORTA,IN3
    22.         DECFSZ  IN3_S,1    
    23.         goto    INC_T      
    24. INC_T       DECFSZ  T_200,1
    25.         goto    IN1_Check
    26.         DECFSZ  Ind_T,1
    27.         goto    INC_T3
    28. INC_T3      DECFSZ  T_10,1
    29.         goto    INC_T2
    And servo delay is given by the code:

    Code ( (Unknown Language)):
    1. Servo_Delay
    2.             ;6 cycles
    3.     goto    $+1
    4.     goto    $+1
    5.     goto    $+1
    6.  
    7.             ;4 cycles (including call)
    8.     return
    I think my problem is that the code makes my sample time more than 20ms but I'm not sure can anyone tell me if it is or not?

    If you want to see the full code you can get the .asm files here. The code above is from RC Cobra LED C. The other file bridge_oisin is an attempt I made to redo someone else's code but it didn't work properly either I'm not sure why.

    Thanks in advance for any help :)
     
  2. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    I wouldn't try to count the 20ms.
    What I would do is wait for the pulse to start, then run through your checks, decreasing the IN1_S, etc (a more meaningful name would help people reading it).
    I'd also be decreasing another count which started from 211 and when that reached zero I would copy all the IN1_S, etc to another set of variables (so that the real value is always available).
    At that point it doesen't matter how long it takes until the next pulse starts, you can do something else or just wait for the pulse.
    Hope this makes sense.

    I'm also assuming that all the pulses start at the same time, but I could be wrong, if not it gets a little more complicated.

    A lot of your decfsz statements and the goto after them could just be replaced with decf because the goto is just to the next line.
     
  3. ozirock

    Thread Starter Member

    Jan 13, 2011
    44
    0
    Sorry about the mistakes I'm fairly new to programming in assembly, in theory the pulses should all start at 20ms intervals but I'm working on a labview program to try read the signal so I can know that for certain but I'm having issue's with that too.

    I've redone the code like you suggested I think, I removed the DECFSZ's where you suggested and changed the BTFSC to BTFSS as I think this means that I'm only measuring from the start of the pulse, is that correct?

    Here's my code now:

    Code ( (Unknown Language)):
    1. ;**** All Input Pulse Test ****
    2. Pulse_Check     MOVLW   D'210'
    3.                 MOVWF   INPUT1_PULSE_LENGTH
    4.                 MOVLW   D'210'
    5.                 MOVWF   INPUT2_PULSE_LENGTH
    6.                 MOVLW   D'210'
    7.                 MOVWF   INPUT3_PULSE_LENGTH
    8.             MOVLW   D'200'
    9.                 MOVWF   T_200                
    10. IN1_Check   call    Servo_Delay
    11.         BTFSS   PORTA,IN1
    12.         goto    Pulse_Check
    13.         DECF    INPUT1_PULSE_LENGTH,1              
    14. IN2_Check   BTFSC   PORTA,IN2
    15.         DECF    INPUT2_PULSE_LENGTH,1      
    16. IN3_Check   BTFSC   PORTA,IN3
    17.         DECF    INPUT3_PULSE_LENGTH,1              
    18. INC_T       DECFSZ  T_200,1
    19.         goto    IN1_Check
    20.        
    21. ;**** Move Input Values to Permanent Location ****
    22.         MOVLW   INPUT1_PULSE_LENGTH
    23.                 MOVWF   IN1_S
    24.         MOVLW   INPUT2_PULSE_LENGTH
    25.                 MOVWF   IN2_S
    26.         MOVLW   INPUT3_PULSE_LENGTH
    27.                 MOVWF   IN3_S
    Thanks you very much for your help.
     
  4. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,671
    898
    They do start roughly at 20 mS intervals, but not at the same time for each channel, at least up to 9 channel receivers. I think you will need an edge detector in your program for each channel.

    John
     
  5. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Getting closer I think.
    I'll reply again tomorrow because I don't have much time now.

    This bit:
    MOVLW INPUT1_PULSE_LENGTH
    MOVWF IN1_S

    should be

    MOVF INPUT1_PULSE_LENGTH, W
    MOVWF IN1_S

    because otherwise the memory location of INPUT1_PULSE_LENGTH (good name by the way) instead of it's value gets moved to the W register.
     
  6. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Good catch John, the pulses probably don't start at the same time.
    http://www.rcgroups.com/forums/showthread.php?t=590765

    A few questions ozirock:
    Do you want this to work on every receiver or just the one you have?
    Have you got an oscilloscope or a PICKIT2 (which can be used as a logic analyser)?
    What else does the PIC need to do apart from receive the pulses?
     
  7. ozirock

    Thread Starter Member

    Jan 13, 2011
    44
    0
    I completely missed that thank you for pointing it out, I've changed it a bit so that I'm pretty sure that now it measure's each pulse individually then saves the values elsewhere for use later in the program, here's my code:

    Code ( (Unknown Language)):
    1. ;**** All Input Pulse Test ****
    2. Pulse_Check     MOVLW   D'210'
    3.                 MOVWF   INPUT1_PULSE_LENGTH
    4.                 MOVLW   D'210'
    5.                 MOVWF   INPUT2_PULSE_LENGTH
    6.                 MOVLW   D'210'
    7.                 MOVWF   INPUT3_PULSE_LENGTH
    8.                
    9. IN1_Check   call    Servo_Delay
    10.         BTFSS   PORTA,IN1
    11.         goto    IN1_Check
    12. IN1_Check_2 DECF    INPUT1_PULSE_LENGTH,1
    13.         call    Servo_Delay
    14.         BTFSS   PORTA,IN1
    15.         goto    IN1_Check_2
    16.        
    17. IN2_Check   call    Servo_Delay
    18.         BTFSS   PORTA,IN2
    19.         goto    IN2_Check      
    20. IN2_Check_2 DECF    INPUT2_PULSE_LENGTH,1
    21.         call    Servo_Delay
    22.         BTFSS   PORTA,IN2
    23.         goto    IN2_Check_2
    24.        
    25. IN3_Check   call    Servo_Delay
    26.         BTFSS   PORTA,IN3          
    27.         goto    IN3_Check
    28. IN3_Check_2 DECF    INPUT3_PULSE_LENGTH,1
    29.         call    Servo_Delay
    30.         BTFSS   PORTA,IN3
    31.         goto    IN3_Check_2    
    32.        
    33. ;**** Move Input Values to Permanent Location ****
    34.         MOVLW   INPUT1_PULSE_LENGTH, W
    35.                 MOVWF   IN1_S
    36.         MOVLW   INPUT2_PULSE_LENGTH, W
    37.                 MOVWF   IN2_S
    38.         MOVLW   INPUT3_PULSE_LENGTH, W
    39.                 MOVWF   IN3_S

    I just want it to work with my receiver really.

    I have a Velleman K8055 which I'm trying to use to get a visual representation of the signal is that the kind of thing you mean? I'm having a bit of trouble with that but a friend of mine is going to try help me with it on Monday.

    There are 3 controls on the remote, a switch and two joysticks, depending on the position of the switch the joysticks either control a motor and a servo or they turn on and off LED's. Or at least thats the plan :)
     
  8. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Looks like it's on the right track. Hopefully the vellman can show exactly what is happening so we will know the right method to use and see what signal the switch gives (it could be just a 1 or 2 ms pulse).

    I think these changes should make it work better:

    Code ( (Unknown Language)):
    1. IN3_Check    [B];not required[/B] call     Servo_Delay
    2.         BTFSS    PORTA,IN3            
    3.         goto    IN3_Check
    4. IN3_Check_2    DECF    INPUT3_PULSE_LENGTH,[B]F[/B] ;(just looks better)
    5.         call     Servo_Delay
    6.         [B]BTFSC[/B]    PORTA,IN3
    7.         goto    IN3_Check_2        
    8.        
    9. ;**** Move Input Values to Permanent Location ****
    10.         [B]MOVF[/B]   INPUT1_PULSE_LENGTH, W
    11.                 MOVWF   IN1_S
     
  9. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,671
    898
    If it is a standard RC receiver, on the servo out pins, center is V+, one is ground, and the other is signal. Generally, it does not hurt if you accidentally connect signal to ground, but it won't work. Connecting V+ to ground will burn out a servo very quickly. The pulses you are trying to see are 1 to 2 mS wide (I suspect you knew that). Set your scope to 1 mS per division, connect the ground to ground pin and probe to the signal pin. 5 to 10 V full scale should be about right to get started. If you have an old servo connector with a lead, it makes the connections easier. You may need to turn the transmitter on to see the signal.

    That is a very odd set-up. As I understand it, the receiver is 4 channel, but the transmitter can only control two channels at a time. I would be sure to check what happens to the two channels that are not being controlled. The more likely explanation is that I don't understand the configuration you are talking about.

    John
     
  10. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    How does the motor need controlling? Does it need forward and reverse and does it need speed control? Also will you use a motor controller chip or do it with mosfets / bipolar transistors?
    Full control with just the PIC could get more complicated without a motor chip, otherwise it's pretty easy.
     
  11. ozirock

    Thread Starter Member

    Jan 13, 2011
    44
    0
    Markd77

    I've made the changes as you suggested hopefully this looks right now

    Code ( (Unknown Language)):
    1. ;**** All Input Pulse Test ****
    2. Pulse_Check     MOVLW   D'210'
    3.                 MOVWF   INPUT1_PULSE_LENGTH
    4.                 MOVLW   D'210'
    5.                 MOVWF   INPUT2_PULSE_LENGTH
    6.                 MOVLW   D'210'
    7.                 MOVWF   INPUT3_PULSE_LENGTH
    8.                
    9. IN1_Check   BTFSS   PORTA,IN1
    10.         goto    IN1_Check
    11. IN1_Check_2 DECF    INPUT1_PULSE_LENGTH,F
    12.         call    Servo_Delay
    13.         BTFSC   PORTA,IN1
    14.         goto    IN1_Check_2
    15.        
    16. IN2_Check   BTFSS   PORTA,IN2
    17.         goto    IN2_Check      
    18. IN2_Check_2 DECF    INPUT2_PULSE_LENGTH,F
    19.         call    Servo_Delay
    20.         BTFSC   PORTA,IN2
    21.         goto    IN2_Check_2
    22.        
    23. IN3_Check   BTFSS   PORTA,IN3          
    24.         goto    IN3_Check
    25. IN3_Check_2 DECF    INPUT3_PULSE_LENGTH,F
    26.         call    Servo_Delay
    27.         BTFSC   PORTA,IN3
    28.         goto    IN3_Check_2    
    29.        
    30. ;**** Move Input Values to Permanent Location ****
    31.         MOVF   INPUT1_PULSE_LENGTH, W
    32.                 MOVWF   IN1_S
    33.         MOVF   INPUT2_PULSE_LENGTH, W
    34.                 MOVWF   IN2_S
    35.         MOVF   INPUT3_PULSE_LENGTH, W
    36.                 MOVWF   IN3_S
    Yes the motor should be able to go forward and reverse hopefully with speed control using PWM, would you think I'd need a second pic for this? I'm wondering if the timing would just be too complicated with the pulse check running along side the motor PWM. The motor is controlled using a motor driver chip and logic inverter so it takes two pins to control. I've tested this circuit and all seem's to work fine.

    jpanhalt

    I've got some help from a guy at Velleman and unfortunately it just can't sample fast enough to see the signal, 10ms intervals is as good as it can do.

    Sorry I explained it badly, it's out of an old RC plane, I think your right about the 4 channels as the receiver has four ports, 1 channel is controlled by the switch and used to turn on the motor when it was in the plane, another 2 channels are controlled by the joysticks and they used to control the tail fins of the plane, I've no idea what the final channel is for I don't think it's used at all.
     
  12. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    With the motor driver chip it is pretty easy. Have a look at the PWM section in the datasheet.
    I'm pretty sure this code should set it up nearly correct. It's for the 16F628 but I think it should work OK.

    Code ( (Unknown Language)):
    1.     BSF STATUS, RP0         ; Select Bank 1
    2.     movlw 0xFF
    3.     movwf PR2                ;PWM setting
    4.     MOVLW B'11000011'          
    5.     MOVWF TRISA             ; Set RA<1:0 and 7:6> as input all others out
    6.     MOVLW B'11110111'          
    7.     MOVWF TRISB             ; Set all input except RB3 PWM out
    8.  
    9.     BCF STATUS, RP0         ;bank 0
    10.     movlw B'00000100'        
    11.     movwf T2CON                ;timer 2 on, no prescaler or postscaler
    12.     movlw B'00001111'
    13.     movwf CCP1CON
    14.     movlw 0x04
    15.     movwf CCPR1L
     
  13. ozirock

    Thread Starter Member

    Jan 13, 2011
    44
    0
    I had no idea I could do that, embarrassingly I taught I had to do it with delay loops. Does this only work with specific pins on the chip or will any pin I set as an output be able to utilise this PWM?

    I tried to put your code into my reset/initialize routine here:

    Code ( (Unknown Language)):
    1. RESET       MOVLW   B'00000111' ;Disable Comparator module's
    2.         MOVWF   CMCON
    3.         ;
    4.         BSF STATUS,RP0  ;Switch to register bank 1
    5.                     ;Disable pull-ups
    6.                     ;INT on rising edge
    7.                     ;TMR0 to CLKOUT
    8.                     ;TMR0 Incr low2high trans.
    9.                     ;Prescaler assign to Timer0
    10.                     ;Prescaler rate is 1:256
    11.         MOVLW   B'11010111' ;Set PIC options (See datasheet).
    12.         MOVWF   OPTION_REG  ;Write the OPTION register.
    13.                     ;
    14.         CLRF    INTCON      ;Disable interrupts
    15.        
    16.         movlw   0xFF
    17.             movwf   PR2             ;PWM setting
    18.        
    19.         MOVLW   B'00000000'
    20.         MOVWF   TRISB       ;all RB ports are outputs
    21.                    
    22.         MOVLW   B'00011100' ;RA3:RA5 ports are inputs, all others are outputs
    23.         MOVWF   TRISA
    24.        
    25.         BCF STATUS,RP0  ;Switch Back to reg. Bank 0
    26.         movlw   B'00000100'        
    27.         movwf   T2CON           ;timer 2 on, no prescaler or postscaler
    28.         movlw   B'00001111'
    29.         movwf   CCP1CON
    30.         CLRF    CCPR1L
    31.             CLRF    PORTB
    Does this code give 4 possible speeds, is that what the following lines do?

    Code ( (Unknown Language)):
    1. movlw 0x04
    2.     movwf CCPR1L
    I've been looking a this tutorial http://www.winpicprog.co.uk/pic_tutorial8.htm and would I be right to say you would control the motor with the following code:

    Code ( (Unknown Language)):
    1.     MOVLW   d'64'
    2.     CALL    Speed       ;both half speed forwards
    3.  
    4.  
    5. Speed:              ;use value in W to set speed (0-127)
    6.         MOVWF   temp
    7.     BTFSC   temp, 7     ;if more than 128 set speed in reverse
    8.     CALL    Reverse     ;so '1' is very slow forward
    9.     BTFSS   temp, 7     ;and '129' is very slow reverse
    10.     CALL    Forward
    11.     ANDLW   0x7F
    12.         MOVWF   CCPR1L
    13.     RETURN
    14.  
    15. Reverse:
    16.     BSF PORTB, Motor_On ;set pins for reverse
    17.     BCF PORTB, Direction
    18.     RETURN
    19.  
    20. ForwardL:
    21.     BSF PORTB, Motor_On ;set pins for forward
    22.     BSF PORTB, Direction
    23.     RETURN
    I'm not sure where the switching to reverse at 127/128 came into the program though would it be with the following code?

    Code ( (Unknown Language)):
    1.         MOVLW    126        ;set highest PWM value
    2.         BANKSEL  PR2        ;over this (127) is permanently on
    3.         MOVWF    PR2
    4.         BANKSEL  TMR2
    Thanks for all your help, hope my questions aren't too stupid :)
     
  14. ozirock

    Thread Starter Member

    Jan 13, 2011
    44
    0
    Sorry ignore this part as I figure out that it was setting the motor moving not setting a range of speeds.

     
  15. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    It's only available on one pin (PORTB,3) on the 16F627.
    The testing for reverse is the btfsc temp,7 line (and the other one). In binary the MSB is 1 for any number over 127 (127 is 01111111, 128 is 10000000).
    It's probably best to use their values for the PWM registers instead of mine.
    Maybe a good thing to do at this point is to test if the pulse decoding part works. You could light up 3 LEDs based on testing if the pulse lengths are bigger than some mid value. Then change the value and see if it works as expected.
     
  16. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,671
    898
    The usual controls would be motor on/off, motor speed ("throttle"), elevator, rudder, and ailerons. With 4 channels, the on/off and motor speed are on the same channel. You have to reduce the throttle to zero, then advance to start the motor. Sometimes, you actually have to restart the receiver and/or transmitter with the throttle in zero for it to even recognize the throttle control.

    John
     
  17. ozirock

    Thread Starter Member

    Jan 13, 2011
    44
    0
    @ Markd77

    I've concentrated on the pulse decoding part like you suggested and found that the switch works well when set around 100 and the joysticks appear to be centered around 110. The switch is working perfectly with the following code:

    Code ( (Unknown Language)):
    1. ;**** Switch Pulse Test ****
    2. IN1_Test    movf    S_160,W     ;**** X => 160 ****
    3.             subwf   IN1_S,W
    4.             btfsc   STATUS,C
    5.             goto    LC1
    6.             movf    S_160,W     ;**** X < 160 ****
    7.         subwf   IN1_S,W
    8.         btfss   STATUS,C
    9.             goto    IN2_Test           
    10.             goto    Pulse_Check
    However the code for testing the joystick didn't work properly, it doesn't appear to be registering the idle position i.e. it is going straight from the forward to the reverse. I think there may be an issue with my logic but I can't see an issue, here is the code for this section:

    Code ( (Unknown Language)):
    1. ;**** First Light Control ****
    2. LC1     movf    IN2_S,W     ;**** X =< 140 ****
    3.         subwf   S_140,W
    4.         btfsc   STATUS,C
    5.             goto    Dip_C
    6.  
    7. ;**** 140 < X < 160 ****
    8.             movf    IN2_S,W     ;**** 140<X<160 ****
    9.             subwf   S_140,W
    10.             btfsc   STATUS,C
    11.             goto    $+5
    12.             movf    S_160,W
    13.             subwf   IN2_S,W
    14.             btfss   STATUS,C
    15.             goto    LC1_Idle
    16.  
    17. ;**** X => 160 ****        
    18.             movf    S_160,W     ;**** X => 160 ****
    19.         subwf   IN2_S,W
    20.         btfsc   STATUS,C
    21.             goto    FB_C
    @ jpanhalt

    Ah you see this one didn't have a throttle control, when you flicked the switch the motor came on full. The left joystick controlled the elevator and the right joystick controlled the tail. It's a jamara XT-3, the pictures are very small on google but here it is, hopefully you can make out the controls http://img.archiwumallegro.pl/?1140000400
     
  18. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    I think you just have the btfsc and btfss the wrong way round.
    It catches nearly everyone out (including me).
    If you add two numbers and there is an overflow then the carry bit gets set, however if you subtract two numbers and there is an overflow the carry bit is clear, it's set if there is no overflow.
     
  19. ozirock

    Thread Starter Member

    Jan 13, 2011
    44
    0
    I've tried them both ways now and I'm still only getting the two extreme's. I've made it as simple as I can I think, after the test the pulse lengths are moved to the new names:

    Code ( (Unknown Language)):
    1. ;**** Move Input Values to Permanent Location ****
    2.         MOVF   INPUT1_PULSE_LENGTH, W   ;**** Switch ****
    3.                 MOVWF   IN1_S
    4.         MOVF   INPUT2_PULSE_LENGTH, W   ;**** Joystick 1 ****
    5.                 MOVWF   IN2_S
    6.         MOVF   INPUT3_PULSE_LENGTH, W   ;**** Joystick 2 ****
    7.                 MOVWF   IN3_S
    These are then tested to see what lights should be on for example here is Joystick 1:

    Code ( (Unknown Language)):
    1. ;**** First Light Control ****
    2. LC1     movf    IN2_S,W     ;**** X =< 140 ****
    3.         subwf   S_140,W
    4.         btfsc   STATUS,C
    5.             goto    Dip_C
    6.  
    7. ;**** 140 < X < 160 ****
    8.             movf    IN2_S,W     ;**** 140<X<160 ****
    9.             subwf   S_140,W
    10.             btfss   STATUS,C
    11.             goto    $+5
    12.             movf    S_160,W
    13.             subwf   IN2_S,W
    14.             btfsc   STATUS,C
    15.             goto    LC1_Idle
    16.  
    17. ;**** X => 160 ****        
    18.             movf    S_160,W     ;**** X => 160 ****
    19.         subwf   IN2_S,W
    20.         btfsc   STATUS,C
    21.             goto    FB_C
    22.  
    Then this turns on the LED's as follows:

    Code ( (Unknown Language)):
    1. ;**** Full Beam Control ****
    2. FB_C        movlw   B'00000011'     ;Turn on Full Beams and Dips
    3.         movwf   PORTB
    4.         goto    LC2                
    5.  
    6.  
    7. ;**** LC1 Idle ****
    8. LC1_Idle        movlw   B'00000000'     ;Turn all off
    9.         movwf   PORTB
    10.         goto    LC2
    11.  
    12.  
    13. ;**** Dips Control ****
    14. Dip_C       movlw   B'00000010'     ;Turn on Dips
    15.         movwf   PORTB
    16.             goto    LC2
    And then it goes back to do the same for the second joystick.

    I can't see where it's going wrong, any suggestions?
     
  20. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    I've made a couple of changes and commented a couple of bits out, because there is no need for two checks.
    If the second section, if you write to PORTB in the same way, it will overwrite the changes you made in the first section (if you see what I mean).
    Just for testing it might be worth just looking at one stick at a time.
    Have you tried the simulator in MPLAB yet? It's very useful for this sort of thing, you can make changes to the registers and step through the code to see where it goes and what changes.
    Code ( (Unknown Language)):
    1. ;**** First Light Control ****
    2. LC1        movf    IN2_S,W        ;**** X =< 140 ****
    3.         subwf   S_140,W
    4.         btfsc   STATUS,C
    5.             goto    Dip_C
    6.  
    7. ;**** 140 < X < 160 ****
    8. ;            movf    IN2_S,W        ;**** 140<X<160 ****
    9. ;            subwf   S_140,W
    10. ;            btfss   STATUS,C
    11. ;            goto    $+5
    12. [B]            movf    IN2_S,W
    13.             subwf   S_160,W[/B]
    14.             btfsc   STATUS,C
    15.             goto    LC1_Idle
    16.  
    17. ;**** X => 160 ****            
    18. ;            movf    S_160,W        ;**** X => 160 ****
    19. ;        subwf   IN2_S,W
    20. ;        btfsc   STATUS,C
    21.             goto    FB_C
     
Loading...