/*********************************************************************/
/* | unsigned char SetSPAScale(unsigned long ReferenceLevel, | */ | ||
/* |
| unsigned long dBScale, | BYTE *ResponseBytes) | */ |
/* | Description: This function implements control byte #101, Set | */ | ||
/* |
| Spectrum Analyzer Scale. It | sets the spectrum | */ |
/* |
| analyzer reference level and | scale (dB/div). | */ |
/* | Inputs : | RefLevel = reference level value | */ | |
/* |
| dBScale = scale value |
| */ |
/* |
| NOTE: This function assumes | the values have | */ |
/* |
| already been checked to fall | in the valid range | */ |
/* |
| and scaled according to the formulas in the | */ | |
/* |
| Programming Manual. |
| */ |
/* |
| ResponseBytes = pointer to an array of bytes at | */ | |
/* |
| least 1 element long (1 byte | is expected in | */ |
/* |
| response to the Set Spectrum | Analyzer Scale | */ |
/* |
| command). |
| */ |
/* | Returns: | SUCCESS if the values are set |
| */ |
/* |
| FAILURE if the command fails |
| */ |
/* |
| Response bytes are returned in the variable | */ | |
/* |
| ResponseBytes. |
| */ |
/*********************************************************************/ unsigned char SetSPAScale(unsigned long RefLevel,
unsigned long dBScale, BYTE *ResponseBytes)
{ |
|
|
BYTE | *SendScalePointer; | // Data to send |
BYTE | SendBytes[9]; |
|
BYTE SerialCommand;
//Serial Command to Set Scale on the SPA. SerialCommand = 101;
//Data pointer.
SendScalePointer = &SendByte[0];
//First byte to send is the serial command, #101. SendBytes[0] = SerialCommand;
//Convert the reference level and scale into 8 bytes
//(4 bytes each) for the SPA. Put the bytes in the
//SendBytes variable, starting with byte 1 (leave byte 0
//as the command byte).
Get8Bytes(RefLevel, Scale, &SendBytes[1]);
// Write 9 bytes of data in SendScalePointer to the port.
Site Master PM | 109 |