Hi Mark.
How I can define ports for In/Out? uTasker have any functions: fnConfigPort(..), fnConfigOutputPort(..), fnSetUserPortOut(..). What is the function that i need for ports defenition. I wrote at the same function (for configuration port QS) as your but don't know correctly or no?
#define PORTQS_IN_OUT_DEFINITION 0x7D; // X111.1101 where 1 = OUT, 0 = IN
PORTQS1 = 1
PORTQS2 = 0
PORTQS3 = 1
PORTQS4 = 1
PORTQS5 = 1
PORTQS6 = 1
PORTQS7 = 1
extern int fnConfigureMyPort()
{
CHAR cType;
CHAR cPortBit = '0';
u8 sPort = 0;
unsigned char ucBit = 1;
unsigned char ucUserOutputs = PORTQS_IN_OUT_DEFINITION;
while (sPort < '8')
{
cType = 'o';
if (!(ucUserOutputs & ucBit))
{
cType = 'i';
}
switch (cType)
{
case 'i': // port to be input
#ifdef _M5223X
DDRQS &= ~(1<<cPortBit); // set port bit to input
#endif
break;
case 'o': // Port to be output
#ifdef _M5223X
DDRQS |= (1<<cPortBit); // set port bit to output
#endif
break;
default:
return -1;
}
sPort++;
ucBit <<= 1;
}
return 0;
}
Thank.
Evgeni.