Port-Mapped I/O and Memory-Mapped I/O is the key method to connect from CPU to I/O Peripherals. Do you need to write applications to access Memory-mapped IO addresses using Delphi/C++? Don’t know where to start? Don’t worry, WINSOFT helped us with a component to do the job quickly.
Features:
- Access to I/O and memory-mapped ports on 32 and 64-bit Windows
- PnP device drivers built using Microsoft KMDF WDK framework
- Easy of use, component is fully auto configurable
- Block data transfer enables high-speed data transfer
- DirectAccess mode provides the fastest access to I/O ports (32-bit Windows only)
Versions Supported: Delphi/C++ Builder 5 – 10.4 and Lazarus 2.0.8
Platforms: Windows;
Installation Steps:
Prerequisites: Ensure 11.2 MB minimum free space available in the system.
- Download IOPort Setup and Right-click Open.
- Read the Information Window about features, installation, and copyright. Click Next.
- Browse for the custom destination folder to install and click Next.
- Browse for the custom Start Menu folder and click Next. You can ignore creating by clicking the checkbox Don’t create a Start Menu folder option.
- Review your folder settings and click Install. You can click Back to change your folder settings.
- Once Installation Progress is done click Finish.
- Ensure the IOPort files are shown in the chosen Start Menu Folder by clicking Windows Start Menu.
Installation Steps Demo: IOPort Installation Demo:
Key concepts:
- Memory-mapped I/O is mapped into the same address space as program memory and/or user memory and is accessed in the same way.
- Port mapped I/O uses a separate, dedicated address space and is accessed via a dedicated set of microprocessor instructions.
How to build applications using IOPort component:
- Open Rad Studio 10.4.1 and Create a Windows VCL Application. Navigate to Components bar -> System. Check the IOPort Component installed as shown.
2. Drag and Drop the TIOPort component or by adding IOPort.pas into your unit and create these components by code.
TIOPort: Enables to access Windows I/O and memory-mapped ports.
- Active: Enables or disables access to I/O ports..
- DirectAccess: Enables the fastest I/O port access using undocumented Windows functions. Allows direct access to I/O ports from the application instead of calling the device driver for each I/O access. Direct access is supported on 32-bit Windows only.
- Port[Index: DWord]: For reading and writing a byte/word/double word from/to the specified I/O port.
- Register[Index: DWord]: For reading and writing a byte/word/double word/quadword from/to the specified memory-mapped port.
- ReadByteBuff/WriteByteBuff: Method to Read/Write a number of bytes/words/double words from the specified I/O port to a memory buffer.
3. Get the physical memory addresses for Memory mapped IO.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
procedure TFormMemory.SpeedButtonShowPhysicalMemoryClick(Sender: TObject); function GetChar(Value: AnsiChar): AnsiChar; begin if Value < ' ' then Result := '.' else Result := Value; end; var Address, Length: Integer; Line, Row, LineCount: Integer; LineStr: string; begin with Memo, IOPort do try Screen.Cursor := crHourGlass; Clear; Lines.BeginUpdate; Address := StrToInt(EditAddress.Text); Length := StrToInt(EditLength.Text); LineCount := Length div 16; if Length mod 16 > 0 then Inc(LineCount); for Line := 0 to LineCount - 1 do begin LineStr := IntToHex(Address + Line * 16, 8) + ' '; for Row := 0 to 15 do LineStr := LineStr + IntToHex(Register[Line * 16 + Row], 2) + ' '; for Row := 0 to 15 do LineStr := LineStr + GetChar(AnsiChar(Register[Line * 16 + Row])); Memo.Lines.Add(LineStr); end; finally Lines.EndUpdate; Screen.Cursor := crDefault; end; end; |
4. Use Methods such as ReadByteRegisterBuf/WriteByteRegisterBuf to read/write a number of bytes/words/double words/quad words from the specified memory-mapped port to a memory buffer.
Sample Application Demo:
Conclusion: Easily you can build Applications using WINSOFT IOPort component to access Windows I/O and Memory-mapped ports and save your effort.
Check out the full WINSOFT IOPort for Access in Delphi and C++Builder Applications.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition