RMCLink C++ Wrapper Class CRMCLink::MakeRMCAddr Method |
Creates a L register value that corresponds to a reference to another file:element register. This is used when writing to RMC70, RMC150, or RMC200 registers that refer to another register, such as in the Indirect Data Map or Plot Configuration.
C++ |
static long MakeRMCAddr( UINT file, UINT element ); |
file
File number of the address to be created. See the RMCLink Address Map for details.
element
Element number of the address to be created. See the RMCLink Address Map for details.
The long typed return value has the file value in bits 12-23 and element value in bits 0-11.
Some RMC70, RMC150, or RMC200 registers are defined as holding addresses of other RMC registers. These registers are used as indirect references to other registers that can be changed. The two primary places where such reference registers are used are the Indirect Data Map and the Plot Configuration. For example, the Indirect Data Map holds the addresses of other registers, and the resulting sequence of register addresses is used to control which actual registers are accessed by reads from and writes to the Indirect Data Values file. The same is true with the Plot Configuration data registers, in which the addresses in these registers determine which registers will be plotted.
The following code example illustrates the use of the MakeRMCAddr method.
C++ |
#include <windows.h>
#include <stdio.h>
#include "RMCLink.h"
void main()
{
// In order to create COM objects, we must initialize the COM sub-system.
::CoInitialize(0);
// Create a new RMCLink object.
CRMCLink* pRMC = CRMCLink::CreateEthernetLink(CRMCLink::dtRMC70, _T("192.168.0.22"));
if ( pRMC != NULL )
{
// Establish the connection.
HRESULT hr = pRMC->Connect();
if ( SUCCEEDED(hr) )
{
// Set up the Indirect Data Map by writing the addresses of the
// registers we want in the first four Indirect Data locations.
long alIDM[4];
alIDM[0] = MakeRMCAddr(8,0); // 8:0 = Axis 0 Status Bits
alIDM[1] = MakeRMCAddr(8,1); // 8:1 = Axis 0 Error Bits
alIDM[2] = MakeRMCAddr(8,8); // 8:8 = Axis 0 Actual Position
alIDM[3] = MakeRMCAddr(8,53); // 8:53 = Axis 0 Target Position
hr = pRMC->WriteLFile(CRMCLink::fn70IndDataMap, 0, 4, alIDM);
}
// Free the RMCLink object we created.
delete pRMC;
}
// Release the COM sub-system.
::CoUninitialize();
}
|
See Also
CRMCLink Class | RMCLink C++ Wrapper Class
Copyright (c) 2024 Delta Computer Systems, Inc. dba Delta Motion