You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BusPirate doesn't have a timer for timestamps. It could be useful to have a internal timer running all the time and value of such timer could be print by user command and read in BASIC script. Maybe add a feature to reset that timer.
I assume that command t will print internal timer and T will reset internal timer. Measure how long it takes to read sample from ADC. First try to measure delay function of 1ms, than 100ms, then single ADC and than 10 ADC samples:
HiZ>Tt%t%:100tdtddddddddddt
That command will end with error because t and T commands are not available in the current firmware...
I think this could be useful to measure signal timings. I have a BASIC script to search for long pulses in analog signal read by ADC. I measure pulse length with simple counter LET C=C+1. It works but whenever I modify my BASIC program, I read different numbers because modified program runs with different timing. I need hardware timer!
HINT: Nice part to play with BusPirate is 2-pin "smart" color LED that changes colors in a pattern. These LED diodes are not calibrated so when you have several such LEDs, they will blink in a little different way. Each color have different forward voltage and BusPirate can measure forward voltage of blinking LED with ADC. It is an easy source of variable input voltage for experiments with ADC...
Student with BP (or Arduino) and several blinking LEDs can try:
to find LEDs with similar blinking frequency (similar blinking pattern)
to find the LED that blinks at the highest frequency
to find the LED that blinks at the lowest frequency
to find minimal forward voltage
to find maximum forward voltage
to detect that LED is missing
to detect LED that is not blinking (single color LED)
to detect that LED was replaced with other blinking LED
to test how repeatable is this measurement
many more, so much fan ;-)
even more fun when internal timer is available...
Simple example, read forward voltage of blinking LED in BASIC, find the lowest and the highest voltage. Blinking LED is powered from AUX output with 100ohm resistor in series:
HiZ(BASIC)>list
10 LET M=9999
20 LET N=0
30 AUX 1
40 FOR K=1 TO 10000
50 LET A= ADC
60 REM PRINT K;":";A
70 IF A<M THEN LET M=A
80 IF A>N THEN LET N=A
90 DELAY 1
100 NEXT K
110 AUX 0
120 PRINT "THE LOWEST VOLTAGE: ";M
130 PRINT "THE HIGHEST VOLTAGE: ";N
65535 END
159 bytes.
Ready
HiZ(BASIC)>run
THE LOWEST VOLTAGE: 329
THE HIGHEST VOLTAGE: 503
Ready
HiZ(BASIC)>
BP BASIC doesn't have floating point numbers so it prints ADC value as raw value from register and there is no easy way to convert value to voltage in this micro BASIC. I think that command mode of BP could be extended to allow print ADC in voltage or "raw"; I see two ways how to do it. A way to switch between volts and raw, possibly extend o command with more options. Or just print voltage in volts and samples in the same time.
Current firmware:
HiZ>d%:200d
VOLTAGE PROBE: 3.24V
DELAY 200ms
VOLTAGE PROBE: 2.51V
Future firmware ;-)
HiZ>d%:200d
VOLTAGE PROBE: 3.24V (raw 496)
DELAY 200ms
VOLTAGE PROBE: 2.51V (raw 384)
And there is even other way how to address voltage conversion problem in BP BASIC. Add function, let call it VOLTS that will convert number to volts. Because BP BASIC doesn't have string type variables, function VOLTS has to print result out. Possible usage:
10 LET A=ADC
20 PRINT "ADC VOLTAGE PROBE IS "; VOLTS A;"V, RAW VALUE IS ";A
The text was updated successfully, but these errors were encountered:
BusPirate doesn't have a timer for timestamps. It could be useful to have a internal timer running all the time and value of such timer could be print by user command and read in BASIC script. Maybe add a feature to reset that timer.
I assume that command
t
will print internal timer andT
will reset internal timer. Measure how long it takes to read sample from ADC. First try to measure delay function of 1ms, than 100ms, then single ADC and than 10 ADC samples:HiZ>Tt%t%:100tdtddddddddddt
That command will end with error because
t
andT
commands are not available in the current firmware...I think this could be useful to measure signal timings. I have a BASIC script to search for long pulses in analog signal read by ADC. I measure pulse length with simple counter
LET C=C+1
. It works but whenever I modify my BASIC program, I read different numbers because modified program runs with different timing. I need hardware timer!HINT: Nice part to play with BusPirate is 2-pin "smart" color LED that changes colors in a pattern. These LED diodes are not calibrated so when you have several such LEDs, they will blink in a little different way. Each color have different forward voltage and BusPirate can measure forward voltage of blinking LED with ADC. It is an easy source of variable input voltage for experiments with ADC...
Student with BP (or Arduino) and several blinking LEDs can try:
Simple example, read forward voltage of blinking LED in BASIC, find the lowest and the highest voltage. Blinking LED is powered from AUX output with 100ohm resistor in series:
BP BASIC doesn't have floating point numbers so it prints ADC value as raw value from register and there is no easy way to convert value to voltage in this micro BASIC. I think that command mode of BP could be extended to allow print ADC in voltage or "raw"; I see two ways how to do it. A way to switch between volts and raw, possibly extend
o
command with more options. Or just print voltage in volts and samples in the same time.Current firmware:
Future firmware ;-)
And there is even other way how to address voltage conversion problem in BP BASIC. Add function, let call it VOLTS that will convert number to volts. Because BP BASIC doesn't have string type variables, function VOLTS has to print result out. Possible usage:
The text was updated successfully, but these errors were encountered: