Page 1 of 1

GPIO and Timers with MOD5270

Posted: Fri Jun 18, 2010 1:26 pm
by caburfoot
Well, this is my first clocked input and I'm asking for a little guidance amid the confusion.

I've found documents (Mod5270 GPIO Configuration) that indicate there is 1 dual use 16 bit IO set.
DATAL and DATAH.

We need two 8 bit inputs with two different clocks.

So this should setup the GPIO

Code: Select all

#include "sim.h"
#include "gpio5270.h"

void UserMain( ... ) {

    unsigned char datal =0, datah = 0;
    int bcontinue = 1;

        // Data Pin Assignment Register. Set all sixteen pins as GPIO.
    sim.gpio.par_ad &= ~GPIO_PAR_DATA;

        // Data Port Data Direction Register. Set signals PDATAL0 and PDATAH8
        // as GPIO inputs.
    sim.gpio.pddr_datal = 0;
    sim.gpio.pddr_datah = 0;

        // DMA Timer Pin Assignment Register. Set the three DMA timer output
        // signals as GPIO.
    sim.gpio.par_timer &= ~( GPIO_PAR_DTOUT1 | GPIO_PAR_DTOUT3 );

        // DMA Timer Port Data Direction Register. Set the three DMA timer
        // output signals as GPIO outputs.
    sim.gpio.pddr_timer |= ( GPIO_PIN_DTOUT1 |  GPIO_PIN_DTOUT3 );

    while ( bcontinue ) {
        // Set a timer pin high

        sim.gpio.podr_timer |= ( GPIO_PIN_DTOUT1 | GPIO_PIN_DTOUT3 );

        // Data Port Output Data Register. Set GPIO signal PDATAL0 low and
        // PDATAH8 high.
        datal = sim.gpio.podr_datal;
        datah = sim.gpio.podr_datah;

        sim.gpio.podr_timer &= ~( GPIO_PIN_DTOUT1 | GPIO_PIN_DTOUT3 );
   }



This is intended to ask for help/guidance using this.
If you can provide guidance, it would be a big help.

TIA
Chuck