Let me preface by saying I am working with a Microchip PIC32MX-series chip and the C32 compiler.
Ok so usually when I want to define a port pin as some name, I do it like this
And if I want to #define an entire port, I do it like this:
In this case, BUS_B represents 16 bits, since PORTB is 16 bits wide on my device.
Now my question is, how do I define "BUS_B" such that it includes PORTB and another port concatenated together? So I want PORTB to represent the least significant bits of BUS_B, and lets say PORTF as the most significant bits of BUS_B with RF6 as the most significant bit of BUS_B. On my device PORTF is 7-bits wide, so I essentially want to declare BUS_B as a (7+16)-bit 'chunk' where PORTF and PORTB are concatenated together. So then when I want to output data to BUS_B, I just assign a 23-bit value to BUS_B, like so:
So I want the most significant bits of that 0x7FFFFF to be assigned to PORTF and the rest assigned to PORTB. So what do I assign to the right of "#define BUS_B" so that it does what I am asking? Hopefully I am clear in my meaning.
Ok so usually when I want to define a port pin as some name, I do it like this
Rich (BB code):
#define LED PORTCbits.RC0
Rich (BB code):
#define BUS_B PORTB
Now my question is, how do I define "BUS_B" such that it includes PORTB and another port concatenated together? So I want PORTB to represent the least significant bits of BUS_B, and lets say PORTF as the most significant bits of BUS_B with RF6 as the most significant bit of BUS_B. On my device PORTF is 7-bits wide, so I essentially want to declare BUS_B as a (7+16)-bit 'chunk' where PORTF and PORTB are concatenated together. So then when I want to output data to BUS_B, I just assign a 23-bit value to BUS_B, like so:
Rich (BB code):
BUS_B = 0x7FFFFF; //(23 bits of all 1's)