Home  >  Support  >  Support Forum  >  bl4s200 digital output status
Notice! We've recently migrated to using a new forum, we hope you enjoy it. If you are an existing member and this is your first time visiting our new forum, please reset your password to be able to sign in.
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

bl4s200 digital output status

0 votes
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.
related to an answer for: bl4s200 mounting hole
asked Aug 12 in Rabbit Software by yang New to the Community (0 points)

Please log in or register to answer this question.

5 Answers

0 votes
You should look at some of the Dynamic C samples and the function digIn:
digIn <BL4S1xx.LIB>

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
answered Aug 12 by MargaretK Veteran of the Digi Community (472 points)
0 votes
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
answered Aug 13 by trooper2 Veteran of the Digi Community (427 points)
0 votes
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
answered Aug 13 by cpigilam Veteran of the Digi Community (497 points)
0 votes
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.
answered Aug 13 by MargaretK Veteran of the Digi Community (472 points)
0 votes
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.
answered Aug 15 by trooper2 Veteran of the Digi Community (427 points)
Contact a Digi expert and get started today! CONTACT US
...