Send 8 bits using the MKE15Z256

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Send 8 bits using the MKE15Z256

673 次查看
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,

标签 (1)
0 项奖励
回复
1 回复

608 次查看
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 项奖励
回复