Version 10 (modified by 15 years ago) ( diff ) | ,
---|
Table of Contents
DIO
The 825 main board is equipped with four digital input and four digital output ports. DIO option cards may be used for additional I/O options. Option cards contain eight ports which may be used as a combination of inputs and outputs.
Digital I/O
The console command prompt may be used for simple DIO testing.
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.
Response | Input 1 | Input 2 | Input 3 | Input 4 |
0 | Off | Off | Off | Off |
1 | On | Off | Off | Off |
2 | Off | On | Off | Off |
3 | On | On | Off | Off |
4 | Off | Off | On | Off |
5 | On | Off | On | Off |
6 | Off | On | On | Off |
7 | On | On | On | Off |
8 | Off | Off | Off | On |
9 | On | Off | Off | On |
A | Off | On | Off | On |
B | On | On | Off | On |
C | Off | Off | On | On |
D | On | Off | On | On |
E | Off | On | On | On |
F | On | On | On | On |
For additional structure formats refer to MainboardProtocol
The lib825 library provides functions to facilitate applications performing digital I/O tasks.
To perform these tests with DIO option cards replace /dev/mnbd with /dev/wt1 (for the first DIO option card), /dev/wt2 (for the second installed DIO option card), etc...
The following example shows program code to read and set DIO ports.
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.
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.