USBmicro

Your source for USB electrical device interface products.

  • Home
  • Services
    • Design
    • Contact USBmicro
  • Where to buy…
You are here: Home / Documentation / Programming Overview

Programming Overview

The U4xx was developed to operate with the Windows operating system. The U4xx works with Windows Vista, Windows XP, Windows 98se, Windows 98me, and Windows 2000.  Windows NT, Windows 95, the first release of Windows 98, and any earlier versions of Windows do not work completely or at all with the U4xx (or any similar USB device).

The U4xx has been tested with OSX, Linux Red Hat 8.0, and current Ubuntu Linux.

An application program for the U4xx can be written in several different languages (VB, VC, Delphi, BCB) by accessing Windows API directly or through a DLL. The application languages include more than just the languages that are sampled in this document. Any language that can produce a Windows program and call either the Windows API or a DLL would be candidates for interfacing this USB hardware.

USBm Dynamic Link Library Programming (VB, C, C++, Delphi, .NET, RobotBASIC, REALbasic, Java, etc.)

A dynamic link library hides most of the messy interface commands. The DLL (USBm.dll) provides a function for EACH device operation. Visual Basic can access the DLL by including an interface file (USBmAPI.bas). Visual C can access the DLL by including the DLL in the project.

For example, to write E7h to port A use this command:

USBm_WritePortA( device, 0xE7 )

The DLL API is described in the USBm DLL Programming section of this document. Using the DLL is the better choice for interfacing to the USB device on windows.

Raw Device Programming (Linux, Mac OSX, VB Example)

You can directly communicate with the Windows API to program the USB interface boards. For VB, the support files (those with a .bas extension) separate the bulk of the interface details from the main VB application.

The operations that control the USB device are commands that write data to the device and read data from the device. These two function calls provide a way for commands to be sent to the device, and replies read. The “payload” of the functions is the “raw” device command.

To write E7h to port A use the command 01-E7-00-00-00-00-00-00. Details of sending these bytes are covered where Linux and Mac are discussed.

The raw commands are described in each device command as Raw Device Programming. Use this method of interfacing to the USB device only if your programming language has no support for using the DLL.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Documentation

Open all | Close all
USBmicro Products
Ordering USBmicro Products
U401 USB Interface
U401 Specifications
U401 Connector Pin Out
U401 Capabilities
U421 USB Interface
U421 Specifications
U421 PCB Pin Out
U421 Capabilities
U451 USB Relay Interface
U451 Specifications
U451 PCB Pin Out
U4x1 Installation
U4xx Troubleshooting
Programming Overview
Dynamic Link Library Programming
Visual Basic Example
C#⁄.NET Information
RobotBASIC
MSVC++ Example
Delphi Interfacing
LabView Interfacing
Raw Device Programming
General VB Example
Linux Info
Mac OSX Info
DLL Commands
About
SetReadTimeout
Version
WriteDevice
ClearRecentError
CloseDevice
Copyright
DebugString
DeviceDID
DeviceFirmwareVer
DeviceMfr
DevicePID
DeviceProd
DeviceSer
DeviceValid
DeviceVID
FindDevices
NumberOfDevices
ReadDevice
RecentError
Device Commands
InitPorts (and variations)
WriteA
WriteB
WriteABit
WriteBBit
ReadA
ReadB
SetBit
ResetBit
DirectionA (and variations)
DirectionB (and variations)
StrobeWrite
StrobeWrite2
StrobeRead
StrobeRead2
StrobeWrites
StrobeReads
ReadLatches
InitLCD
LCDCmd
LCDData
InitSPI
SPIMaster
SPISlaveWrite
SPISlaveRead
Wire2Control
Wire2Data
Stepper
Reset1Wire
Write1Wire
Read1Wire
Write1WireBit
Read1WireBit
Download Files
Application Notes
App0: Command Test
App1: Output
App2: Input
App3: LCD
App4: SPI Output
App5: SimmSticks
App6: USB Digio
App7: Stepper Motor
App8: SPI ADC
App9: 1-Wire
AppX: OSX Interface
App11: Home Domination
App12: Large LED Display
App13: Magnetic Angle Sensor
App14: 2-Wire to PCF8574
App17: REALBasic OSX
Frequently Asked Questions