Online Development Notebook > Index > U4x1 Application Notes > App1: Output

App1: Output Application


Provide a program that tests the control of external devices through the output commands of the U401⁄U421⁄U451.


This program initializes all of the sixteen i⁄o lines of the U4x1 to be outputs and allow control of each line.

There are two ways to change the state of the output lines. The output lines can be written to as an 8-bit wide byte, and as individual bits.

The buttons labeled "Write Output" will write the byte-wide value entered in the adjacent box to the port. The left button writes to port A and the right button writes to port B.

Individual lines can be controlled by toggling the buttons located below the line number at the bottom of the application window. A bright red color indicates that the line is set high, while a dark red color shows that the line is set low.

Screen Shot

Below is the application screen as it looks when the program is first initialized. Both ports (all of the lines) have been set to be outputs and have been set to all zeros. When new values are written to the ports, the individual boxes (for each line) will change from gray to either bright or dark red.

Here the application screen shows values written to the ports.


No hardware is necessary to run this application. A volt-reading meter, such as a DVM can be used to read the status of any one of the 16 outputs. The meter ground (black) lead should be connected to the U4x1 ground connection as a reference.

A relay board such as the DT205 SimmStick can be attached to the U4x1 and controlled by this application.

Example output circuit for driving an LED:

Example output circuit for driving a relay to control higher power circuits:

Example of an opto-isolated interface:

Also see the Relay Tutorial:Amp It Up!

Hardware:  U401 USB Interface    U421 USB Interface   U451 USB Interface

Programming:  USBm DLL Programming    Download Files

Application Notes:  U4x1 Application Notes    Misc Applications and Information    FAQ

While every effort has been made to make sure that the information posted on this site is correct, the author can not be held liable for any damages whatsoever for losses as a result of the application of this information. Use this information at your own risk.

USBmicro can design your custom and semi-custom USB product. Email about USB design can be directed to " Robert " at

Copyright © USBmicro, L.L.C., 2002-2010

Previous  |  Next ]     [ Up  |  First  |  Last ]     (Article 90 of 126)

This page is created with TreePad