Joined: 21 Jan 2009
Location: Simi Valley
|Posted: Tue May 22, 2012 9:08 am Post subject: DIO reading and writing on X6 boards using FPGA registers
|Using any of our example programs for the X6 boards you can read and write all or specific Dio bits individually or in groups by using the 'Debug'
tab during a run of the example application. There are edit boxes for 'Address' and 'Data' and buttons 'R' and 'W' to execute writing and reading of these registers.
The logic register addresses you need are:
0x500, lower order (0-31) data read/write
0x501 high order (32-63) data read/write
0x502 low order configuration (0xFFFFFFFF would make all 32 bits output,
0x0 would make all 32 bits input)
0x503 high order configuration (0xFFFFFFFF would make all 32 bits
output, 0x0 would make all 32 bits input)
For example, to make every other bit of 0-31, the odd bits as output, put into the address edit box 0x502 and into the data edit box 0xAAAAAAAA. Click the 'W' button to enter the information. (Clicking the 'R' button allows you can read back that register.)
Another example would be to make every other bit of 32-63, the even bits as output, put into the address edit box 0x503 and into the data edit box 0x55555555. Click the 'W' button to enter the information. Clicking the 'R' button you can read back that register.
Once you have configured the DIO registers the way you want, you can
enter data the same way, using the register addresses, 0x500 and 0x501.
The only caveat is that the write to 0x500 is the 'enable' for both high
and low order DIO.
Knowing this, you can physically loop any bits with proper wiring,
output to input and write data and read back data from the inputs.
This same activity, can be coded, in C++ for example. See attachment.