

| Creating DLL file by Borland Delphi, connecting IO Parallel Port |
|
|
|
|
As we know that VB can't program to connect through Parallel Port directly. In the book, there will be explanation that we create DLL files that can write by using whatever language that has the function connecting to port. This website I have ever presented programming by C++, using Inp function for getting value along port and out is sending value out along port. So now, we will introduce creating DLL file (Dynamic LInk LIbrary) by Borland Delphi, using Assembly programming to help for connecting through port by using the function of Assembly. IN AL,DX OUT DX,AL
push dx mov dx,AddressPort ; AddressPort variable that get value from calling function mov al,ValueByte ; ValueByte variable that get value from calling function out dx,al pop dx In the part of INPUT is the function of Assembly, reading value from input port that has value of port at 0 - 65,535 that will be used in Delphi that has the function like this, push dx mov dx,AddressPort ; AddressPort variable that get value from calling function. in al,dx mov ValueByte,al ; ValueByte variable that send value back when call function. pop dx
So now, we begin in the part of Delphi. Start opening New file in Pascal. We will not mention the other details, we will show just Code that is the function only, then copy to put on code in Delphi that in the part of output per is programmed as Procedure. For input, using programming as Function. Library InOutVB; { set library name} Uses SysUtils; {procedure for sending value at port} Procedure OutVB(AddressPort:smallint ; ValUse:smallint);stdcall;export Var ValueByte:Byte; Begin ValurByte:=Byte(ValUse); { type asm function in order to be the part of program that is written by Assembly } asm push dx mov dx,AddressPort mov al,ValueByte out dx,al pop dx End; End ; Function InVB(AddressPort:smallint):smallint;stdcall;export; Var ValueByte:Byte; Begin asm push dx mov dx,AddressPort in al,dx mov ValueByte,al pop dx End; InVB:=smallint(ValueByte) and $00FF; { feedback to the function. End Exports InWin ; OutWin ; Begin End OutVB (&H378,H&08) 'send value to Printer port. All are the fundamental that can be used to program by Delphi in other types. After using the ready-made function is port in Pascal. Now, we try to program as Assembly for using more info goto http://omron-plc.com. About the AuthorWe are who present Programmable Logic Control article. http://omron-plc.com |






![]() | Today | 14 |
![]() | Yesterday | 14 |
![]() | This week | 127 |
![]() | This month | 73 |
![]() | All | 2351 |


Powered by Joomla!. Designed by: web templates domain register Valid XHTML and CSS.