![](/media/cache/profiles/0d924f0e6b3fd0d91074c22727a53966.50x50_q85.jpg)
This program outputs the voltage to a DA converter and inputs it into AD converter and displays it to LCD. The voltage changes it to 3.3V by a 0.033 volts step from 0 volts and displays it every 0.5 seconds. DA port is p18. AD port is p20. It is necessary to short-circuit with a wire in p18 and p20 before executing a program. The voltage that output to a DA converter is displayed by the first line of the LCD. The voltage that read with AD converter is displayed by the second line of the LCD. See: http://blogs.yahoo.co.jp/jf1vrr_station/19783647.html (Japanese)
Revision 0:de8d0a89c229, committed 2011-04-16
- Comitter:
- jf1vrr
- Date:
- Sat Apr 16 11:17:07 2011 +0000
- Commit message:
- Rev.0.01A 2011/04/16
Changed in this revision
diff -r 000000000000 -r de8d0a89c229 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Sat Apr 16 11:17:07 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#e4cb7ddee0d3
diff -r 000000000000 -r de8d0a89c229 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Apr 16 11:17:07 2011 +0000 @@ -0,0 +1,33 @@ +/* This program outputs the voltage to a DA converter +and inputs it into AD converter and displays it to LCD. +The voltage changes it to 3.3V by a 0.033 volts step +from 0 volts and displays it every 0.5 seconds. +DA port is p18. AD port is p20. It is necessary to +short-circuit with a wire in p18 and p20 before +executing a program. The voltage that output to a +DA converter is displayed by the first line of the LCD. +The voltage that read with AD converter is displayed +by the second line of the LCD. +*/ +#include "mbed.h" +#include "TextLCD.h" + +TextLCD lcd(p24, p26, p27, p28, p29, p30); + +AnalogOut daval(p18); +AnalogIn adval(p20); + +int main() { + //lcd.printf("Analog out test\n"); + while(1) { + for(float i=0.0; i<1.0; i+=0.01) { + lcd.locate(0,0); + lcd.printf("D/A out %0.2fV",i*3.3); + daval = i; + wait(0.05); + lcd.locate(0,1); + lcd.printf("A/D in %0.2fV",adval.read()*3.3); + wait(0.5); + } + } +}
diff -r 000000000000 -r de8d0a89c229 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Apr 16 11:17:07 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912