Thanks for the responses.
I just tried hooking the sensor up to Hyperterminal, 9600 8N1, and it seems to work fine. I get a steady stream of results in the format "R123." I tried 9600 true instead of inverted on the PIC just to see, but got the same absence of results.
I haven't tried using DEBUGIN before. Reading the description, it it seems like SERIN2 plus an ability to disable interrupts. What can DEBUGIN do for me?
When I tried running this without the timeout, it would hang at the point of the SERIN2 command, and I never got a peep out of SEROUT.
My circuit is a bit ugly at the moment, just something thrown together for testing purposes. I'm using the PICKit2 proto board with the sensor plugged into the headers via a breadboard and the serial connection to the PC wire-wrapped on the proto board. I'm attaching a photo of the setup. It output to Hyperterminal with the same breadboard connections.
Is there any way the carriage return the sensor sends at the end of each reading could be confusing SERIN2? Do I need to tell it to ignore/drop the last character somehow? The manufacturer's FAQ has code examples for a couple other BASIC languages, and I thought they were just ignoring the carriage return, but maybe not. Here's their BS2 code:
FOR xX = 1 TO 5
SERIN pMaxRecv\pMaxClock, 16468, [WAIT ("R"), DEC xDist]
DEBUG DEC5 xDist, " "
PAUSE 50
NEXT
DEBUG CR
The SERIN looks the same as mine, but I'm not sure what they are doing with the DEBUG command.
Bookmarks