Delta Tau GEO BRICK LV User Manual

Page of 440
 
Turbo PMAC User Manual 
384 
Writing a Host Communications Program 
Multi-Line Responses 
A command to Turbo PMAC, such as LIST PROG 1 (report contents of motion program 1), that calls 
for a multi-line text response, if valid will get multiple text-line responses each terminated by a <CR>, 
followed by a single <ACK> character at the end.  If it is invalid, Turbo PMAC will respond with a 
<BELL> character instead. 
Variations 
Error Reporting 
If Turbo PMAC variable I6 is set to 1 or 3, after Turbo PMAC responds to an invalid command with a 
<BELL> character, it will send an error code, such as ERR004, as well to inform the host why the 
command was rejected. 
Checksums 
If Turbo PMAC variable I4 is set to 1 or 3, Turbo PMAC will report the checksums it computes for both 
commands from the host and response lines to the host.  The checksum byte for the command is returned 
immediately after the <ACK> character.  The checksum byte for each response line is returned 
immediately after the <CR> character that terminates that line.  Note that Turbo PMAC does not compare 
any checksums for validity; it is up to the host computer to evaluate the validity of checksums for both 
commands and responses. 
It is possible to evaluate the checksum of a text command sent to Turbo PMAC before that command is 
executed.  After the characters of the command have been sent, but before the <CR> character that causes 
its execution is sent, the host computer can send the <CTRL-N> command.  This causes Turbo PMAC to 
compute the checksum of the pending command and to return the checksum byte to the host computer.  If 
the host evaluates the checksum as valid, it can then send the <CR> to cause execution of the command.  
If it evaluates the checksum as invalid, it can then send the <CTRL-X> character to clear out the 
command, and then re-transmit the command.  If I4 is set to 1 or 3, Turbo PMAC will also report the 
checksum of the command as part of the acknowledgement. 
Checksums are mainly intended for serial communications; they are not supported for dual-ported RAM 
communications. 
Clearing the Port 
Sending the <CTRL-X> character over a port to the Turbo PMAC causes Turbo PMAC to clear out both 
the command and response queues for that port.  A <CTRL-X> should be sent before a command any 
time the communications software is not sure of the state of the port, as when starting the program, after a 
communications error, or when sharing the port with another routine that is independently 
communicating.  If I63 is set to 1, Turbo PMAC will respond with a <CTRL-X> character when it is 
finished clearing the ports.  The clearing routine should also attempt to read a character from the port 
register itself in case one has already been moved there from the response queue. 
Unsolicited Messages 
It is possible for Turbo PMAC to send text strings to the host computer without the host first sending a 
command, using the SENDx or CMDx statements from within a motion or PLC program.  (If these 
statements are not used, Turbo PMAC will communicate to the host only in response to a host command.)  
These unsolicited messages are a powerful feature, but have the potential to confuse communications 
routines if not adequately prepared for, because it is possible for this message to come when the host is 
expecting the response to a command. 
If Turbo PMAC variable I64 is set to 1, any unsolicited message is preceded with a <CTRL-B> character.  
This permits the host to distinguish the unsolicited message from a command response and to act 
accordingly.  If expecting unsolicited messages, it is a good idea not to use <CTRL-X> port clearing, 
because that can easily erase an unsolicited message.