Ascii
oldhippy
Posts: 36
I am having trouble getting the BS2 to read and display ASCII code from a sensor. any Suggestions
Comments
It send s ASCII code?
How does the BS2 get the data? Via SERIN?
If it's SERIN, have you looked at SERIN and DEBUG in PBASIC Help?
Please post a data sheet, link to the data sheet, or part number of the sensor so we can help you. Almost all sensors I have come across with the exception of gps receivers send data in some form of binary.
followed by a carriage return (ASCII 13).
See the Stamp Manual for details, but the above will wait for the character "R", then take the next 4 bytes as a decimal integer and put the value in the variable called range. The carriage return will be ignored.
Exactly what didn't work?
Why won't you post what "code" you tried?
Did you try the code from their site?
You can try Baudmode 84 which is 8 BIT No-Parity Non-Inverted. You have the RS-232 and the TTL would probably be inverted data.
Do any of the above suggestions show how to receive inverted data with the BS? Can the BS receive inverted serial? If the BS can't receive inverted serial then oldhippy will need to use an inverter of some sort.
You could also receive the data from the sensor by monitoring the pulse from one of the pins. I believe this behaves a lot like the Ping except you don't need to trigger the sensor.
I suppose you could also use RCTIME and read the analog signal the sensor uses.
Edit: I see Publison posted code to use both the serial data and the pulse data.
That code Publison posted also uses a Pin for Flow-Control which I am guessing is the Ranging Start/Stop Pin.
Hippy, how do you have this thing wired and how are you powering it?
...yup - I understand. Often times users will use "BS2" for any model, and I'm attempting to clarify that he's not using something other than a vanilla BS2.