ColdFire 5212 Question using MetroWerks CodeWarrior

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

ColdFire 5212 Question using MetroWerks CodeWarrior

1,827 次查看
JimMcP
Contributor I
I want to raise and lower the GPT3,GPT2,GPT1,GPT0 pins (individually) on the ColdFire 5212 Micro. Using their core header file for General Purpose I/O.

I set these pins as General Purpose I/O as Outputs. This is Port TA on the Micro.

// Set as outputs
MCF_GPIO_DDRTA = MCF_GPIO_DDRTA_DDRTA3 |
MCF_GPIO_DDRTA_DDRTA2 |
MCF_GPIO_DDRTA_DDRTA1 |
MCF_GPIO_DDRTA_DDRTA0;

MCF_GPIO_PTAPAR = 0;

How to set it and to clear these pins

MCF_GPIO_PORTTA = ?

I want to be able to control these pins. I am a newbie to this micro. Can anybody help me on this.

Thanks,
标签 (1)
标记 (1)
0 项奖励
回复
1 回复

396 次查看
Nouchi
Senior Contributor II
Hi,


If you want to set one or several pin, you have to do this:
MCF_GPIO_PORTTA = portValue;
or using Port pin data/Set dataregister:
MCF_GPIO_SETTA = MCF_GPIO_PORTTA_PORTTA2; // port set register
// Cf doc chap 11.6.3
to clear use:
MCF_GPIO_CLRTA = ~MCF_GPIO_PORTTA_PORTTA2; // port clear register
// Cf doc chap 11.6.4
if you want to read the real pin state use:
uint8 yourVar;
yourVar = MCF_GPIO_SETTA; // chap 11.6.3

Don't forget to set the Data Direction Degister (chap 11.6.2)


Emmanuel
0 项奖励
回复