User's Manual

UMAC Turbo CPU/Communications Board Hardware Manual
Using DPRAM 28
USING DPRAM
If Option-2B is ordered, the UMAC Turbo CPU/Communications Board contains its own on-board
DPRAM. This DPRAM can be used for automatic reporting features or as a general-purpose scratch pad
area for custom data.
DPRAM for General Purpose Scratch Pad Data
The UMAC Turbo CPU/Communications Board can write to any DPRAM memory location. Use M-
Variables to point to an area in the $60000-$60FFF address range. However, unpredictable results
will occur if writing to the areas that are used for the DPRAM automatic reporting features. The
automatic reporting features memory area can be determined from the Turbo Software Reference Manual
by examining the address in the $60000-$60FFF; however, when using the UMAC Turbo
CPU/Communications Board, this range is from $60000-$60FFF. Start the variables at the $60D60;
this address is well outside the range of the automatic reporting features. Below is an example of pointing
to a series of DPRAM locations on the USB card and the count:
M1000->DP:$60D60 PmacDprGetMem(0,0x3580,4,&dwData)
M1001->Y:$60D61 PmacDprGetMem(0,0x3584,2,&wData1)
M1002->X:$60D61 PmacDprGetMem(0,0x3586,2,&wData2)
M1003->F:$60D62 PmacDprGetMem(0,0x3586,4,&fData)
The parameters passed to the function PmacDPRGetMem are:
The device number for the case of multiple devices
The DPRAM offset
The number of bytes to retrieve
The location to place the retrieved bytes
The DPRAM offset is the number of bytes from the base DPRAM location. To compute this value, take
the UMAC Turbo CPU/Communications Board DPRAM address and multiply its offset by 4. The offset
is always the last three digits of the DPRAM address. For example, for the address $60D60, multiply
$D60 by 4 to compute the offset; the offset for UMAC Turbo CPU/Communications Board address
$60D60 is 0x3580. For X memory address, the same applies, except that 2 must be added to the offset
calculation.
It is not wise to call PmacDprGetMem for each item of data, due to the structure of USB. The reason is
that each call can take 1 msec, but so would a single call getting all the data. More efficient coding would
be as follows:
Typedef struct {
DWORD dwData;
WORD wData1;
WORD wData2;
Float fData;
} Data;
PmacDprGetMem(0,0x3580,12,&Data);
Setting DPRAM for Automatic Reporting Features
To enable the DPRAM Automatic reporting features requires that the DPRAM automatic features for the
device must be activated. To do this from Pewin Pro, go to the Setup Menu Item and select the General
Setup and Options Menu Item. Then click the Select button from the Default Device tab of the General
Setup and Options dialog box.
The PMAC Devices dialog will appear from the list box. Highlight the appropriate device. Then click
the Properties button to open a dialog box that is used to enable the DPRAM features.