Send 8 bits using the MKE15Z256

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Send 8 bits using the MKE15Z256

2,177件の閲覧回数
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 返信

2,112件の閲覧回数
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 件の賞賛
返信