I'm having trouble with an implementation of defines for reading a port pin. The code is below.
When I attempt to compile this I get an error as follows.
../main_ATmega644P.c:287:1: error: 'TACTiSTAT' undeclared (first use in this function)
Does anyone know how to index those defines with the for loop? I would try another method if there is one, but I can't find one.
Thank you for any help!
Rich (BB code):
#define TACT0STAT (PINB & 0x01) //Tact1 Status
#define TACT1STAT (PINB & 0x02) //Tact2 Status
#define TACT2STAT (PINB & 0x04) //Tact3 Status
#define TACT3STAT (PINB & 0x08) //Tact4 Status
#define TACT4STAT (PINC & 0x40) //Tact5 Status
#define TACT5STAT (PINC & 0x80) //Tact6 Status
#define TACT6STAT 0x00 //Dummy Status
#define TACT7STAT 0x00 //Dummy Status
#define TACTSTAT(a) TACT##a##STAT
for(int i = 0; i < 8; i++)
{
if(TACTSTAT(i))
{
//
}
}
../main_ATmega644P.c:287:1: error: 'TACTiSTAT' undeclared (first use in this function)
Does anyone know how to index those defines with the for loop? I would try another method if there is one, but I can't find one.
Thank you for any help!
Last edited by a moderator: