5 program to retrieve 920i hardware configuration – Rice Lake iRite IDE User Manual
Page 94

90
920i
Programming Reference
GetImage(fieldbus_no : integer; var data : BusImage) : SysCode
This call returns an array of data as received from the fieldbus. As only the data elements received on the fieldbus
are changed in a GetImage call, the array should be initialized prior to the GetImage call. The fieldbus_no is
the number returned by an EventPort call from within the BusCommandHandler.
SetImage(fieldbus_no : integer; var data : BusImage) : SysCode
This call writes data to the fieldbus chip for access on the next cycle of the PLC. All data elements of the data
array should be properly set before calling SetImage. The fieldbus_no is the number returned by an
EventPort call from within the BusCommandHandler.
Example BusCommandHandler Code
--------------------------------------------------------
-- Handler Name : BusCommandHandler
-- Created By : Rice Lake Weighing Systems
-- Last Modified on : 1/16/2003
--
-- Purpose : Example handler skeleton.
--
-- Side Effects :
--------------------------------------------------------
handler BusCommandHandler;
--Declaration Section
busPort : integer;
data : BusImage;
i : integer;
result : SysCode;
begin
-- Clear out the data array.
for i := 1 to 32 loop
data[i] := 0;
end loop;
-- Find out which port (which bus card) started this event.
busPort := EventPort;
-- Then read the received data.
result := GetImage(busPort, data);
-- Test result as desired
-- Data interpretation and manipulation goes here.
-- Finally, put the changed data back.
result := SetImage(busPort, data);
-- Test result as desired
end;
6.5
Program to Retrieve 920i Hardware Configuration
The HARDWARE serial command (see Section 10 of the
920i
Installation Manual, PN 67887) returns a list of
coded identifiers to describe which option cards are installed in a
920i
system. The following program provides a
similar function by deciphering the coded values returned by the HARDWARE command and printing a list of
installed option cards.
The largest
920i
system configuration (CPU board plus two six-card expansion boards) can support up to 14
option cards; the following program builds a 1 x 14 array by searching each slot for an installed option card then
printing a list of slots and installed cards.