Yet again you had me scratching my head.

"state" is a name used internally by comp, so you get weird compile
errors when you also use it for a parameter name.  I changed the
name to "state_" through the whole file, and also fixed a few other
typos.  You can find my "corrected" version below.

Jeff


component turret "This component controls the turret hardware for Kirk 
Wallace's Hardinge HNC turret. It moves the turret to the last T word value 
entered. (Invoked by M6)";
pin in bit tool_change "A .hal file should connect this to 
iocontrol.X.tool-change.";
pin in bit match "A .hal file should connect this to s32equal.X.out which 
should be the result of a check for a match between the requested and current 
tool.";
pin out bit tool_changed "A .hal file should connect this to 
iocontrol.X.tool-changed to indicate to EMC when the position change is 
complete.";
pin out bit seek "Connect this pin via .hal file to the turret rotate solenoid 
signal.";
pin out bit stop "Connect this pin via .hal file to the turret stop solenoid 
signal.";
param rw s32 state_ "This parameter holds the value of the current state of the 
turret change process; idle, seeking, stopping, parking.";
param rw s32 settle "This parameter holds the initial value and then the count 
down of servo periods to allow settling of the turret mechanism before invoking 
next state proceedure.";
param r s32 stop_settle "This is the initial settle time in servo periods 
between activating the stop solenoid and when the turret comes to rest.";
param r s32 park_settle "This is the initial settle time in servo periods 
between deactivating the turret rotate solenoid and when the turret descends to 
the park position.";
function _ nofp;
;;
MODULE_LICENSE("GPL");
FUNCTION(_) {
    if (tool_change) {
        if (!match) {
            switch (state_) {
            case 1:
                seek=1;
                state_=2;
                break;
            case 2:
                if (match) {
                    stop=1;
                    settle=stop_settle;
                    state_=3;
                }
                break;
            case 3:
                --settle;
                if (settle<=0) {
                    seek=0;
                    settle=park_settle;
                    state_=4;
                }
                break;
            case 4:
                --settle;
                if (settle<=0) {
                    stop=0;
                    state_=1;
                    tool_changed=1;
                }
                break;
            default:
                state_=1;
                break;
            }
        }
    }
}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to