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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

1,073 Views
McGillMike
Contributor I
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.
Labels (1)
0 Kudos
1 Reply

255 Views
Ware
Contributor III
Your toggle function needs some work...  it should be either:
 
#define TOGGLE_EXT_LED  {if(PTAD&0x01) EXT_LEDOFF else EXT_LEDON;}
 
OR:
 
#define TOGGLE_EXT_LED  PTAD ^= 0x01;
 
 
- Ware

 
0 Kudos