I’m trying to understand this embedded c code. I think it means it is connecting port bits to some register in a bus. Correct me if I’m wrong. And what ever changes we make to the ports will be reflected on the bus registers. Here is the snippet of the code. Thanks.
/*--------------------------------------------------------------------------
Local Variables
--------------------------------------------------------------------------*/
// Port bits assigned to Amba Peripheral Bus (APB)
// P0^7..P0^0 // output=reg_addr, input=data_in (APB prdata)
sbit APB_SEL = P1^7; // select a bus transaction
sbit APB_EN = P1^6; // enable/activate a component 0 = disable, 1 = enable
The code is defining bit positions to be read from registers.
sbitdefines a bit within a special function register (SFR).Here
P1is a previously defined SFR. The line defines APB_SEL as bit 7 (zero-based numbering) ofP1.This link has additional details on the syntax.