wiki:Docs/Prog/Manual/DeviceSupport/DIO

Version 7 (modified by Don Wilson, 15 years ago) ( diff )

--

DIO

Digital I/O

echo “L000000020000000F” > /dev/mnbd

This sets the state of the mainboard digital outputs. The “L” is the command, the following 8 characters or four hexadecimal bytes represent the state desired. The final 8 characters or four hexadecimal bytes represent a mask of which outputs are to be affected. In this example “F” is used as the mask to set the state of all four on-board outputs.

# echo “I” > /dev/mnbd

This requests the status of the mainboard digital I/O.

# cat < /dev/mnbd

response:

# IA000000000

The last 8 character of the response are hexadecimal digits. Of these the first 4 digits are the state of the digital inputs. The final 4 digits are the state of the outputs. If the input 1 only is active the response is:

# IA000010000

If inputs one and two are active the response is:

# IA000030000

If inputs one, two, three, and four are active the response is:

# IA0000F0000

Only a single hexadecimal digit is needed to represent the state of the four mainboard inputs.

ResponseInput 1Input 2Input 3Input 4
0OffOffOffOff
1OnOffOffOff
2OffOnOffOff
3OnOnOffOff
4OffOffOnOff
5OnOffOnOff
6OffOnOnOff
7OnOnOnOff
8OffOffOffOn
9OnOffOffOn
AOffOnOffOn
BOnOnOffOn
COffOffOnOn
DOnOffOnOn
EOffOnOnOn
FOnOnOnOn

For additional structure formats refer to MainboardProtocol

The lib825 library provides functions to facilitate applications performing digital I/O tasks.

Error: Failed to load processor Lineno
No macro or processor named 'Lineno' found

For digital I/O event operations refer to the DioEvent class.

DIO Events

About

This document will guide the programmer through the process of creating and using a simple DIO Event using the DioEvent class provided in the standard library (lib825). DIO Events are processed by the mainboard in order to allow a level of redundancy. Should the OPI board kernel crash the mainboard will continue to provide relay functionality and will disable events when their thresholds are reached.

The Code

To use a DIO event follow the example code below.

Error: Failed to load processor Lineno
No macro or processor named 'Lineno' found

The above code would create an event that would enable board 0 (mainboard) pin 0 when the gross weight of scale 1 is less than 250.00 and greater than 0.00.

DIO Counting

Description

Mainboard software 1.15 is required for counting feature. Kernel 2009-10-07 or later is required. All four inputs of the mainboard may be used for counting. The DIO cards allow any one of inputs 1 - 7 to be used for counting. Input 8 may also be used for counting. This allows for up to two inputs per DIO card to be used for counting.

Example

Error: Failed to load processor Lineno
No macro or processor named 'Lineno' found
Note: See TracWiki for help on using the wiki.