Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

USB-IO adapter: How to set output values

Status
Not open for further replies.

maliwan

New Member
Hey friends!

I recently bought a USB-IO adapter. It is GPIO-24, produced by Diolan.

I'm interested to know how to set output values for the pins.

The adapter has **broken link removed** which, as I believe, sets output values for specified pins. I send this command with all necessary configuration settings.

Then I send **broken link removed** which returns the pin settings, specified by the former command. That’s ok.

HOWEVER, there is another command – **broken link removed** which returns, among other things, the values on the pins.

The problem is as follows: GPIO_GET_OUT_VAL and GPIO_GET_VAL commands sometimes return different values for the same pins!!!

How can it be explained???

The device datasheet is visible here: USB-IO Interface Adapter - GPIO-24

thnx
 
My guess would be that one returns what you asked the pins to be and the second returns what they actually are. You may tell it to set a pin high but if it's connected to gnd then it will still read back low.

Mike.
 
Hi maliwan,
I use this adapter for fan speed control and monitoring. Are you sure that in Byte 3: MASK **broken link removed** you have specified the correct mask? Each bit of this byte corresponds to a specified pin (e.g. bit 0 – to pin 0, bit 1 to pin 1, etc.). Set the corresponding bits/pins to 1, to apply the output values :)
 
My guess would be that one returns what you asked the pins to be and the second returns what they actually are. You may tell it to set a pin high but if it's connected to gnd then it will still read back low.

Mike.

Hi Mike

I must admit that I don't quite understand you.

If I ask the pin to be high, it is actually high.

Why do the commands return different values?
 
Hi maliwan,
I use this adapter for fan speed control and monitoring. Are you sure that in Byte 3: MASK **broken link removed** you have specified the correct mask? Each bit of this byte corresponds to a specified pin (e.g. bit 0 – to pin 0, bit 1 to pin 1, etc.). Set the corresponding bits/pins to 1, to apply the output values :)

No, the problem isn’t about the mask byte.

I’ve checked it several times.

I’m sure that I haven’t mistaken setting the bit mask.
 
Maliwan, if the mask is OK, then Mike is right:
My guess would be that one returns what you asked the pins to be and the second returns what they actually are.
See the difference between gpio_get_val and gpio_get_out_val commands. GPIO_GET_VAL command returns current values on the pins and GPIO_GET_OUT_VAL command returns output values. Make sure that the pins are outputs when you set the output values for them. If the pins are not configured as outputs, the output values are not applied. They are stored in the embedded memory and would be applied only after the pin is an output.
Is it clear?
 
Status
Not open for further replies.

Latest threads

Back
Top