05-04 LoggingData
From Manuals
(Difference between revisions)
(Created page with 'This example reads an analog voltage and transfers the reading to a terminal running on a personal computer. /*Program Example 5.4: Reads input voltage through the ADC, and tr…') |
|||
| Line 1: | Line 1: | ||
This example reads an analog voltage and transfers the reading to a terminal running on a personal computer. | This example reads an analog voltage and transfers the reading to a terminal running on a personal computer. | ||
| + | The signals used for this example are listed below: | ||
| + | {| border="1" cellpadding="5" cellspacing="2" align="center" style="text-align: center;" | ||
| + | |+ align="bottom"|'''Signals Used and Connector Locations for Example 05-04''' | ||
| + | |'''Signal''' | ||
| + | |'''LPC4330 PIN NAME''' | ||
| + | |'''BAM210E''' | ||
| + | |'''BAM210''' | ||
| + | |'''BAM200E''' | ||
| + | |'''BAM200''' | ||
| + | |'''Used for''' | ||
| + | |- | ||
| + | |A0 | ||
| + | |P7_4 | ||
| + | |J8-1 | ||
| + | |J8-1 | ||
| + | |S4-3 | ||
| + | |S4-3 | ||
| + | |Potentiometer | ||
| + | |- | ||
| + | |} | ||
| + | |||
| + | The following schematic can be used to build the circuit with a BAM210E or BAM210. | ||
| + | [[Image:BAM210_05_04_SCH.png|center|alt=BAM210|frame|<div align="center">'''Schematic for example 05-04''']] | ||
| + | |||
| + | <div style="text-align: left;"> | ||
/*Program Example 5.4: Reads input voltage through the ADC, and transfers to PC terminal | /*Program Example 5.4: Reads input voltage through the ADC, and transfers to PC terminal | ||
*/ | */ | ||
| Line 17: | Line 42: | ||
} | } | ||
} | } | ||
| + | The terminal window was captured in the image below. | ||
| + | [[Image:BAM210_05_04.png|center|]] | ||
| + | The following image shows the built circuit on a BAM210E. | ||
[[Image:BAM210_LoggingData.jpeg|center|]] | [[Image:BAM210_LoggingData.jpeg|center|]] | ||
| - | |||
| - | |||
| - | |||
Revision as of 19:37, 17 September 2014
This example reads an analog voltage and transfers the reading to a terminal running on a personal computer.
The signals used for this example are listed below:
| Signal | LPC4330 PIN NAME | BAM210E | BAM210 | BAM200E | BAM200 | Used for |
| A0 | P7_4 | J8-1 | J8-1 | S4-3 | S4-3 | Potentiometer |
The following schematic can be used to build the circuit with a BAM210E or BAM210.
/*Program Example 5.4: Reads input voltage through the ADC, and transfers to PC terminal
*/
#include "mbed.h"
Serial pc(USBTX, USBRX); //enable serial port which links to USB
AnalogIn Ain(A0);
float ADCdata;
int main() {
pc.printf("ADC Data Values...\n\r"); //send an opening text message
while(1) {
ADCdata=Ain;
wait(0.5);
pc.printf("%1.3f \n\r",ADCdata); //send the data to the terminal
}
}
The terminal window was captured in the image below.
The following image shows the built circuit on a BAM210E.


