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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

1,635件の閲覧回数
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.
ラベル(1)
0 件の賞賛
返信
1 返信

817件の閲覧回数
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 件の賞賛
返信