Gentlemen,
  This is our thoughts on latch component. Please critique it and let
me know what changes should be made.
thanks
Stuart


---------- Forwarded message ----------
From: jphillip <[EMAIL PROTECTED]>
Date: Apr 18, 2007 3:28 PM
Subject: latching push button
To: [EMAIL PROTECTED]





/* do not use the comp pre-processor on this component */
/* pin-in must be de-bounced */

component latching-push-button "Software alternate action switch"

pin in  pin-in bit ;
pin out pin-out bit ;
option  latch bit ;
option  on-off bit ;

if( pin-in == true ) {          /* button is pressed */
 if ( latch == false ) {       /* button  was previously released */
    latch = true ;
    if( on-off == true )       /* output is currently on */
       on-off = false ;        /* turn output off */
    if( on-off == false )      /* output is currently off */
       on-off = true ;         /* turn output on */
 }
} else  {
  latch = false ;
}
pin-out = on-off ;

You have to be BRAVE to grow OLD.
There are no old CARELESS pilots or electricians.

/* do not use the comp pre-processor on this component */
/* pin-in must be de-bounced */

component latching-push-button "Software alternate action switch"

pin in  pin-in bit ;
pin out pin-out bit ;
option  latch bit ;
option  on-off bit ;

if( pin-in == true ) {          /* button is pressed */
  if ( latch == false ) {       /* button  was previously released */
     latch = true ;             
     if( on-off == true )       /* output is currently on */
        on-off = false ;        /* turn output off */
     if( on-off == false )      /* output is currently off */
        on-off = true ;         /* turn output on */
  }
} else  { 
   latch = false ;
}
pin-out = on-off ;
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to