Sample Programs
Each of the sample programs even_parity.c and xor.c demonstrate simple use of digital I/O. The source code for these files is available in the samples directory of the SDK, /opt/samples.
xor.c performs the XOR logic function on 3 inputs. The XOR is performed on the first two inputs and the result output to the first output. The result of the second and third input XOR are sent to the second output.
even_parity.c is a program that will do even parity on 8 input pins, and the result is sent to 1 output pin. Thus, if there is an even number of ‘1’ inputs, then the output will be ‘0’. Conversely, if there is an odd number of ‘1’ inputs, the output will be ‘1’.
xor.c
in0 | in1 | in2 | out0 | out1 |
even.c
in0 | in1 | in2 | in3 | in4 | in5 | in6 | in7 | out0 |
Even Parity
www.amctechcorp.com71