Bit nomenclature

General discussion on mikroPascal PRO for PIC32.
Post Reply
Author
Message
LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

Bit nomenclature

#1 Post by LGR » 18 Jan 2013 03:17

When addressing a peripheral bit, the way Microchip names bits and the way Mikroelektronika implements them doesn't make sense. Here's an example:

Each UART has a status register named UxSTA; i.e. UART 1 has U1STA, UART 2 has U@STA, etc. Inside of that registers are bits with names, such as UxSTA.4 = RIDLE, UxSTA.3 = PERR, etc. If I type RIDLE or RIDLE_bit into mPascal, the identifiers are recognized, even though there is one per UART! If I try something like U1RIDLE, it's not recognized.

How is this supposed to work? How to I address these bits and the specific peripheral other than doing what I've been doing, and calling them U1STA.4, U2STA.4, etc.? Do RIDLE and PERR, etc. refer to UART 1 only?
If you know what you're doing, you're not learning anything.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Bit nomenclature

#2 Post by filip » 18 Jan 2013 10:37

Hi,

If you look at the definition file of the PIC32 MCU, you can see how the individual bits are implemented :

Code: Select all

    var   RIDLE_bit : sbit at U1STA.B4;
    var   PERR_bit : sbit at U1STA.B3;

    var   RIDLE_U2STA_bit : sbit at U2STA.B4;
    var   PERR_U2STA_bit : sbit at U2STA.B3;

    var   RIDLE_U5STA_bit : sbit at U5STA.B4;
    var   PERR_U5STA_bit : sbit at U5STA.B3;
The RIDLE_bit and PERR_bit refer only to the UART1 module.
The RIDLE and PERR bits that belong to other UART modules have the name as in the example above.

Regards,
Filip.

Post Reply

Return to “mikroPascal PRO for PIC32 General”