Bugfix for Ai on port B. If Ai and Di/Do were mixed the Ai didn't work

parent fc903de0
......@@ -4,3 +4,4 @@
080229 rk modbus New I/O-system for Modbus TCP implemented.
081016 rk modbus Added class Modbus_Master.
081016 rk modbus Added moore functionality.
090301 cs usbio Bugfix for Ai on port B. If Ai and Di/Do were mixed the Ai didn't work.
......@@ -143,6 +143,13 @@ static pwr_tStatus IoCardInit( io_tCtx ctx,
io_AiRangeToCoef( &cp->chanlist[i]);
}
}
if ( local->portB_hasDi || local->portB_hasDo) {
op->Status = USBIO_ConfigDIO( &local->USB_Handle, 2, local->portB_diMask);
if ( op->Status)
errh_Error( "IO Init Card '%s', Status %d", cp->Name, op->Status);
}
if ( local->portB_hasAi) {
int num_ai;
for ( i = 0; i < 8; i++) {
......@@ -156,12 +163,6 @@ static pwr_tStatus IoCardInit( io_tCtx ctx,
else
op->Status = USBIO_ConfigAI( &local->USB_Handle, 0);
if ( local->portB_hasDi || local->portB_hasDo) {
op->Status = USBIO_ConfigDIO( &local->USB_Handle, 2, local->portB_diMask);
if ( op->Status)
errh_Error( "IO Init Card '%s', Status %d", cp->Name, op->Status);
}
/* Configure port C */
local->portC_hasDi = 0;
local->portC_hasDo = 0;
......@@ -196,6 +197,12 @@ static pwr_tStatus IoCardInit( io_tCtx ctx,
cp->chanlist[18].ChanClass == pwr_cClass_ChanIi)
local->portC_hasIi = 1;
if ( local->portC_hasDi || local->portC_hasDo) {
op->Status = USBIO_ConfigDIO( &local->USB_Handle, 3, local->portC_diMask);
if ( op->Status)
errh_Error( "IO Init Card '%s', Status %d", cp->Name, op->Status);
}
if ( local->portC_hasAo) {
op->Status = USBIO_ConfigAO( &local->USB_Handle, local->portC_aoMask >> 3);
if ( op->Status)
......@@ -210,12 +217,6 @@ static pwr_tStatus IoCardInit( io_tCtx ctx,
errh_Error( "IO Init Card '%s', Status %d", cp->Name, op->Status);
}
if ( local->portC_hasDi || local->portC_hasDo) {
op->Status = USBIO_ConfigDIO( &local->USB_Handle, 3, local->portC_diMask);
if ( op->Status)
errh_Error( "IO Init Card '%s', Status %d", cp->Name, op->Status);
}
// Configure Watchdog
if ( op->WatchdogTime > 0)
active = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment