Shop OBEX P1 Docs P2 Docs Learn Events
EB500, I can send data but cant recieve? — Parallax Forums

EB500, I can send data but cant recieve?

GeorgeLGeorgeL Posts: 131
edited 2008-12-22 16:14 in BASIC Stamp
Hey, So I got myself an EB500 and Ive been using it for about a week now. I can send data to it so that it moves forward, left, right,backward. What I cant get it to do·is send data. Heres my configuration:
Computer-COM3 Outgoing
··············COM4 Incoming

BS2 code:
' {$STAMP BS2}
' {$PBASIC 2.5}
dir VAR Byte
pulseCount VAR Byte
x VAR Byte
x=83
DO
SEROUT 1,84,[noparse][[/noparse]"TX",10,DEC 82,10]
SERIN 0,84,[noparse][[/noparse]WAIT("!"),DEC3 dir]
timeout:
IF (dir=1) THEN
FOR pulseCount = 0 TO 50
PULSOUT 13,650
PULSOUT 12,850
NEXT
ENDIF
IF (dir=2) THEN
FOR pulseCount = 0 TO 50
PULSOUT 13,850
PULSOUT 12,650
NEXT
ENDIF
IF (dir=3) THEN
FOR pulseCount = 0 TO 50
PULSOUT 13,850
PULSOUT 12,850
NEXT
ENDIF
IF (dir=4) THEN
FOR pulseCount = 0 TO 50
PULSOUT 13,650
PULSOUT 12,650
NEXT
ENDIF
RETURN
LOOP



and it is recieved by the vb code i wrote

·

Comments

  • GeorgeLGeorgeL Posts: 131
    edited 2008-12-21 02:27
    arghh still cant get it HELP PLEASE (sob)
  • GeorgeLGeorgeL Posts: 131
    edited 2008-12-21 05:17
    Yup, im doomed, help please
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-21 05:24
    You need to explain more clearly how you have things connected and what happens.
  • GeorgeLGeorgeL Posts: 131
    edited 2008-12-21 05:26
    well i have a standard eb500 hookup and in the vb code i just have a simple receive data that works correctly, if I was using serial. both are set to com3
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-21 05:40
    Why do you have a RETURN statement in your program when you don't have a matching GOSUB?

    The RETURN will probably make your Stamp reset because there's no saved return address.
  • GeorgeLGeorgeL Posts: 131
    edited 2008-12-21 06:02
    ok so this is what im trying now.
    BS2 code:
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    DO
    SEROUT 1,84,[noparse][[/noparse]"TX",10,DEC 82,10]
    LOOP


    and my vb code:
    Public Class Form1
    Dim in_data As String
    Dim sData As Byte
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    SerialPort1.Open()
    CheckForIllegalCrossThreadCalls = False
    End Sub
    Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived

    Do
    in_data = SerialPort1.ReadLine()
    Loop Until in_data = "TX"

    in_data = SerialPort1.ReadLine()

    TextBox1.Text = in_data

    SerialPort1.ReadExisting()

    End Sub

    End Class



    Serial port is on COM4 with the rest default settings.

    The light on the EB500 is not on like it is when I have it wait to get data.
  • GeorgeLGeorgeL Posts: 131
    edited 2008-12-21 06:33
    Hmmm this is interesting. So I have my COM ports set so that COM3 is for recieving and COM4 is for sending, so I setup 2 debug windows in BASIC STAMP EDITOR. One is com1 and the other com3. using the example code:
    ‘{$STAMP BS2}
    bData VAR BYTE
    ‘Wait for the eb500 radio to be ready
    PAUSE 1000
    Main:
    SERIN 0,84,[noparse][[/noparse]STR bData\1]
    DEBUG STR bData\1
    GOTO Main

    I try to send a letter or w/e by typing in the COM3 debug terminal and the program hangs, and the TX light just stays on and then the program crashes. Is something horribly wrong here???
  • JonathanJonathan Posts: 1,023
    edited 2008-12-21 16:54
    George,

    Some suggestions:

    There is a pin on the EB500 which goes high when the unit connects. In the sample code you will see that the code waits for this pin to go high before proceeding. Just waiting usually works, but if the computer is busy it can take a little longer. If the LED isn't lit, you aren't connected.

    Try using hyperterminal. There is a complete code example in the docs. That way you can find out if you have the EB500 wired and configured correctly. I don't know VB well enough to say if your code there is ok, but if hyperterm gets the data, it is prolly a VB issue.

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • GeorgeLGeorgeL Posts: 131
    edited 2008-12-21 18:21
    I am using VISTA so I have to use putty as an alt, but i will try what you said
  • GeorgeLGeorgeL Posts: 131
    edited 2008-12-21 18:48
    YAY, I got putty to display my SEROUT. Now I am going to try VB.
  • JonathanJonathan Posts: 1,023
    edited 2008-12-21 18:52
    Glad to hear you got it going. I had a feeling it might be in the VB code, the EB500 itself is very easy to use.

    Have fun!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-21 22:04
    I notice that you're using 10 as an end of line code. Windows expects two characters, 13 (CR) and 10 (LF). There are 3 conventions for end of line. The Mac OS normally expects 13 and Linux normally expects 10. VB's Readline may require the normal Windows end of line (13, 10).
  • GeorgeLGeorgeL Posts: 131
    edited 2008-12-21 22:21
    Well, Mike, I got everything to work, so that doesnt really concern me. I will post the completed app and code in a few hours.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-12-22 16:14
    GeorgeL said...
    Yup, im doomed, help please
    George,

    ·· For future reference please post new or clarified information in follow-ups.· These types of bumps messages (usually deleted) don't offer anything new to members reading the thread and therefore if they had nothing to offer before, it is unlikely that will change.· If you're not getting replies you may need to provide additional information or at the very least, the results of what you have tried since your last post.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
Sign In or Register to comment.