You are on page 1of 16

For USBIO24 module manufactured by Gigatechnology and Elexol

History

software ver 1.0 20-06-2004


software ver 1.1 29-06-2004 automatic detection of USB Virtual Com Port for
Windows 2000
software ver 1.2 19-08-2004 add Serial No property

manual version 1 29-06-2004


manual version 2 22-07-2004
manual version 2.1 23-07-2004 Include Port Connector Pinout on Page 1
manual version 2.2 19-08-2004 add Serial No property
manual version 2.3 22-09-2004 add accessory boards
manual version 2.4 29-10-2006 add support for Windows XP SP2
manual version 2.5 06-01-2007 expand installation steps

email all comments and errors to tpstore@singnet.com.sg

1
Driver Installation

The Com port number will vary depending on the number of existing com ports on your
computer and the number of USBIO24s connected to your system.

Step 1
Plug in the USBIO24 using a USB cable.

Step 2
2 drivers would be installed.
Firstly is the USB serial converter

2
3
Step 3
Secondly it will install the USB Serial Port driver.

4
5
Step 4
Run the setup program on the CD.

Step 5
Next run the sample program [USBIOex1]

You should get the screen below which show that the installation is successful.

6
Step 6
Run VB and start a new project to develop your own program.

You may key in the sample program.

7
Commands
(1) Identity

USBIO.Identity

Display the identity string “USB I/O 24”

(2) Connect

USBIO.Connect

Connect the USBIO24 to the virtual serial port for Windows 2000.
For Windows 98 use USBIO24.comPort. The driver is installed as a Virtual Com Port
and when installed the USBIO24 will appear in the System Properties / Device Manager
as an USB Serial Port (COMn) as follows.

8
(3) ComPort

USBIO.ComPort

Display the serial port number that the USBIO24 is currently connected to.

USBIO.ComPort = 3

Connect the USBIO24 to serial port number 3

(4) WriteDDR

USBIO.WriteDDRA

Set Port A pins as input or output

Example

USBIO24.DDRA = &HFF ‘ 11111111 - all pins as inputs


USBIO24.DDRA = 0 ‘ 00000000 - all pins as outputs
USBIO24.DDRA = 1 ‘ 00000001 - pin 0 as inputs, pin 1 to 7 as outputs
USBIO24.DDRA = &H31 ‘ 00110001 - pin 0, 4, 5 as inputs, the rest as outputs

USBIO.WriteDDRB

Set Port B pins as input or output

USBIO.WriteDDRC

Set Port C pins as input or output

9
(5) WritePort

USBIO.WritePortA

Switch on/off Port A pins

Example

USBIO.WritePortA = &HFF ‘11111111 - All pins of Port A are switch on


‘ (at logic 1)
USBIO.WritePortA = 0 ‘00000000 - All pins of Port A are switch off
‘ (at logic 0)
USBIO.WritePortA = &H55 ‘01010101 - pins 0, 2, 4, 6 are switch on
‘ and pins 1, 3, 5, 7 are switch off

USBIO.WritePortB

Switch on/off Port B pins

USBIO.WritePortC

Switch on/off Port C pins

(6) ReadPort

USBIO1.ReadPortA

Display the content of Port A

USBIO.ReadPortB

Display the content of Port B

USBIO.ReadPortC

Display the content of Port C

10
(7) SetBit

USBIO.SetBitA

Switch on selected bits of Port A

USBIO.SetBitA = &H12 ‘00010010 – switch on pin 1 and 4. Other pins no change


USBIO.SetBitA = &HA1 ‘10100001 – switch on pin 0, 5 and 7. Other pins no change
USBIO.SetBitA = &HFF ‘11111111 – switch on all pins
USBIO.SetBitA = 0 ‘00000000 – All pins no change

USBIO.SetBitB

Switch on selected bits of Port B

USBIO.SetBitC

Switch on selected bits of Port C

(8) ClearBit

USBIO.ClearBitA

Switch off selected bits of Port A

Example

USBIO.ClearBitA = &H12 ‘00010010 – switch off pin 1 and 4. Other pins no change
USBIO.ClearBitA = &HA1 ‘10100001 – switch off pin 0, 5 and 7.
‘ Other pins no change
USBIO.ClearBitA = &HFF ‘11111111 – switch off all pins
USBIO.ClearBitA = 0 ‘00000000 – All pins no change

USBIO.ClearBitB

Switch off selected bits of Port B

USBIO.ClearBitC

Switch off selected bits of Port C

11
(9) Serial Number

USBIO.SerialNo

Display the Serial No

12
Sample program 1
Private Sub Form_Load()

USBIO1.Connect ‘ auto connect to the virtua1 comm. port


Text1.Text = USBIO1.Identity & " " & USBIO1.ComPort

USBIO1.WriteDDRA = &H0 ‘ 00000000 - set Port A as output


USBIO1.WritePortA = &HF1 ‘ 11110001 - switch on Port A bit 7,6,5,4,0 and
‘ off the rest
USBIO1.SetBitA = (&H8) ‘ 00001000 - switch on bit 3
USBIO1.SetBitA = (&H6) ‘ 00000110 - switch on bit 1,2
USBIO1.ClearBitA = (&H30) ‘ 00110000 - switch off 5,4

Text2.Text = Hex$(USBIO1.ReadPortA)

End Sub

Sample program 2
Private Sub Form_Load()
USBIO1.Connect
Text1.Text = USBIO1.Identity & USBIO1.ComPort & vbCrLf & USBIO1.SerialNo
USBIO1.WriteDDRA = &H0
USBIO1.WriteDDRB = &H0
USBIO1.WriteDDRC = &H0

USBIO1.WritePortA = &HF1
USBIO1.WritePortB = &H22
USBIO1.WritePortC = &HFF

USBIO1.SetBitA = (&H2)
USBIO1.SetBitB = (&H2)
USBIO1.ClearBitC = (&H30)

Text2.Text = Hex$(USBIO1.ReadPortA)
Text3.Text = Hex$(USBIO1.ReadPortB)
Text4.Text = Hex$(USBIO1.ReadPortC)

End Sub

13
Disclaimer

This product and its documentation are provided as-is and no warranty is made or implied
as to their suitability for any particular purpose.

14
USBIO24 Accessory Boards
All the accessory boards listed below can be used on the USB I/O 24

(1) USBIO24 Connector / LED Board

(2) USBIO24 Switch / Push Button Board

15
(3) USBIO24 Opto Input Board

(4) USBIO24 Relay Output Board

16