Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Found these Macros in PIC32 Bootloader Code, please explain?

Status
Not open for further replies.

xpress_embedo

Advanced Member level 4
Joined
Jul 5, 2011
Messages
1,154
Helped
161
Reputation
396
Reaction score
189
Trophy points
1,353
Location
India
Activity points
10,591
This is a header file i found, when i am reading the PIC32 Bootloader Code:-


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef __UART_H__
#define __UART_H__
 
#define DEFAULT_BAUDRATE            115200
 
#define Ux(y)         U2##y
 
#define UxBRG           Ux(BRG)
#define UxMODE          Ux(MODE)
#define UxSTA           Ux(STA)
#define UxSTAbits       Ux(STAbits)
#define UxSTACLR        Ux(STACLR)
#define UxSTASET        Ux(STASET)
#define UxTXREG         Ux(TXREG)
#define UxRXREG         Ux(RXREG)
 
#define TRANS_LAYER_Init UartInit
#define TRANS_LAYER_Task UartTask
#define TRANS_LAYER_Close UartClose
 
extern void TRANS_LAYER_Init(UINT);
extern void TRANS_LAYER_Task(void);
extern void UartClose(void);
#endif



I am not able to get what this macro do:-
#define Ux(y) U2##y

What i assume is that the line
#define UxBRG Ux(BRG)
and UxBRG is equilavent to U2BRG

What is this ##?
 

hai,
Your assumption is correct.

Here, UxBRG is equivalent to U2BRG.

## is the token pasting or token concatenation operator. When the macro is expanded, the tokens on the sides of the operator combines together to form a single token

Regards
 
Thank You So Much.
:)
What an Operator it is, thanks for telling me one new thing.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top