Accessing undefined bits in PIC24

Discussion in 'Embedded Systems and Microcontrollers' started by Peytonator, May 21, 2011.

  1. Peytonator

    Thread Starter Active Member

    Jun 30, 2008

    I'm currently using MPLABC30 with a PIC24F16KA102 to do serial comms. I'm trying to use U2TX to transmit a value. But how do I test the UTXBF flag when it's not defined for the U2STA register? Here is the header file for the PIC.

    "_UTXBF cannot be defined because it is used by more than one SFR"

    So how do I access this bit, or any other bit that is not defined?

    I'm not yet learned enough to deal directly with memory structs etc. Help!

    Thanks :)
  2. AlexR

    Well-Known Member

    Jan 16, 2008
    The header file shows that UTXBF is defined as a bit field in both the U1STA and U2STA registers.

    To access it in the U1STA register you use U1STABITS.UTXBF and for the U2STA register you use U2STABITS.UTXBF.
    Peytonator likes this.