Software programming and LinkMaster debugging tools
7.1 Drivers and API Libraries
Linghua provides dynamic link libraries (D2K-DASK style) for Windows and Linux, with function prefixes uniformly set to HSL. For digital output, the core functions include:
HSL_D_writable output: Write a 32-bit output value at once.
HSL_D_Write_channel_output: Write channel by channel.
HSL_D_read_output: Read back the output value saved in the main card SRAM (confirm if the write is successful).
HSL_D_set_output: Configure output polarity (positive or negative logic) to adapt to different actuators.
Programming process (refer to Chapter 6 flowchart):
HSL_initial initializes the main card.
HSL_set_stcan_dedition sets the rate and duplex mode (optional).
HSL_auto_start or HSL_start starts scanning and automatically detects slave stations.
Loop call HSL_D_Write_output to update the output, while also calling HSL_slave_live to monitor the status.
Before exiting the program, call HSL_stop and HSL_close to release resources.
7.2 LinkMaster Utility Tools
During the development and debugging phase, the LinkMaster graphical tool greatly simplifies system validation. After running, automatically scan all main cards and connected slave stations, click on the corresponding module icon to manually control the on/off of each output channel, and observe the communication error counter in real time. For HSL-DO32, the interface displays 32 circular buttons, with red indicating conduction and gray indicating shutdown. This tool can complete hardware connection testing without writing any code and is the preferred method for on-site troubleshooting.
Suggestions for Terminal Base and On site Wiring Engineering
8.1 Base selection
HSL-TB32-M-DIN: Designed specifically for M-series modules, single slot, 32 channel screw or spring terminals, supporting DIN rail installation.
The base is equipped with a built-in power input (24VDC) and a common terminal (COM) to supply power to the module. NPN type output requires connecting the load to the positive power supply, while PNP type requires connecting the load to ground.
8.2 Wiring precautions
The output channel adopts optocoupler isolation, but the on-site power line should be routed separately from the signal line to avoid electromagnetic interference.
The current of each output channel should not exceed 50mA. If driving a large inductive load (such as a relay coil), a freewheeling diode should be connected in parallel at the load end to prevent the output tube from being damaged by the back electromotive force.
There is a fuse jumper (JP5) on the base, which can be selected to be connected in series with the fuse protection module.
8.3 Hot plug operation
The M series module supports hot swapping, and there is no need to disconnect the power and signal lines when replacing the module. However, it is important to ensure that the DIP switch address of the new module is consistent with the original module, otherwise the system address conflicts.
Precautions for System Integration and Replacement
For engineers who are maintaining outdated distributed systems (such as using third-party serial buses or dedicated ASIC solutions), HSL provides a clear upgrade path:
Compatibility: PCI-7853/7854 supports standard PCI slots, PMC-7852/G is suitable for embedded CompactPCI or VPX platforms, and meets industrial grade long life cycle requirements.
Software migration: Linghua provides rich example code (C/C++, VB, LabVIEW), with clear API design and short development cycle for new projects.
Spare parts management: The HSL product line covers DI, DO, AI, AO, relays, thermocouples, and motion control modules, reducing the variety of spare parts on a unified platform.
Key points when replacing discontinued modules:
Confirm the number and type of I/O points in the original system, and select the corresponding model (if originally 16 output, it can be upgraded to DO32 to increase margin).
Check the output polarity (NPN vs PNP) to ensure compatibility with the on-site load.
Recalculate the scanning cycle to ensure real-time requirements are met.
Fully test the new module using the LinkMaster tool before putting it into production.
