ADC-24 SDK: Get Single Digital Value

Post any questions you may have about our current range of USB data loggers
Post Reply
liber
User
User
Posts: 7
Joined: Sat Feb 26, 2005 5:53 pm

ADC-24 SDK: Get Single Digital Value

Post by liber »

Hi, I have a question about the ADC SDK:

I've been able to successfully read analog inputs using HRDLGetSingleValue. In addition to this, I need to be able to set some digital lines as outputs and some as inputs and then read digital inputs in single-shot (nonbuffered) mode.

I've been able to set digital outputs using HRDLSetDigitalIOChannel, but I cannot figure out what API call to use for non-buffered (!) reading of digital inputs. Is there a way to do it?

Thanks!

liber
User
User
Posts: 7
Joined: Sat Feb 26, 2005 5:53 pm

Re: ADC-24 SDK: Get Single Digital Value

Post by liber »

Never mind, I figured it out. It looks like the same HRDLGetSingleValue can be used to read the digital port as channel 0. I wish the documentation for the SDK were more explicit about it. Thanks!

liber
User
User
Posts: 7
Joined: Sat Feb 26, 2005 5:53 pm

Re: ADC-24 SDK: Get Single Digital Value

Post by liber »

Four years later, still more questions on reading digital inputs.

I have two ADC24 units; for each unit, I am setting up my DIO lines by calling HRDLSetDigitalIOChannel with the following binary parameters:

dirOut = 0101
digOutPinState = 0101
enableDigIn = 0010

One unit has its digital input D2 (bit 1 counting from zero) pulled high, the other has D2 pulled low.

When I read the states of DIO lines using HRDLGetSingleValue with "channel" parameter set to zero and interpret "value" output as a byte, for first unit I get 00000111 and for the second unit I get 10110101. Bit 1 of each byte seems to make sense (one is high, the other low), but I'd like to know what the other bits stand for. With that said, I have several questions:

(1) My guess is that the four LSB's reflect the state of corresponding digital lines, regardless of whether they are configured as inputs or outputs - can someone confirm it?

(2) What is the meaning of the four MSB's? And why are they different for the two units that are configured identically?

(3) Calling HRDLGetSingleValue with channel parameter 0 seems to work, but it's an undocumented call. Can Picotech confirm that it's a legit call? If not, how can I read just the state of DIO lines, without reading analog inputs?

Thanks!

Post Reply