Hi.
I installed PascalScada version 0.7.3 2014-03-12 on my Lazarus version 1.0.10.
My operating system is Lubuntu Linux.
I have a USB to RS485 converter connected to ABB energy meter DMTME.
I tested the electrical connection with a C program ad a Modbus library (libmodbus).
The serial port is configured with 9600 bps, 8 data bits, 1 stop bit, no parity.
I created a Lazarus project with "SerialPortDriver" and in the objected inspector I inserted the same parameters.
I inserted a "ModbusRtuDriver" and set the CommunicationPort property to "SerialPortDriver1".
I inserted three tags with the address 4096, 4097, 4098.
I cannot see data on the three tags.
I insert a breakpoint in the event "TForm1.SerialPortDriver1CommPortOpened", but is never reached.
Can you help me?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Check if you have the following components in your application and their settings:
1 x TSerialPortDriver (with your serial settings and Active property must be true, Parity is the property Paridade, this is a translation error. )
1 x TModbusRTUProtocol (linked with Serial Port Component and set ReadSomethingAlways = false)
3 x TPLCTagNumber: one for each modbus register. In each tag you must set:
** PLCstation: the address of your modbus device
** MemReadFunction: 3 to read registers of 4xxxx area
** MemWriteFunction: 16 to write in registers of 4xxxx area
** MemAddress: 96, 97 or 98. One for each tag (TPLCTagNumber)
** UpdateRate = the time in milliseconds to update the tag value.
** TagType: pttDefault, pttWord or pttSmallInt. pttDefault=pttWord when using Modbus. pttSmallInt works with negative numbers (-32768..32767)
** ScaleProcessor: If your tags will work with decimal, insert into your application a TLinearScaleProcessor, setup it as you needs, and link it with your tags. Note that the LinearScaleProcessor can be shared across multiples tags that use the same scale.
** ProtocolDriver: link your tags with your ModbusRTUProtocolDriver
** AutoRead to true, to get the value updated automatically. Otherwise you must call read procedures of tag in the source code of your application to send values to your device.
** AutoWRite to true, to write values automatically in your device. Otherwise you must call write procedures of tag in the source code of your application to send values to your device.
3 x THMILabel and link each one with each created tag (PLCTag property). It will show the values of your tags. If you want get the value of your tags, do this in your code:
var
TagValue:Double
...
begin
...
TagValue := <your tag name>.Value;
The var must be double because of Tag. Tags can works with any numeric type.
You can put 3 x THMIEdit instead of THMILabel, but, to make more easily, set the property FreezeValueOnFocus of each THMIEdit to false.
About the CommPortOpened event, do you Actived your SerialPortDriver (active=true)?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi.
I installed PascalScada version 0.7.3 2014-03-12 on my Lazarus version 1.0.10.
My operating system is Lubuntu Linux.
I have a USB to RS485 converter connected to ABB energy meter DMTME.
I tested the electrical connection with a C program ad a Modbus library (libmodbus).
The serial port is configured with 9600 bps, 8 data bits, 1 stop bit, no parity.
I created a Lazarus project with "SerialPortDriver" and in the objected inspector I inserted the same parameters.
I inserted a "ModbusRtuDriver" and set the CommunicationPort property to "SerialPortDriver1".
I inserted three tags with the address 4096, 4097, 4098.
I cannot see data on the three tags.
I insert a breakpoint in the event "TForm1.SerialPortDriver1CommPortOpened", but is never reached.
Can you help me?
Hi!
Check if you have the following components in your application and their settings:
1 x TSerialPortDriver (with your serial settings and Active property must be true, Parity is the property Paridade, this is a translation error. )
1 x TModbusRTUProtocol (linked with Serial Port Component and set ReadSomethingAlways = false)
3 x TPLCTagNumber: one for each modbus register. In each tag you must set:
3 x THMILabel and link each one with each created tag (PLCTag property). It will show the values of your tags. If you want get the value of your tags, do this in your code:
You can put 3 x THMIEdit instead of THMILabel, but, to make more easily, set the property FreezeValueOnFocus of each THMIEdit to false.
About the CommPortOpened event, do you Actived your SerialPortDriver (active=true)?
I don't remember if modbus address notation starts from 4000 or 4001
If it starts from 4000, use the suggested MemAddress in the previous post.
If it starts from 4001, use 95, 96 and 97 in property MemAddress instead of the values suggested on previous post.