Home Parallel Port Serial Port Serial Info Parallel Info USB .NET Webboard I/O Today API Project Directory

 Hardware Interfacing and TCP/IP interfacing in VB programming.

Interfacing Visual Basic with Card ISA I/O 8255
Thai Page Clcik Here
† †† †   On this picture, Card ISA can be connected in slot of PC, then finding pair which is the same type that use for harddisk to connect with Connector in order to take I/O signal to connect to Hardware.

    IC 8255 is Programmable Peripheral Interface (PPI), use for Interfacing PC with output device that can be Port Input and Port Output, 3 port of 8 bit. For programming to control, IC 8255 will include 40 connectors. They are divided into 4 groups, in the following;
    † 1. Signal of Input and Output Port
    †2. Data signal
† ††    †3. Address signal
† ††    †4. Control signal
† †† Using Card8255 as Input or Output by setting mode as 3 modes,
† †† †     - mode 0 (Basic input and Output)
    - mode 1(Strobed input and Output)
   - mode 2(Bi-Directional Bus)
† ††   For details of Card I/O 8255, I will separate into another topic, but so now, we will focus on using. For programming, It isnít different programming with Printer Port, but adding section is setting Port Control and mode for working with Port Control of I/O 8255, but Card ISA that I use, can Set Dip SW, setting number position of Port Control of Card by adjusting Dip Sw, will not be equal to Port of your computer. In this, Card 8255 is Set Dip SW by setting Port at 300H.
† †   † &H300 = Port A in Card 8255
    &H301 = Port B in Card 8255
    &H302 = Port C in Card 8255
    &H303 = Port Control in Card 8255

Declaring condition in Form like this, † ††

† †† Dim PortDataA ,PortDataB , PortDataC ' ' data that is sent to port
† †† Const AddressA = &H300, AddressB = &H301, AddressC = &H302
' ' value of position of port
† †† Const ControlPort=&H303
' Mode for working
† †† Conts ModeSelect=&H80
' Mode for working

† †† From Code above, we will see Const ModeSelect=&H80 as selected mode for working by set Port Control =&H80 that make Port A,B,C to be Output Port of selected mode for use of I/O Port such as Port A,Port B is Output and Port C is input. Also, setting at Port Control=&H89, in he following table will be value that use for setting of portís working.

Table of value setting to control port for Card I/O 8255

Coding for sending value out Card I/O 8255

† ††
This code must be written in View code when use Visual Basic by use whatever procedure you create, but this section, we will write at Command1_Cilck(),Command2_Cilck(),Command3_Cilck() in order to test sending 3 ports, by getting value from Textbox1 for port A , Textbox2 for port B ,Textbox3 for port C and Label1, Label2, Label3 are show Input Port you send.

Code in procedure Command1_Cilck()

Private Sub Command1_Click()
† †† PortDataA = Val("&H" & Text1.Text)† ††
'store in Textbox1that will export in variable
† †† Call Out(AddressA, PortDataA)†    † ††
†   'export to Port A
† †† Label1.Caption = Hex(Inp(AddressA))†
'show Input Port A as Hexadenary
End Sub

Code in procedure Command2_Cilck()

Private Sub Command2_Click()
† †† PortDataB = Val("&H" & Text2.Text)†  
  † 'store in Textbox2 that will export in variable
† †† Call Out(AddressB, PortDataB)† †† † †† †
†† 'export to PortB
† †† Label2.Caption = Hex(Inp(AddressB))†
'show Input Port B as Hexadenary
End Sub

Code in procedure Command3_Cilck()

Private Sub Command3_Click()
† †† PortDataC = Val("&H" & Text3.Text)†
†† † 'store in Textbox3 that will export in variable
† †† Call Out(AddressC, PortDataC)† †† † †† †
†† 'export to Port C
† †† Label3.Caption = Hex(Inp(AddressC))†
† 'show Input Port C as Hexadenary
End Sub

† †† All of codes I mentioned are control port of Card I/O 8255 that use just one IC. If we buy from shop, R&D may have 3 of IC that can use more I/O port, total 9 ports, and there are Connector 34 Pin = 3. If we program for use, we must add setting of reference position of new port like below.

The table of setting port position for Card I/O 8255 3 Connector

Connector No.1 Connector No.2 Connector No.3
Control Port=XX3H
Control Port=XX7H
Control Port=XXBH

   The Sign xxx is value that we can select beginning position of port by setting at Dip SW. in Card I/O 8255 in the following table.

† ††
Beginning position of port= 300H


† †† †
Beginning position of port = 280H


† ††
Beginning position of port = 200H
† ††

  The details of Card I/O 8255 may be changed that can look at manual of card, but If you want try by yourself, you must buy Card ISA and many devices. I recommend you to buy processed ones will be better.

      The learning outcome of this article

1. To know how to program by using Visual Basic to control working of I/O Parallel Port
2. To know how to apply File DLL to help you for programming due to you canít directly program to control Visual Basic.
3. To know how to program by using API from using DllPort.Dll.
4. To know how to work from Card I/O 8255 that is Card ISA expanding Parallel port.

† ††

Copyright (c) 2000-2008 thaiio.com all rights reserved.  Contact webmaster :webmaster@thaiio.com