ColdFire 5212 Question using MetroWerks CodeWarrior

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

ColdFire 5212 Question using MetroWerks CodeWarrior

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

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