This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS1224: gioSetDirection use

Part Number: TMS570LS1224


On a previous question I was told to add gioSetDirection(gioPORTA,0xFE);  on my code to set GIOA[0] as an input and it worked perfectly.

But how do I configure more than one pin to be inputs?

Lets say I want to read GIOA[2]  and GIOA[3] as well (commented on code ahead). 

gioSetDirection(gioPORTA,0xFE);
gioSetBit(gioPORTA,1U,1);
A=gioGetBit(gioPORTA,0U);
//B=gioGetBit(gioPORTA,2U);
//C=gioGetBit(gioPORTA,3U);

  • gioSetDirecton() is defined in gio.c:

    The DIR register is described in TRM: section 25.5.11

    Bit 0 of GIODIR[A] is for GIOA[0], bit1 is for GIOA[1],...

    Writing 1 to a bit is to configure the corresponding pin as output, but writing 0 to a bit is to configure the pin as input.

    DIR[7:0] = 0xAA=b1010_1010 configures GIOA[0], GIOA[2], GIOA[4], and GIOA[6] as input, and GIOA[1], GIOA[3], GIOA[5] and GIOA[7] as output