| Online Development Notebook > Index > U4x1 Application Notes > App2: Input |
App2: Input Application
Purpose
Provide a program that reads the state of digital lines connected to the U401⁄U421⁄U451.
Description
This program initializes all of the sixteen i⁄o lines of the U4x1 to be inputs that can then be read by the PC.
The state of individual lines are displayed on 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 inputs. When new values are read from the ports, the individual boxes (for each line) will change from gray to either bright or dark red.


Hardware
No specific hardware is necessary to run this application. The individual input lines can be connected to either high (+5V) or low (ground).
An interface board such as the DT203 SimmStick can be attached to the U4x1 and read by this application.
Example of a single switch input to the U4x1 (10k ohm resistor would work fine):

Example of an opto-isolated input:

Code
Download all application files: (all application files)
| 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 usbmicro.com. Copyright © USBmicro, L.L.C., 2002-2010 |