Writing and Reading to the DIO Port on USB-8451 Hardware: Industrial Communications>>CAN>>USB-CAN
Problem: I would like to read and write to the DIO port on the USB-8451 but right now I can only read or write to one DIO line at a time. How do I read and write to the entire port? Solution: This can be done by using the NI-845X Property node. ![]() The Active DIO Port property sets the active DIO port for further DIO port configuration. The format for this property is a decimal string. For example, the string 0 represents DIO Port 0. For NI 845x devices with one DIO port, the port value must be set to 0. The DIO Port Voltage property configures the active DIO port with the desired voltage characteristics. DIO Port Voltage uses the following values: Open-Drain The port is configured for open-drain voltage. Push-Pull 3.3 V The port is configured for 3.3 V push-pull voltage. The default value of this property is Push-Pull 3.3 V. The DIO Line Direction Map property sets the line direction map for the active DIO Port. The value is a bitmap that specifies the function of each individual line within the port. If bit x = 1, line x is an output. If bit x = 0, line x is an input. The default value of this property is 0 (all lines configured for input). You can use the DIO Line Direction Map to specify writing or reading from a port. To do this input a binary segment of eight "1" to write to the port or eight "0" to read a port.Once you have done this you can connect the Property node to a read or write Port VI. ![]() There are two examples linked below showing a Port write and read. Examples can also be found in LabVIEW Examples. LabVIEW Examples Use NI-845x DIO Port Write.vi in LabVIEW and ni845xDioWritePort in other languages to write an 8-bit pattern to the selected DIO port. Use NI-845x DIO Port Read.vi in LabVIEW and ni845xDioReadPort in other languages to read an 8-bit pattern from the selected DIO port. Use NI-845x DIO Line Write.vi in LabVIEW and ni845xDioWriteLine in other languages to write a value to a particular line within the selected DIO port. Use NI-845x DIO Line Read.vi in LabVIEW and ni845xDioReadLine in other languages to read a value from a particular line within the selected DIO port. LabVIEW Examples can be found by going to Help»Find Examples. Related Links: Attachments:
Report Date: 04/24/2007 Last Updated: 11/17/2007 Document ID: 48NC3JBH |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||


