ColdFire 5212 Question using MetroWerks CodeWarrior

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

ColdFire 5212 Question using MetroWerks CodeWarrior

1,828 Views
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,
Labels (1)
0 Kudos
Reply
1 Reply

397 Views
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 Kudos
Reply