Read Inputs/Outputs are Zero - Important

This is the English forum for all topics related to IO-Warrior. Please post in English only

Moderator: Guido Körber

Post Reply
venukumargl
Posts: 3
Joined: Tue May 08, 2012 12:58 am

Read Inputs/Outputs are Zero - Important

Post by venukumargl »

Hi,
I am using IO Warrior 56 for one of my application. This is used as an I/O expansion card. I configure these ports in the IO warrior as Inputs and Outputs.

When i use these ports as inputs, i write '1' and the ports which i use as Outputs, i write '0'. When i open the Device, i write the respective bits to outputs such that i could read the bits set by my application without masking.

Example:

public override void Open()
{
base.Open();

// We need to set the pins used as inputs to 1 to enable us to read the state of the inputs.
byte[] outputs = base.ReadOutputs();
outputs[0] |= 0xFF;
outputs[1] |= 0xFF;
outputs[2] |= 0x00;//These are outputs
outputs[3] |= 0x00;//These are outputs
outputs[4] |= 0xF0;//LSB 4 bits are outputs and rest are inputs
outputs[5] |= 0xFF;
outputs[6] |= 0xFF;

base.SetOutputs(outputs);
}
Once in a hundred times, when i open the above function, i read all 7 bytes as Zero or sometimes different combination of bytes becomes zero. Due to this behaviour, my drive(Which is connected to IO Warrior 56) is getting switch OFF and tests will not run until the drive is ON.I could able to access the IO expansion board with out any problem.

May i know the reason why the outputs will be all zero's ?

Operating Systems : Win Xp and Win 7.

Please let me know if further information is required!

Appreciate your help !!

Venu
Guido Körber
Site Admin
Posts: 2856
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Re: Read Inputs/Outputs are Zero - Important

Post by Guido Körber »

If I understand this correct you are sometimes getting wrong data packets upon opneing the deivce?

Possibly you should use the flush function prior to writing your output data. There can be old reports in the queue.
venukumargl
Posts: 3
Joined: Tue May 08, 2012 12:58 am

Re: Read Inputs/Outputs are Zero - Important

Post by venukumargl »

Hi Guido,
Thanks for the reply ! As you mentioned, i added "HidD_FlushQueue(handle0);" this function before i read the inputs and write. Is this the correct function you were referring to ?

After adding this function, i ran all my tests overninght and could still see the problem while opening the device.I am not sure why i get all port bits are zero when read the inputs.

The IO-Warrior56 arranged into 7 banks of 8 bits. Banks 0, 1, 5, 6 and half of 4 are wired as inputs so we write 1 as the comment says. '|='[OR] in this case because this will not change the state of the output pins when you connect to the drive. Since i read all Zero's in the inputs, Drive control bit getting set and switching OFF. Do you have any suggestion for configuring these IO?

Please let me know if you need further more information,

Thanks
Venu
Guido Körber
Site Admin
Posts: 2856
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Re: Read Inputs/Outputs are Zero - Important

Post by Guido Körber »

Can you send the relevant code snippet via email to: support at codemercs dot com?

I think this might be easier to figure out if one of our programmers can take a look at the code.
venukumargl
Posts: 3
Joined: Tue May 08, 2012 12:58 am

Re: Read Inputs/Outputs are Zero - Important

Post by venukumargl »

I have sent a code snippet through mail, Please do the needful.
Post Reply