|
catalogue search
|
You may also be interested in
Controller, Evaluation kit, Wireless LAN controller, Microcontroller, PCI
Text version of the page
15.1.4 Programming ExampleThe following example illustrates data logging using the ADC1 input channel.Programming Example PRIVATE void vAdcDataLogger(uint16 *pau16DataBuffer, uint32 u32Length) { int i; /* configure Analogue Peripheral timings, interrupt & ref voltage */ vAHI_ApConfigure( E_AHI_AP_REGULATOR_ENABLE, E_AHI_AP_INT_DISABLE, E_AHI_AP_SAMPLE_2, E_AHI_AP_CLOCKDIV_500KHZ, E_AHI_AP_INTREF); while (!bAHI_APRegulatorEnabled); /* configure & enable DAC */ vAHI_AdcEnable(E_AHI_ADC_CONTINUOUS, E_AHI_AP_INPUT_RANGE_1, E_AHI_ADC_SRC_ADC_1); while(TRUE) { for (i=0;iIEEE802.15.4 / ZigBee Wireless MicrocontrollersR - 34237 15.2 Digital to Analogue ConverterThe Digital to Analogue Converter (DAC) provides two output channels and is capable of producing voltages of 0 to Vref or 0 to 2Vref where Vref is selected between the internal reference and the VREF pin, with a resolution of 11 bits and a minimum conversion time of 72µsecs (250kHz clock).15.2.1 OperationThe output range of each DAC can be set independently to swing between 0V to either the reference voltage or twice the reference voltage. The reference voltage is selected from the internal reference or the VREF pin. For example an external reference of 0.8V supplied to VREF may be used to set DAC1 maximum output of 0.8V and DAC2 maximum output of 1.6V. The DAC output amplifier is capable of driving a capacitive load up to that specified in section 17.3.8. Programmable clock periods set withvAHI_ApConfigure()allow a trade-off between conversion speed and resolution. The full 11-bit resolution is achieved with the 250kHz clock rate. See section 17.3.7, electrical characteristics, for more details. 44 JN-DS-JN5121 v1.8 © Jennic 2007 Preliminary a constant current through a forward biased diode to provide a voltage output proportional to the chip die temperature which can then be measured using the ADC. The measured voltage has a linear relationship to temperature as described in section 17.3.10. Because this sensor is on-chip any measurements taken must account for the thermal time constants. For example if the device just came out of sleep mode the user application should wait until the temperature has stabilized before taking a measurement. |