Tom Moulton

MCF52233DEMO Inputs

Discussion created by Tom Moulton on Dec 4, 2007
Latest reply on Dec 5, 2007 by Tom Moulton
This is so silly it is nuts.

I want to use the GPT0 as an input (which is the Default) and I can't seem to get it working.

Here is some code that *should* echo the state of GPT0-3 on  TIN0-3 (w/LEDs on the DEMO board)

Code:
#include <stdio.h>#include "common.h"#include "m52233DEMO.h"int main() {    MCF_GPIO_DDRTA = 0; // Inputs    MCF_GPIO_PTAPAR = 0; // GPIO Pins    MCF_GPIO_PTCPAR = 0; // GPIO Pins    MCF_GPIO_DDRTC = 0x0F; // Outputs    MCF_GPIO_PORTTC = 0; // Turn LEDs off    while (1) {        uint8 ta, tc;        ta = MCF_GPIO_PORTTA;        tc = 0;        if (ta&1) tc |= 1;        if (ta&2) tc |= 2;        if (ta&4) tc |= 4;        if (ta&8) tc |= 8;        MCF_GPIO_PORTTC = tc;    }}

 

Outcomes