PID register Locations?

Discussion in 'Embedded Systems and Microcontrollers' started by MaxHeadRoom, Mar 9, 2018.

  1. MaxHeadRoom

    Thread Starter Expert

    Jul 18, 2013
    15,686
    4,566
    Reading through Picmicro AN937 there is a reference to two PID referenced registers.
    STATUS 1: pid_stat1/stat2 DATA REGISTER
    But Cannot find any reference to these registers in any Pic version, in particular the P18F4431 mentioned.
    Obviously missing something.:(
    Max.
     
  2. OBW0549

    Well-Known Member

    Mar 2, 2015
    2,483
    2,097
    It looks to me like pid_stat1 and pid_stat2 are variables in RAM, not PIC hardware registers. They're defined in PIDint.asm as pidStat1 and pidStat2.

    Code (Text):
    1.  
    2. pidStat1    RES    1            ;PID bit-status register
    3. pidStat2    RES    1            ;PID bit-status register2
    4. tempReg        RES    1            ;temporary register
    5. ;                                    pidStat1 register                                            
    6. ;    _______________________________________________________________________________________________
    7. ;    |  bit 7   |   bit 6    |  bit 5 |    bit 4   |   bit 3    |  bit 2   |   bit 1    |  bit 0   |
    8. ;    | pid_sign | d_err_sign |   mag  | p_err_sign | a_err_sign | err_sign |  a_err_z   |  err_z   |
    9. ;    |__________|____________|________|____________|____________|__________|____________|__________|
    10. err_z        equ    0            ;error zero flag, Zero = set
    11. a_err_z        equ    1            ;a_error zero flag, Zero = set
    12. err_sign    equ    2            ;error sign flag, Pos = set/ Neg = clear
    13. a_err_sign    equ    3            ;a_error sign flag, Pos = set/ Neg = clear
    14. p_err_sign    equ    4            ;a_error sign flag, Pos = set/ Neg = clear
    15. mag            equ    5            ;set = AARGB magnitude, clear = BARGB magnitude
    16. d_err_sign    equ    6            ;d_error sign flag, Pos = set/ Neg = clear
    17. pid_sign    equ    7            ;PID result sign flag, Pos = set/ Neg = clear
    18. ;    ________________________________ pidStat2 register______________________________________
    19. ;    | bit 7 |  bit 6  |  bit 5   |    bit 4   |   bit 3    | bit 2 |   bit 1    |  bit 0   |
    20. ;    |       |         |          |            |            |       |            | d_err_z  |
    21. ;    |_______|_________|__________|____________|____________|_______|____________|__________|
    22.  
    23.  
     
    MaxHeadRoom likes this.
  3. MaxHeadRoom

    Thread Starter Expert

    Jul 18, 2013
    15,686
    4,566
    Ah so, I missed that.:(
    It was not clear the AN937 was referring to an example program.
    Max.
     
Loading...