Delta Tau GEO BRICK LV User Manual

Page of 440
 
Turbo PMAC User Manual 
394 
Writing a Host Communications Program 
At this point, Turbo PMAC has taken these characters into its command queue, but has not done anything 
with them yet since no <CR> has been encountered yet.  It asserts the selected interrupt level (default is 2) 
and provides the command a receipt interrupt vector (default is $A0), which must be acknowledged.  Now 
send the next 11 characters (D through " followed by a<CR>): 
Address 
$7FA001 $7FA003 $7FA005 ... $7FA017  $7FA019 
Mailbox # 
0 1 2 
... 
11 12 
Character 
 
--- 
<CR> 
Finally, send the first character of this second (and last) group of characters, which is a "
Address 
$7FA001 $7FA003 $7FA005 ... $7FA017  $7FA019 
Mailbox # 
0 1 2 
... 
11 12 
Character 
--- 
<CR> 
Turbo PMAC again asserts interrupt level 2 and provides the command receipt interrupt vector.  Since a 
<CR> has been included, Turbo PMAC knows that the command line has finished.  Turbo PMAC now 
inserts this line into the program buffer that was previously opened (remember, in this example we were 
downloading a motion program to Turbo PMAC). 
Reading Data from Turbo PMAC-VME through the Mailbox Registers 
Now that data has been sent to Turbo PMAC-VME using the mailbox registers, determine how to read 
data from Turbo PMAC.  Reading data will involve using the interrupts and interrupt vectors generated 
by Turbo PMAC-VME over the VME bus.  In the following examples, Turbo PMAC’s base address is at 
$7FA000 and the I-variable I3 is set to 2 (the best setting of I3 for writing host communications routines). 
The key to reading data from Turbo PMAC through the mailbox registers is that writing to mailbox 
register #1 permits PMAC to place its data in the mailbox registers when it has something to say.  This 
can be done ahead of time, effectively pre-enabling Turbo PMAC’s response.  This is the strategy we use 
in all of the following examples. 
If not pre-enabling, write to mailbox register #1 only when expecting an immediate response, which is 
usually after acknowledging the $A0 interrupt (see examples).  If this is not done, Turbo PMAC will not 
interrupt with the $A1 vector.  (The only real advantage in not pre-enabling is that the middle of a long 
Turbo PMAC response can be broken to issue a command.)  Note that if using the pre-enable strategy, 
pre-enable once after power-up or reset.  Refer to the flowchart below after reading the following 
examples. 
Example 
This command line has just been sent to Turbo PMAC: #1J+<CR>.  This command line is not a request 
for any data, so Turbo PMAC will not respond with any data except an acknowledge <ACK>, signifying 
an acknowledgment of receipt of a valid command line (if an invalid command was sent, a <BELL> 
character would be sent instead of <ACK>).  In this case, Turbo PMAC will generate an interrupt, sending 
with it an interrupt vector $A0 (as we defined in I96).  After seeing this interrupt and accompanying 
interrupt vector, you (the VME master or host computer) must properly service or acknowledge this 
interrupt so that Turbo PMAC will withdraw its interrupt assertion.  (Generally, when you service any 
VME interrupt, the interrupt vector will be available.) 
Turbo PMAC will then interrupt again, this time with interrupt vector $A1 (the value of I96 plus 1), 
signifying there is new data in the mailbox registers to be read.  Now, read mailbox register #0 (at 
$7FA001) to pick up the <ACK> character put there by Turbo PMAC, but this is necessary only to verify 
that the command line just sent was received as a valid command by Turbo PMAC.  Finally, write $00 
into mailbox register #1 (location $7FA003), allowing Turbo PMAC to write new data into the mailbox 
registers if necessary (also read the next example to better understand this).  The next example shows how 
to read data written in the mailbox registers by Turbo PMAC.