PDA

View Full Version : MaxSonar Ez1



embedded
07-23-2007, 03:04 AM
I'm working with the Maxsonar ez1 and i don't understand the data
received.
this is an example of this data:

Data received: 043 000 159 208 086 086 000 043 000 159 208 086 086 000

the program (for debug) i use for capture the output (in decimal
format captured from TX) is 232-Analyzer (from Pc).
I don't know if the data are correct,because the MaxSonar's datasheet
reveal many differences
(e.g. the first character must be "R",but i read 043 that is "+" in
ASCII code!!!).

This is example code:

Static Buffer As String
Dim Reading As String
Dim RPos As Integer
Dim CRPos As Integer
Buffer = Buffer & MSComm1.Input
RPos = InStr(Buffer, "R")
If RPos > 0 Then
CRPos = InStr(RPos, Buffer, vbCr)
If CRPos > 0 Then
Reading = Mid$(Buffer, RPos + 1, CRPos - 1 - RPos)
Buffer = Mid$(Buffer, CRPos + 1)
Debug.Print Reading
CWGraph1.Chart
CWGraph1.ChartY (Reading + Calibration) *
DistanceMultiplier,
0.05
End If
End If
End Sub

The Calibration is 1and DistanceMultiplier is 2.54

please help me!!!
Thanx!

embedded
07-23-2007, 04:21 PM
have I need to invert the signal sent by the maxsonar
with a TTL to RS232 converter?

Dave
07-24-2007, 05:04 PM
Do you have the EZ-1 connected directly to the computer? If so, you'll need to use an RS232 driver, such as the MAX232 IC. Also, you may have to invert the signal before sending it to the RS232 driver.