Posted: 02:30am 17 Nov 2024 |
Copy link to clipboard |
Print this post |
|
Trying to use [run adc] command, it fails differently in V5.08, V6.00. Am I using it wrong? My reduced code is
' RUN ADC TEST PROGRAM, ADC0,1,2 ALL TIED TO ~1.6v
SetPin gp29,ain: SetPin gp28,ain: SetPin gp27,ain: SetPin gp26,ain Print Pin(GP26), Pin(GP27), Pin(GP28), Pin(GP29)
dim integer a1%(5000): dim integer a2%(5000) for i=0 to 4999: a1%(i)=0: a2%(i)=0: next i zero the arrays helps show errors adc open 10000,3 '10 kHz conversion rate adc0, adc1, adc2 only adc run a1%(),a2%() 'Ping-pong data into a1%, then a2% etc. pause 100 'This should do about 1000 conversions adc close 'Stop the ADC RUN? for i=0 to 10 ?hex$(a1%(i)) 'Print the first 10 integers = 80 of the 8 bit adc conversions next i
If I run it twice I get the following (Note, adc0,1,2 inputs tied to ~1.6 volts) The first time it runs properly. The second and subsequent times I run it, no conversions are done. This happens with or without the {adc close} command. Only a power off/on cycle will reset the program to do conversions again. What am I doing wrong?
PicoMite MMBasic RP2040 Edition V6.00.00RC15 Copyright 2011-2024 Geoff Graham Copyright 2016-2024 Peter Mather > RUN 1.63039072 1.624749695 1.632002442 1.652148962 7D7D7D7D7D7E7D7D 7D7D7C7D7D7D7D7D 7C7D7D7D7D7D7D7C 7C7C7D7C7C7D7C7D 7C7D7C7C7D7D7C7D 7D7D7D7D7D7D7D7C 7D7D7D7D7D7D7D7D 7D7E7E7E7D7E7D7E 7E7D7D7E7E7D7E7D 7D7D7E7D7D7E7D7D 7D7E7D7E7E7D7D7E > RUN 1.630793651 1.624749695 1.614273504 1.630659341 0 0 0 0 0 0 0 0 0 0 0 > |