Understanding the digital IO functions for the USB-1208LS and USB-1208FS

Last Modified: 11th Jul 2014
Category: Data Acquisition > Measurement Computing
Platform: All
Version: All
Article Ref.: 13CFA
»Return to previous search
»Print friendly version of this article.
1 person has found this article useful.

USB 13CFA The USB-1208FS and USB-1208LS support two types of function for Digital Input\Output. 1) Port Functions The digital functions that write, read or configure ports (groups of 4 or 8 bits) are cbDOut, cbDIn and cbDConfigPort. In the arguments to these functions, the 8255 chip is divided into two 8 bit ports as follows: FIRSTPORTA (A0-A7) corresponds to pins 21-28 FIRSTPORTB (B0-B7) corresponds to pins 32-39 FIRSTPORTA is a group of 8 digital bits. The DOut function takes an 8 bit binary number (converted to decimal) which sets the states of these bits. For example, to set all 8 bits in the port FIRSTPORTA high, you could call DOut once, with the value 255 (11111111 in binary.) Another example of using DOut, if you wanted to write the following values to FIRSTPORTA: Ch0 High Ch1 Low Ch2 High Ch3 Low Ch4 High Ch5 Low Ch6 High Ch7 Low You can express this as the binary number "10101010." Converted to decimal this is 170. Therefore the DataValue to DOut would be 170. 2) Bit Functions If you want to access the digital channels one by one, use the function "cbDBitOut" instead of "cbDOut", and the function "cbDBitIn" instead of "cbDIn". This writes to individual bits For digital functions that deal with individual bits (cbDBitOut and cbDBitIn), the 8255 chip is treated as one 16 bit port called FIRSTPORTA. 3) Configuring the Digital Channels as Input or Output It is necessary to run cbDConfigPort to configure the direction of each of the ports, the 8 bit FIRSTPORTA and FIRSTPORTB. You have to use this function even if you then use the bitwise functions (cbDBitOut and cbDBitIn.) How Do I? MeasurementComputing All All en All

If you can't find a solution on the Knowledge Base then please contact us on the Technical Support Request Form or by email or by telephone on +44 (0) 203 695 7810

For the time being we are unable to offer the following product ranges although we are currently working hard to increase the number of products we can offer in the future. Please contact us to talk about alternative products that we may be able to offer you.