Michel Jamati

using PortA0-1 to drive external leds in the MC13213 Beekit

Discussion created by Michel Jamati on Mar 8, 2007
Latest reply on Mar 8, 2007 by Mike Ware
I'm currently using the Beekit MC13213 and trying to get my SRB (sensor reference board) to drive an external LED circuit. I'm trying to use portA0 here
 
Essentially, i start by calling the INITIATE_LED macro:
 
#define INITIATE_EXTLED  {PTADD |= 0x01; KBIPE &= 0xFE;}
 
which sets the PTADD direction to out, and then disables that ports' interrupt capability
 
then, whenever i generate a keyboard interrupt on the other pins (whenever a push button gets hit)
i do TOGGLE_EXTLED (self-explanatory):
 
#define EXT_LEDON   PTAD |= 0x01;
#define EXT_LEDOFF  PTAD &= 0xFE;
 
//using the above 2 functions, I either set or reset the port value
//to generate a high voltage value to drive the LED circuit
#define TOGGLE_EXT_LED  {if(PTAD&0xFE) EXT_LEDOFF else EXT_LEDON;}
 
but it doesn't work.
Does anyone have an idea why this isn't working?
 
thanks.

Outcomes