Example of communication with Landis&Gyr devices of PRV1/2 type

Example is placed in the folder: /Pm/Examples/Commun/LandisGyr_PRV. It is the communication when the PC station is the Master and the Landis&Gyr is the Slave. For simple understanding the example, the knowledge about the PmComm and PmCommMsg Promotic object is needed.
The exampe has one panel opened from PmWorkspace after application launch - it is defined on the Frames page in the "main" frame edited in the Viewer of component configurator. There are buttons in the panel that launch the PmFolder methods via the onButtonUp event. All reports are stored by Debug method in the INFO system Debug_info item. A large amount of important information can also be found in COMM INFO item (statistics, the content of currently transmitted data, etc.) and also in the PmRoot INFO item.
Setting parameters for the serial link in the Landis&Gyr device:
TTY2.BDC: 4800 comm.speed
TTY2.BD: 9600 comm.speed with the terminal
TTY2.WKEN: 0 length 8 data-bits
TTY2.SSB: 0 number of stop-bits 1
TTY2.PAR: 0 without parity
TTY2.NOEC: 0 no echo
TTY2.NOX: 0 XON/XOFF synchronization
TTY2.NCON: 0 response to a control char
TTY2.NESA: 0 suppression of an Escape-sequence
TTY2.NFCR: 0 sets <CR><LF> at the end of line
TTY2.NWCR: 0 sets <CR><LF> at the beginning
TTY2.MOD: 1 communication mode
TTY2.ATMO: 0 timeout
Parameters of the serial link set in PROMOTIC example:

COM1, speed 9600, 8 data-bits, without parity, 1 stop-bit.

General information:

Setting and programming of PRV2 is the matter of the programmer of Landis&Gyr who should inform about the configuration of PRV2 by individual modules including addresses and structures of variables defined by him.

It is possible to query these modules and structures by the default commands (see the examples), for example:

$xxx.HW - query to the value of the module parameter on the xxx address
$xxx.SB - query to the binary value of the module parameter on the xxx address
Communication itself:
a) Query: the CR char (13 decimal)
b) Response (in ASCII): command + data block that includes the response to the query terminated by the CR char
List of messages in example: (the most messages can be run from toolbar)
Name: Command:
m02TIME response: current time ("TIME"<CR><LF>"12:00:57"<CR>)
m03DATE response: current date ("DATE"<CR><LF>"03-JAN-99"<CR>)
m04$001.HW response: value of the parameter HW I/O address 001 ("$001.HW"<CR><LF>"28.45"<CR>)
m05$010.SB response: value of the SB(binary) address 010 ("$010.SB"<CR><LF>"0"<CR>)
m06$010.SB=1 action: writing "1" to the SB address 010 ("$010.SB=1"<CR>)
m07PLT2.HW response: value of the parameter HW structure PLT2 ("PLT2.HW"<CR><LF>"1"<CR>)
m08PLT2.PAR1=50 action: writing PAR1 into the structure PLT2 ("PLT2.PAR1=50"<CR>)
m09PLT2.PAR1 response: value PAR1 of the structure PLT2 ("PLT2.PAR1"<CR><LF>"50"<CR>)
m10[10]W(1,5) response: value of the variable W of the task 10 with the matrix index 1,5 ("[10]W(1,5)"<CR><LF>"32"<CR>), Blocked - dangerous command
m11[10]Tv=15 action: writes "15" into variable Tv in task 10 ("[10]Tv=15"<CR>), Blocked - dangerous command
  list tty2 getting the information about setting parameters of the serial link in Landis&Gyr
Important warnings:
- test examples will function only when addesses are correctly modified according to setting PRV2
- writing of values needs to be done only to parameters (addresses) and structures that are meant for it
- any wrong writing into the memory PRV2 is very risky and it can cause overwriting of the code in PRV2 !!!
- in case of a wrong syntax, the device returns the error char 08H.
- the data item itself can be read from the received data, for example, by the PmCommMsg.ReadVars property.
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice