12-18 Chapter 12: Cash Drawer Interface
{
case ( STATE_RELEASE ):
// activate solenoid (open cash drawer)
// bit = 1 activates solenoid, = 0 de-activates
// Set the solenoid bit ON to energize, leave other bits alone
oBytes = oBytes | bMask;
// driving circuit arming bit,LOW for arming
oBytes = oBytes & CD7402ARM_ON;
result = WriteIOPort( oBytes, m_nIOPort );
sState = _T("STATE_RELEASE");
break;
case ( STATE_IDLE ):
// deactivate solenoid
oBytes = oBytes & (~bMask); // Set the solenoid bit OFF to de-
energize, leave other bits alone
oBytes = oBytes | CD7402ARM_OFF;
sState = _T("STATE_IDLE");
// write new solenoid bit
result = WriteIOPort( oBytes, m_nIOPort );
sBytes = sBytes | CD7402SELECT_GPI; // set solenoid bits and status
bit as inputs
// write new select with solenoid bits enabled as Inputs.
WriteIOPort( sBytes, m_nIOPort_select );
break;
default:
// Set the INVALID state configuration.
return FALSE;
}
}
else // Error logged in ReadIOPort
result = FALSE;
} //result
return result;
}
//////////////////////////////////////////////////////////////////////////////
// CDeviceDarlington::QueryConf -
/*Configuration mechanism one utilizes two 32bit I/O ports located at addresses
0x0CF8 and 0x0CFC.
These two ports are: