6100 MPS-B Programming Manual

6100 MPS-B PROGRAMMING EXAMPLE
?PAGE "PROCEDURE DEFINE^POLL^LISTS"
INT PROC define^poll^lists;
BEGIN
LITERAL continuous = 0,
entry^size = 5,
num^stations = 3,
slow^intervl = 500; ! slow poll interval = 5 seconds
STRUCT .poll^list;
BEGIN
INT poll^type;
STRING poll^entry^size,
select^entry^size;
STRUCT station^index [0 : num^stations - 1] ;
BEGIN
STRING poll^entry [0: (entry^size * 2) - 1] ;
END;
END;
STRUCT .slow^poll^list;
BEGIN
STRUCT station^index [0 : num^stations - 1] ;
BEGIN
STRING slow^poll^entry [0:1];
INT poll^interval;
END;
END;
! define the poll list
poll^list.poll^type := continuous;
poll^list.poll^entry^size := entry^size;
poll^list.select^entry^size := entry^size;
poll^list.STATION^index[0].poll^entry ’:=’
[ EOT, "11p", ENQ, ! station 0 poll entry
EOT, "11q", ENQ ] ; ! station 0 select entry
poll^list.station^index[1].poll^entry ’:=’
[ EOT, "22p", ENQ, ! station 1 poll entry
EOT, "22q", ENQ ] ; ! station 1 select entry
poll^list.station^index[2].poll^entry ’:=’
[ EOT, "33p", ENQ, ! station 2 poll entry
EOT, "33q", ENQ ] ; ! station 2 select entry
@sp := @poll^list ’<<’ 1;
req^buff.text ’:=’ sp FOR (num^stations * entry^size * 2);
CALL request (poll, define^list,
4 + (num^stations * entry^size * 2) );
! if poll list can’t be defined, then RETURN
B-12