Standard Courses



sign up for our newsletter

can't find the right course?
contact us for customized training

see our course feedback

Upcoming Program Registration

Upcoming Program Registration

    No public course is currently scheduled.

  • Please keep me posted on the next schedule
  • Please contact me to arrange in-house course
  • Please contact us to register courses in Singapore, Taiwan and Thailand

Programming for Hardware Interfacing with VB (PC167)

SynopsisThere is a niche segment in the engineering industry that requires engineers or programmers to know the programming methods and techniques in interfacing to various kinds of hardware. IT background programmers may not have knowledge in hardware, while engineering background engineers may not have good command in programming. This short course is aimed to fill the missing skill set to allow engineers and programmers to write software programs that involve hardware interfacing.

Microsoft Visual Basic is one of the most popular programming languages used in windows programming in Microsoft Windows platform. This course will provide a solid foundation in Visual Basic programming techniques in general. Various standard hardware interfaces, including serial port, parallel port, GPIB, TCP/IP, and USB, are described for attendees to understand the working principal, signal protocols, and access methods of these interfaces. Hands-on sessions are followed to learn and practice writing codes for communicating through these interfaces.

Course highlight
Attendees will gain hands-on experience in Visual Basic code development and compilation for hardware interfacing. Some examples of real hardware will be demonstrated to the class as well.

What You Will Learn

  • Visual Basic programming basics
  • RS-232 serial communication programming
  • Parallel port communication programming
  • GPIB communication programming
  • TCP/IP communication programming
  • USB communication programming

Who Should AttendSoftware engineers and programmers who are involved in software programming that requires hardware interfacing.

PrerequisiteTechnical background in electronics or IT at Diploma or Degree levels. Basic knowledge in Visual Basic programming is preferable but not mandatory.

Course MethodologyThe participants are taught VB programming techniques in classroom setting, followed by hands-on programming for each module taught. Microsoft Visual Basic 2005 Express Edition will be used. Theories and practical exercises are equally emphasized.

Course Duration5 days, 9am - 5pm

Course StructureModule 1: Getting Started with Visual Basic 2005 (2 Days)
Relation to older versions of Visual Basic (VB6 and previous) Versions of Visual Basic .NET

  • Visual Basic .NET (VB 7)
  • Visual Basic .NET 2003 (VB 7.1)
  • Visual Basic 2005 (VB 8.0)
  • Visual Basic 2008 (VB 9.0)
  • Visual Basic 'VBx' (VB 10.0)

Hello world example

Working with controls
  • Button
  • Label
  • ComboBox
  • ListBox
  • PictureBox
  • TextBox

Working with controls properties at design time or run time

Object oriented programming
  • Encapsulation
  • Inheritance
  • Polymorphism

Writing the code
  • Sub - End Sub
  • Function - End Function

Managing VB2005 data type

Mathematical operations
  • Addition ' + '
  • Subtraction ' - '
  • Multiplication ' * '
  • Division ' / '
  • Exponential ' ^ '
  • Modulus ' Mod '
  • Integer Division ' \ '

String manipulation

Controlling program flow using
  • If - Then - Else
  • Select - Case control structure

Looping
  • For - Next Loop
  • Do Loop
  • While - End While Loop

Basic Functions
  • MsgBox
  • InputBox
  • Mid
  • Trim
  • Ltrim
  • Rtrim
  • Ucase
  • Lcase
  • Chr
  • Asc
  • Abs
  • Fix
  • Int
  • Log
  • Rnd
  • Round
  • Format

Using check boxes and radio buttons

Exercise
  • Tic-Tat-Toe

Module 2: RS-232 Serial Communication with VB2005 (0.5 day)
Introduction to RS-232 standard
  • History
  • Pin configurations
  • Signal state voltage assignments
  • Signal characteristics
  • Cables wiring examples
  • Short-circuit tolerance

Universal Asynchronous Receiver Transmitter (UART) protocol
  • Data packet
  • The ASCII character set
  • Parity and checksums

Using the Microsoft Serial Port Control - MsComm32.ocx
  • Establishing the serial connection
  • Opening the serial port
  • Sending out a string
  • Setting receive and transmit buffer properties at design time
  • Managing the receive and transmit buffers
  • Handshaking
  • The OnComm Event and the CommEvent property

Example - Designing an RS-232 communication tool Using platform invoke services call Win32 API functions to access serial port

Module 3: Parallel Port Communication with VB2005 (0.5 Day)
Introduction to Parallel Port
  • History
  • Pin configurations
  • Port addresses
  • Standard parallel port
  • Bi-directional port
  • Parallel port modes in BIOS
  • Parallel port modes selection using ECP's Extended Control Register

Using the Third-Party Parallel Port Control - Port32.ocx
  • Setting the Parallel Port Address
  • Setting the 8-bit/16-bit Mode
  • Sending out a byte/word
  • Reading a byte/word

Example - Controlling an unipolar stepper motor

Using the Third-Party Parallel Port Driver - InpOut.dll
  • Declaring the DLL's functions in VB2005
  • Sending out a byte/word
  • Reading a byte/word

Example - Controlling seven-segment displays

Using platform invoke services to call Win32 API functions to access parallel ports

Module 4: GPIB Communication with VB2005 (0.5 Day)
Introduction to GPIB
  • History
  • Pin configurations
  • Connector types
  • Signal Applications Using Agilent I/O Object Library
  • Installing Agilent ISDK for Visual Basic
  • Declaring Agilent I/O Manager
  • Establish GPIB connection
  • Setting multiple GPIB connections
  • Output a command to instrument
  • Polling data from instrument

Example - Programming Agilent E3631A DC Power Supply through GPIB

Module 5: TCP/IP Communication with VB2005 (0.5 Day)
Introduction to TCP/IP
  • The Evolution of TCP/IP (and the Internet)
  • Domain Names and IP Addresses (and Politics)
  • The Network Interface Layer
  • The Internet Layer
  • The Transport Layer Protocols
  • The TCP/IP Application Layer

Using Microsoft WinSock Control - MsWinSck.ocx
  • Choosing the transport protocols (TCP/IP or UDP)
  • Specifying the host's IP and Port
  • Establishing connection to the host computer
  • Sending data
  • Receiving data
  • Terminating the connection to the host computer

Example - Designing a general LAN communication tool

Module 6: USB Communication with VB2005 (1 Day)
Introduction to USB
  • History
  • Host controllers
  • Device classes
  • Transfer rates
  • Pin configurations
  • Connector types
  • Power

Using Microsoft Human Interface Device Driver - Hid.dll
  • Host communication overview
  • Using API functions
  • Device attachment and removal
  • Finding a device
  • Reading and writing data

Using FTDI Chip D2XX Direct Driver - FTD2XX.dll
  • Listing connected FT devices
  • Open/Close device
  • Reading and writing data

Example - USB to 8 digital I/Os interface board using FT232BM chipset