Spin / assembly function for measuring voltage of a pin
lklo
Posts: 4
Hi everyone,
we are looking for a spin / assembly function (for the propeller chip on the propeller demo board) that will give us a reading of what the voltage is at that pin. After reading the voltage we want to set that as a threshold for a bunch of sensors that we are using. We are aware the the current Hi/Lo threshold is vdd/2 = ~1.6V but none of our sensors are able to output at that range without issues.
I found a blogger that is using an Arduino board with the same alcohol sensor (http://sensorworkshop.blogspot.com/) and looking at the C code I believe the function analogRead() is what we think we are looking for, if there is a spin / assembly equivalent.
Any help would be very much appreciated!
we are looking for a spin / assembly function (for the propeller chip on the propeller demo board) that will give us a reading of what the voltage is at that pin. After reading the voltage we want to set that as a threshold for a bunch of sensors that we are using. We are aware the the current Hi/Lo threshold is vdd/2 = ~1.6V but none of our sensors are able to output at that range without issues.
I found a blogger that is using an Arduino board with the same alcohol sensor (http://sensorworkshop.blogspot.com/) and looking at the C code I believe the function analogRead() is what we think we are looking for, if there is a spin / assembly equivalent.
Any help would be very much appreciated!
Comments
If you're using the Demo Board, you may need to solder some SMD parts directly to the Propeller pins, as this method does not work very well when implemented on the solderless breadboard.
-Phil
to explain a bit more about the propeller-chip.
The propeller-chip has no analog-inputs. Just digital. One way to read analog voltages is described in the application note 8 that PhiPi mentioned.
Another way is to use an external ADC-chip lik ethe MCP3208. In the Obex there is an object for reading the MCP3208 ADC.
best regards
Stefan
-Phil