Sending parsed bits on STM32
Discussion in "Project Help" started by Amit Kumar Das Jun 29, 2015.
Mon Jun 29 2015, 11:33 pm
Suppose the ILI9320 TFT LSB & MSB pins are connected to Port B & Port C respectively. In that case the code will be :-
GPIOB->ODR=((GPIOB->ODR&0x00ff)|(data<<8));
GPIOC->ODR=((GPIOC->ODR&0xff00)|(data>>8));
Suppose in case of different connection like :-
PD14 - DB0, PD15 - DB1, PD0 - DB2, PD1 - DB3, PE7 - DB4, PE8 - DB5,
PE9 - DB6, PE10 - DB7, PE11 - DB8, PE12 - DB9, PE13 - DB10, PE14 - DB11,
PE15 - DB12, PD8 - DB13, PD9 - DB14, PD10 - DB15
In such case how the above coded statements has to be modified ?
GPIOB->ODR=((GPIOB->ODR&0x00ff)|(data<<8));
GPIOC->ODR=((GPIOC->ODR&0xff00)|(data>>8));
Suppose in case of different connection like :-
PD14 - DB0, PD15 - DB1, PD0 - DB2, PD1 - DB3, PE7 - DB4, PE8 - DB5,
PE9 - DB6, PE10 - DB7, PE11 - DB8, PE12 - DB9, PE13 - DB10, PE14 - DB11,
PE15 - DB12, PD8 - DB13, PD9 - DB14, PD10 - DB15
In such case how the above coded statements has to be modified ?
[ Edited Mon Jun 29 2015, 11:35 pm ]
Mon Jul 13 2015, 03:23 pm
There is no right to way to handle such hardware interfacing. You need to write your own glue logic to handle data bits and fit them in right place on the port pins. Best way could be to map data bit vs pin position array and run a loop on the data bit. so even if there is change in the design you just need to update the pin<->data mapping.
Powered by e107 Forum System