Capture Power Off Interrupt

2010-08-26
2010-08-28
  • RajeshGandhi - 2010-08-26

    Hello All,

    We are using CC Systems CCPXS target device, So could anyone have any idea that how we can capture the interrupt of power failure to the target device.

    Thanks and Regards,
    Rajesh G

     
  • ndzied1 - 2010-08-26

    If I understand you correctly, you want to trap the event that power is lost to the device.

    In general, you do this with what most people call a "first scan" bit or marker. The idea is that if you create a bit that is only true during the first scan, then it is only on right when the target is re-powered. By definition, if the power just came on, it must have been off

    Some targets will include a status bit or marker specifically for this reason but it is very easy to create one. In ST you could do this:

    VAR
    xFirstSCan :BOOL := TRUE; (* Initialize to True for 1st Scan *)
    END_VAR;
    IF xFirstSCan THEN
    Β  Β (* Put Startup Code Here *)
    Β  Β xFirstScan := FALSE;
    END_IF;
    
     
  • shooter - 2010-08-28

    is also a bit in the statuslist

     

Log in to post a comment.