sorry... my initialization is in another file. I've copied and pasted where it's initialized and i included the rest of the function. For lack of NDA purposes i can't post the entire code. Thanks for taking a look
Header file for initialization:
************************************************** ***************************
*
* DLL library global variables
*
************************************************** ****************************/
// in PDAQ_PCI_access.c
Code:
extern ViAddr pdaq_fpga_base_addr;
reflecting comment that it is used in PDAQ_PCI_access.c, here is the code snippet from there:
/************************************************** ***********************
* Local Global variables
************************************************** ************************/
Code:
unsigned long int pdaq_pci_bar2_size = 0x80000;
unsigned long int pdaq_pci_bar3_size = 0x100;
unsigned long int pdaq_pci_bar0_size = 0x100;
ViAddr pdaq_plx_base_addr;
ViAddr pdaq_fpga_base_addr;
ViAddr pdaq_cpld_base_addr;
ViSession defaultRM, PDAQ3_PLX_FPGA, PDAQ3_PLX_CPLD, PDAQ3_PLX_REGS, ACQ_PC;
The entire void function where it is used:
/************************************************** ***************************
*
* Name : acquire_dc_voltage()
*
* Description :
* Aquire DC voltage reading from ECG ADC and returns measured value
* to TestStand
*
* Inputs :
*
* Outputs :
*
************************************************** ***************************/
Code:
void acquire_dc_voltage( CAObjHandle TS_seqContextCVI, double which_voltage,
double *measured_value,
char reportText[1024], short *errorOccurred,
long *errorCode, char errorMsg[1024] )
{
ERRORINFO errorInfo;
switch( (int)which_voltage ) // DANGER...int cast may delete lower bits
{
case ECG_MUX_SEL_AVDD3V :
// set ADC mux to AVDD3V
*(pdaq_fpga_base_addr + OFFSET_ECG_MUX_SEL_REG) = ECG_MUX_SEL_AVDD3V;
// start ADC conversion
// wait for done...if stalled, report error and break
// read value
// add/subtract offset/gain value (AGND reading)
break;
default :
*errorOccurred = TRUE;
*errorCode = -1;
sprintf( errorMsg, "ERROR: illegal DC voltage requested \n"
"voltage select number s/b 0 to 15, requested = %05d",
(int)which_voltage );
sprintf( reportText, "ERROR: illegal DC voltage requested \n"
"voltage select number s/b 0 to 15, requested = %05d",
(int)which_voltage );
return;
}; // end switch( which_voltage )