Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 4.4

COLUMN

Port Input/Output

Accessing the hardware ports

Issue: 4.4 (March/April 2006)
Author: Christian Schmitz
Author Bio: Christian Schmitz is the creator of the Monkeybread Software Realbasic Plugins.
Article Description: No description available.
Article Length (in bytes): 6,953
Starting Page Number: 42
Article Number: 4418
Related Web Link(s):

http://www.logix4u.net

Excerpt of article text...

A friend is currently doing REALbasic applications to replace older Turbo Pascal applications. One of the missing things in REALbasic is direct hardware control. In a multitasking operating system, a single application cannot control the hardware itself. All hardware components are taken by the operating system and can only be used through high level functions in case permissions are granted.

Still, sometimes your application may need to read one of the hardware ports. This type of port is something like an array. 65536 ports exist and the first has the number 0. You can read and write to a port and the CPU will send the signal around on the motherboard of your PC. One of the components may answer and if so you'll get the value. If no one answers, you may get rubbish.

You can also write to a port to send data to a device. For example, the serial keyboard connector on your PC has a controller chip which answers on port &h060. There you can read the key code of the last key pressed.

The inpout32 library

There is a library to allow normal applications to read and write port values. This library is called inpout32 and can be downloaded from http://www.logix4u.net. There you will find more details and license information. This library is free for non-commerical use.

When the library is loaded, it loads a special kernel mode driver from itself to do the port access. Please be aware that both writing to and reading from the ports can cause hardware problems. You can damage a PC with wrong values! For example, if you increase the refresh rate of the display above the safe range, you can cause damage to the display. If you limit yourself to use only some fixed ports you can be quite safe. Having the user enter the port numbers is a big security risk!

...End of Excerpt. Please purchase the magazine to read the full article.