AtomSoft
Well-Known Member
Ok im porting some ARM code from one ARM to another ....
The issue lies in the PINOUT. I have a 16bit value i need to place on 3 different ports. For example the INT 0x1234 needs to be split into 3 parts...
INT A = 1
INT B = 2 & 3
INT C = 4
To do this im am trying the below code"
Ok GPIOC is the first PORT i need the data in... from bits 6:9
SO....
GPIOC [6:9] = BITS 0:3 of INT (since starts at bit 6 i shift it over after i get the bits)
GPIOD [0:7] = BITS 4:11 of INT
GPIOC [0:3] = BITS 12:15 of INT
Am i wrong? Its not working
The issue lies in the PINOUT. I have a 16bit value i need to place on 3 different ports. For example the INT 0x1234 needs to be split into 3 parts...
INT A = 1
INT B = 2 & 3
INT C = 4
To do this im am trying the below code"
Code:
void SetLcdInt(int data)
{
int DAT_A = (data & 0x000F);
int DAT_B = ((data>>4) & 0x00FF);
int DAT_C = ((data>>12) & 0x000F);
GPIOC->ODR &= ~(0x3C0);
GPIOD->ODR &= ~(0xFF);
GPIOE->ODR &= ~(0x0F);
GPIOC->ODR |= (DAT_A<<6);
GPIOD->ODR |= (DAT_B);
GPIOE->ODR |= (DAT_C);
}
Ok GPIOC is the first PORT i need the data in... from bits 6:9
SO....
GPIOC [6:9] = BITS 0:3 of INT (since starts at bit 6 i shift it over after i get the bits)
GPIOD [0:7] = BITS 4:11 of INT
GPIOC [0:3] = BITS 12:15 of INT
Am i wrong? Its not working