User manual
PMAC User Manual
Making Your Application Safe 123
Program Checksums
PMAC continually computes the checksum of its internal program (firmware) as a background task.
Each time it has computed the checksum, it compares this value to a reference register in memory
(X:$07B1) that has been manually entered with the correct value. PMACs shipped from the factory are
preloaded with the correct reference value for that firmware version at the factory.
Firmware Checksum
If PMAC detects a mismatch between its calculated checksum and the reference checksum, it sets global
status bits (bits 12 and 13 of X:$0003 — accessible with the ??? command) and stops performing any
checksum operations. This leaves the calculated value frozen in the running checksum register X:$0794.
PMAC does take any other action in the event of a firmware checksum error; it is up to the host or a
PMAC PLC program to decide what action to take.
When a PMAC is upgraded to new firmware by replacement of the PROM IC in standard CPU sections
or downloading of new firmware into the flash EEPROM IC in Option CPU sections, the reference
checksum value will be wrong initially for the new firmware. The easiest way of getting the proper
reference checksum value is to re-initialize the card with a $$$*** command, which automatically loads
the firmware's checksum value into the reference register. To make this change permanent, the SAVE
command should be issued before a power-off/reset of PMAC.
To update the reference checksum value without re-initializing the card, it is possible to utilize the fact
that the running checksum register X:$0794 has the last calculated value frozen in it when there is a
mismatch. Therefore, the proper checksum value for the new version can be read with the command
RHX:$0794, and the returned value can be written to the reference register X:$07B1.
User-Program Checksum
PMAC continually computes the checksum of the fixed user program buffers as a background task. Each
time it has computed the checksum, it compares this value to the checksum value that was computed the
last time one of these buffers was closed.
If PMAC detects a mismatch between these two checksums, it sets a global status bit (bit 13 of X:$0003
accessible with ???) and stops performing any program checksum operations (communications
checksum is independent). It does not shut down operation automatically. It is up to the host or a PMAC
PLC program to decide what action to take if there is a checksum error.
Communications Data Integrity Features
PMAC provides a variety of techniques for ensuring valid transmission of data, including serial parity
checking, framing error checking, serial full-duplex communications, and bi-directional checksum
computation on both serial and bus communications. For more details on how these techniques work,
refer to the Writing a Host Communications Program section in this manual.