Dora su

external sensor problem

Discussion created by Dora su on Sep 16, 2011
Latest reply on Sep 26, 2011 by kef



I can't solve this problem over 1 week. It make me headache.

I use MC9S12C32MFU25 chip. I get one problem about port P. Port P read when sensor detect the object , but it doesn't read when sensor doesn't detect the object. Any idea for that?



if (regEnDiFlag2 && regIntFlag2)     /* Is the device enabled and an interrupt flag is set? */
    PIFP_PIFP1 = 1;                              /* If yes then clear an interrupt flag */
if (regEnDiFlag2)
    if (regIntFlag2) {
I want to show LED3 when sensor detect the object, and LED1  when sensor doesn't detect the object.
void OP2_OnInterrupt(void)
    if(PIFP_PIFP1 = 1)
    doword commandid = LED3;
    doword commandid = LED1;
Please give me some idea.......