User manual

SPI API reference
35 © 2007-2010 Analytica GmbH
SPISetGlobals
SPISetGlobals — Sets the global settings, which are to be used on the AnaGate SPI.
Syntax
#include <AnaGateDllSPI.h>
int SPISetGlobals(int hHandle, int nBaudrate, unsigned char nSigLevel,
unsigned char nAuxVoltage, unsigned char nClockMode);
Parameter
hHandle Valid access handle.
nBaudrate The baud rate to be used. The values can be set individually, like
500.000 for 500kBit
1.000.000 for 1MBit
5.000.000 for 5MBit
Note
The required baud rate can be different from the value actually used because
of internal hardware restrictions (frequency of the oscillator). If it is not
possible to adjust the baud rate exactly to the parsed value, the nearest smaller
possible value is used instead.
nSigLevel The voltage level for SPI signals to be used. Following values are allowed:
0 = Outputs in High Impedance Modus (Standard mode).
1 = +5.0V for the signals.
2 = +3.3V for the signals.
3 = +2.5V for the signals.
nAuxVoltage The voltage level of the support voltage to be used. Following values are allowed:
0 = support voltage is +3.3V.
1 = support voltage is 2.5V.
nClockMode The phase and polarity of the clock signal. Following values are allowed:
0 = CPHA=0 and CPOL=0.
1 = CPHA=0 and CPOL=1.
2 = CPHA=1 and CPOL=0.
3 = CPHA=1 and CPOL=1.