I am trying to query a 24-year-old, scrapped power meter via RS-232C port
with ModBUS/ASCII protocol. And to be a challenge: without external
ready-made functions, with direct hardware access, in real mode, with
Turbo Pascal, on an old DOS machine.
The device to be tested was manufactured by the Hungarian DATCON Ipari
Elektronikai Kft. in the 90s. The company was founded even before the
regime change, in 1982, and has been working in the field of industrial
electronics ever since.
The device type is DT510. This is a single-phase electrical power meter.
Made in several versions, this uses RS-232C serial connection and
ModBUS/ASCII protocol for communication. In addition, it has three
configurable analog outputs.
The connection of the device is included in its datasheet.
The device can be set with its own setting program via serial port.
Measured values
Urms: effective voltage in V
Irms: effective current in A
P: active power in W
Q: reactive power in VAr
S: apparant power in VA
Wp: active power demand in Wh
Wq: reactive power demand in VArh
Ws: apparant power demand in VAh
cosφ: power factor
TPF: technical power factor
The program was written in Turbo Pascal. The source code consists of the
main program and three additional units: Unserial.pas: this unit contains the routines that manage the serial
port. The port is managed by the BIOS INT 14H interrupt. It uses the
serial port interrupt to indicate received data and to read it. Unmodbus.pas: this unit is responsible for data transfer according to
the ModBUS/ASCII protocol. Only reading the holding register (Function
code: 3) was implemented in the unit, because the others were not needed
now. The unit stores the values of all possible (9999) holding
registers. These can be referred to by the register number. It also
includes the Longitudinal Redundancy Check (LRC) calculator. Undt510.pas: this unit is responsible for converting the received raw
values into real values.