Send 8 bits using the MKE15Z256

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Send 8 bits using the MKE15Z256

596 Views
m_giraldi
Contributor II

I am doing a project and need to send 8 bits through ports PTC10 ~ PTC17, but ports PTC0 ~ PTC9 are being used for other purposes.

Can I do it as follows? (In the attached file is better explained)

void TFT_CMD (int8_t command)

{

uint32_t tmp;

tmp = GPIOC->PDOR & 0xFFFFFF00;

GPIOC->PDOR = tmp | command;

}

Thanks,

Labels (1)
0 Kudos
1 Reply

531 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Marcel,

If you need to use the pins from PTC10 to PTC17 you will need to do a shift to the command. Also it will be better to use the PSOR and PCOR register to set/clear the pin logic state. Also the mask will need to change to match the pins.

Here's an example with the changes:

void TFT_CMD (int8_t command)

{

            command = command << 10;

uint32_t tmp;

tmp = GPIOC->PDOR & 0xFFFC03FF‬;

GPIOC->PDOR = tmp | command;

}

If you want to use the SDK functions, you can use the GPIO_PortSet but considering all the pins you want to set, for example:

GPIO_PortSet(GPIOC, command << 10)

Let me know if this helps you.

Best Regards,

Alexis Andalon

0 Kudos