Thank you for your response.
I would like to get status of DI/DO. For example, I set DO as 1, I would like to get status of this DO, the value should be 1 as well. I know there are some bits in software, but I don’t know where it is.
Thank you for your response.
I would like to get status of DI/DO. For example, I set DO as 1, I would like to get status of this DO, the value should be 1 as well. I know there are some bits in software, but I don’t know where it is.
You should look at some of the Dynamic C samples and the function digIn:
digIn
SYNTAX: int digIn(int channel)
DESCRIPTION: Reads the state of any digital input channel.
This function is non-reentrant.
PARAMETER1: Input channel to be read, 0 - 11.
0 - 11 = channels DIN0 - DIN11.
RETURN VALUE: The logic state of the specified channel.
0 = Logic low.
1 = Logic High.
-EINVAL: channel value is out of range
-EPERM: channel functionality does not permit this operation
SEE ALSO: brdInit, setDigIn, digInBank
Please ignore the previous answer which gives information on digital inputs, not digital outputs.
The BL4S200 runs its digital i/o through three Rabbit RIO chips and you do not have direct access to read the state of the output.
There are only two functions, setDigOut which configures it as an output, and DigOut which sets the state of a configurable output. You can read the return code from this second function to see if the state was successfully set:
void digOut(int channel, int state);
FUNCTION DESCRIPTION
Sets the state of a configurable I/O channel configured as a sinking digital output
to a logic 0 or a logic 1. This function will only allow control of pins that are configured
by the setDigOut() function call to be a sinking digital output.
PARAMETERS
channel digital output channel, 0–31 (DIO0–DIO31).
state set output to one of the following states:
0 — connects the load to GND
1 — puts the output in a high-impedance tristate.
RETURN VALUE
0 — success.
-EINVAL — invalid parameter value.
-EPERM — pin function was not set up as a digital output
Hello, There is an example application DIGIN.C at the Dynamic C installation path below, pls check it may helpful
C:\DCRABBIT_10.72\Samples\BLxS2xx\DIO
The original question was:
I would like to get status of DI/DO
Correct me if I am wrong
DI = Digital Inputs
DO = Digital Outputs.
My answer for getting the status of Digital Inputs was correct.
This person is asking:
I set DO as 1, I would like to get status of this DO
That is to do with digital outputs. He is stating that he is setting a digital output to 1. He wants to know how he can verify that by reading the output.
If this was not an SBC and we were just accessing parallel ports you can use BitRdPortI() to directly read an output. You cannot do that with the SBC.