projects:4e4th:4e4th:start:msp430g2553_experimente:input:rotauge
\ Das rote LED auf dem LaunchPad sieht hell und dunkel. \ Nach einer Idee von Matthias Koch; Referenz: ) hex 01B0 CONSTANT ADC10CTL0 01B2 CONSTANT ADC10CTL1 01B4 CONSTANT ADC10MEM 004A CONSTANT ADC10AE0 bin \ stetup of adc: \ FED CB A 9 8 7 6 5 4 3 2 1 0 \ 001 00 0 0 0 0 0 0 0 0 0 0 0 SREF_1 1*0x2000 VREF+ and VR- \ 000 10 0 0 0 0 0 0 0 0 0 0 0 ADC10SHT_2 2*0x800 16 x ADC10CLKs \ 000 00 0 0 0 0 1 0 0 0 0 0 0 REF2_5V 0x040 ADC10 Ref 0:1.5V / 1:2.5V \ 000 00 0 0 0 0 0 1 0 0 0 0 0 REFON 0x020 Reference on \ 000 00 0 0 0 0 0 0 1 0 0 0 0 ADC10ON 0x010 ADC10 On/Enable 0011000001110000 CONSTANT SETUPADC \ 000 00 0 0 0 0 0 0 0 0 0 1 0 ENC Enable Conversion \ 000 00 0 0 0 0 0 0 0 0 0 0 1 ADC10SC sample-and-conversion start. 0000000000000011 CONSTANT ENC+ADC10SC 0000000000000100 CONSTANT ADC10IFG hex : HELL 4 p2 cset 2 p2 cclr ; : DUNKEL 4 p2 cclr ; : ADC1X \ sample & convert 1x machen ENC+ADC10SC ADC10CTL0 cset BEGIN ADC10IFG ADC10CTL0 cget UNTIL ; : ADC+ 1 ADC10CTL0 cset ; \ Start ADC10 : ADC- 1 ADC10CTL0 cclr ; \ STOP ADC10 : ADC@ adc1x ADC10MEM @ ; \ Wert holen : ADC-INIT setupadc ADC10CTL0 cset 0 ADC10CTL1 c! \ input channel A0 1 ADC10AE0 cset \ Analog Input Enable P1.0 ; : INIT red cclr green cclr 6 p2 1+ cset \ P2.1 und P2.2 sind output 1 p1 1+ cclr \ P1.0 ist input dunkel adc- adc-init adc+ ; decimal : ROTAUGE ( -- ) base @ decimal init 3 0 DO hell 10 0 DO cr 200 ms adc@ . LOOP dunkel 10 0 DO cr 200 ms adc@ . LOOP LOOP base ! ;
projects/4e4th/4e4th/start/msp430g2553_experimente/input/rotauge.txt · Zuletzt geändert: 2014-01-22 02:30 von mka