Usbio24 Ocx

  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Usbio24 Ocx as PDF for free.

More details

  • Words: 855
  • Pages: 16
For USBIO24 module manufactured by Gigatechnology and Elexol

History software ver 1.0 software ver 1.1

20-06-2004 29-06-2004

software ver 1.2

19-08-2004

manual version 1 manual version 2 manual version 2.1 manual version 2.2 manual version 2.3 manual version 2.4 manual version 2.5

29-06-2004 22-07-2004 23-07-2004 19-08-2004 22-09-2004 29-10-2006 06-01-2007

automatic detection of USB Virtual Com Port for Windows 2000 add Serial No property

Include Port Connector Pinout on Page 1 add Serial No property add accessory boards add support for Windows XP SP2 expand installation steps

email all comments and errors to [email protected]

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 USBIO24.DDRA = 0 USBIO24.DDRA = 1 USBIO24.DDRA = &H31

‘ 11111111 - all pins as inputs ‘ 00000000 - all pins as outputs ‘ 00000001 - pin 0 as inputs, pin 1 to 7 as outputs ‘ 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 USBIO.WritePortA = 0 USBIO.WritePortA = &H55

‘11111111 - All pins of Port A are switch on ‘ (at logic 1) ‘00000000 - All pins of Port A are switch off ‘ (at logic 0) ‘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 USBIO.SetBitA = &HA1 USBIO.SetBitA = &HFF USBIO.SetBitA = 0

‘00010010 – switch on pin 1 and 4. Other pins no change ‘10100001 – switch on pin 0, 5 and 7. Other pins no change ‘11111111 – switch on all pins ‘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 USBIO1.WritePortA = &HF1 USBIO1.SetBitA = (&H8) USBIO1.SetBitA = (&H6) USBIO1.ClearBitA = (&H30)

‘ 00000000 - set Port A as output ‘ 11110001 - switch on Port A bit 7,6,5,4,0 and ‘ off the rest ‘ 00001000 - switch on bit 3 ‘ 00000110 - switch on bit 1,2 ‘ 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)

(4)

USBIO24 Opto Input Board

USBIO24 Relay Output Board

16

Related Documents

Usbio24 Ocx
October 2019 10