Delta Tau GEO BRICK LV User Manual

Page of 440
 
Turbo PMAC User Manual 
422 
Writing a Host Communications Program 
Real-Time Data Gathering Through the Dual-Ported RAM 
Using the dual-ported RAM, it is possible to perform Turbo PMAC’s data gathering function and upload 
the gathered data to the host computer in real time.  (The standard data gathering function – used by the 
PMAC Executive Program to produce plots – performs the data gathering in real time, storing to open 
regular RAM in Turbo PMAC, then uploads to the host afterwards.)  This real-time uploading requires 
tight handshaking between the host and Turbo PMAC to ensure that the data is passed reliably and 
efficiently. 
It is possible in some Turbo PMAC systems, particularly in UMAC systems, that multiple DPRAM ICs 
be present.  Data gathering is possible only to the DPRAM IC whose Turbo PMAC base address is 
specified in I24.  If I24 is set to 0, the DPRAM IC whose Turbo PMAC base address is $060000 is used. 
Setting Up 
The DPRAM data gathering function is set up the same way as for the standard data gathering function, 
with Turbo PMAC I-Variables I5001 – I5051 controlling what data is to be gathered and how often.  To 
specify data gathering into the DPRAM, I5000 should be set to 3 (it is set to 0 for the standard gathering). 
The buffer for temporary storage of the gathered data is established by the DEFINE GATHER 
{constant}
 command, where {constant} is the size of the buffer in Turbo PMAC words (each 
Turbo PMAC word is 32 bits in the DPRAM).  The buffer always starts at Turbo PMAC address offset 
$0450 from the beginning of DPRAM (address $060450 with the default DPRAM base address of 
$060000), which from the host side is DPRAM base address plus 0x1140 (4416 decimal) bytes.  Each 
short data source occupies one 32-bit word in the buffer; each long data source (fixed-point or floating-
point) occupies two 2 32-bit words.  You must set the size of the buffer based on the number and length 
of the data sources, and the worst-case number of gathering cycles that the host could fall behind in 
reading data from the DPRAM.  This size must not be greater than 2500 for the 8Kx16 DPRAM.  Typical 
sizes are 20 to 100 words. 
The DPRAM gathering function is started and stopped the same as for the standard gathering: either with 
the GATHER and ENDGATHER (ENDG) commands, or by setting and clearing the data-gather control bits 
directly through M-variables. 
Getting the Data 
Once the gathering function has begun, the host must monitor registers in the DPRAM that contain 
pointers to the data that has been loaded into the DPRAM.  There are two key registers, and only one of 
these needs to be read repeatedly.  At the DPRAM base address plus 0x113E (4414 decimal) is the 
pointer to the end of the buffer.  This value is determined by the DEFINE GATHER command and will be 
fixed for a given application.   
At the DPRAM base address plus 0x113C (4412 decimal) is the pointer to the next address where 
gathered data will be placed in DPRAM.  It is this register that the host should monitor repeatedly to see 
if it has changed -- meaning that new data has been placed in the DPRAM -- and if it has changed, how 
many times data has been placed. 
Both of these registers contain a Turbo PMAC memory word address – actually the offset from the start 
of the gather buffer ($0450 from the start of DPRAM itself).  To translate into a host memory byte 
address, the following equation should be used: 
 
Host_address = (DPRAM_base_address + 0x1140) + 4 * (Pointer_value) 
The value of the storage pointer will wrap back to 0 (Turbo PMAC address {DPRAM base +$0450}) 
when it becomes greater than or equal to the value of the buffer-end pointer.  No item will be stored in the 
DPRAM starting at the Turbo PMAC word address shown by the buffer-end pointer, although if a long 
item would start to be stored in the previous DPRAM word, the second half would be placed in the actual 
buffer-end word.