![]() |
Kinetis SDK v.1.2 Demo Applications User's Guide
Rev. 0
Freescale Semiconductor, Inc.
|
This demo application demonstrates the DAC and ADC demo.
This application demonstrates how to configure the DAC and set the output on the DAC using software. It also demonstrates how to configure the ADC in 'Blocking Mode' and read ADC values.
This demo supports these Freescale Freedom development platforms and Tower System modules:
For the MRB-KW01 it is necessary: To short jumpers J10 and J11 to connect the ADC references. To disconnect J7 to open PTE30 connection with the RESET of the RADIO part. Also analog function for PTE30 - DAC output is necessary on the mrb-kw01 (default is GPIO for RADIO part reset). This is done in hardware_init() function.
This table shows the connections that are required for each of the supported platforms. Not mentioned platforms use the internal connection.
Platform | DAC Out | ADC In | ||
---|---|---|---|---|
Pin Name | Board Location | Pin Name | Board Location | |
FRDM-K22F | DAC0_OUT | J24-11 | PTB0/ADC0_SE8 | J24-2 |
FRDM-KL25Z | PTE30/DAC0_OUT | J10-11 | PTE20/ADC0_SE0 | J10-1 |
FRDM-K64F | DAC0_OUT | J4-11 | PTB2/ADC0_SE12 | J4-2 |
FRDM-KL46Z | PTE30/DAC_OUT | J4-11 | PTE20/DIFF_ADC0_DP | J4-1 |
TWR-K21D50M | DAC0_OUT | Primary Elevator - A32 | PTB3/ADC0_SE13 | Primary Elevator - B30 |
TWR-K22F120M | DAC0_OUT | Primary Elevator - A32 | PTB0/ADC0_SE8 | Primary Elevator - B27 |
TWR-K24F120M | DAC0_OUT | Primary Elevator - A32 | ADC0_DP3 | Primary Elevator - A29 |
TWR-K60D100M | DAC0_OUT | Primary Elevator - A32 | PTB4/ADC1_SE10 | Primary Elevator - B30 |
TWR-K64F120M | DAC0_OUT | Primary Elevator - A32 | PTB4/ADC1_SE10 | Primary Elevator - B27 |
TWR-K65F180M | DAC0_OUT | Primary Elevator - A32 | ADC1_SE16 | J24-1 |
TWR-KV10Z32 | DAC0_OUT | J16-11 | PTE17/ADC0_SE5 | J16-6 |
TWR-KV31F120M | DAC0_OUT | Primary Elevator - A32 | PTE2/ADC1_SE6a | Primary Elevator - B27 |
TWR-K21F120M | DAC0_OUT | Primary Elevator - A23 | PTE2/ADC0_SE23 | Primary Elevator - B23 |
For more detailed instructions, see a Kinetis SDK User's Guide for your board.
This example shows how to run the demo:
DAC ADC Demo! Please refer to Kinetis SDK Demo Applications User's Guide document, Chapter DAC ADC demo, for pins configuration information. Press space bar to start demo.
The user is prompted to enter a voltage to output on the DAC:
Select DAC output level: 1. 1.0 V 2. 1.5 V 3. 2.0 V 4. 2.5 V 5. 3.0 V ->
After entering a valid input, the ADC captures the voltage set by the DAC and displays the result in the terminal:
Select DAC output level: 1. 1.0 V 2. 1.5 V 3. 2.0 V 4. 2.5 V 5. 3.0 V ->3
ADC Value: 2471
ADC Voltage: 1.99
What next?: 1. Test another DAC output value. 2. Terminate demo. ->
At this point, the user can test another DAC output value or terminate the demo.
This configuration exhibits up to 2% error when reading back voltage.
Prints out a welcome message and pins required by the demo.
*prevState | Pointer to previous state for state machine. |
Configures the DAC and the ADC. The DAC is configured for software updates. The ADC is set in 'Blocking Mode'.
*prevState | Pointer to previous state for state machine. |
Sets output level on the DAC.
*prevState | Pointer to previous state for state machine. |
Performs a wait and possible state change based on the *prevState.
*prevState | Pointer to previous state for state machine. |
Gets ADC values from a channel connected to the DAC output.
*prevState | Pointer to previous state for state machine. |
Deinitializes the DAC and the ADC module following a user command to terminate the demo. Also frees allocated memory.
*prevState | Pointer to previous state for the state machine. |
Indicates to the user that the demo has been terminated.
*prevState | Pointer to previous state for the state machine. |