Shop OBEX P1 Docs P2 Docs Learn Events
RS232 App mod — Parallax Forums

RS232 App mod

Istha PowronIstha Powron Posts: 74
edited 2007-02-13 13:52 in BASIC Stamp
It could be the stormy weather, or the fact that water· spins the opposite way in Australia as it goes down the bath drain, but I am pulling my hair out trying to get a simple VB6 comms program to work with the rs232 app mod.

The code below is part of a·GUI for a mobile robot;

Private Sub MSComm1_OnComm()
Dim sData As String ' Holds·incoming data
' If comEvReceive Event then get data and display
If MSComm1.CommEvent = comEvReceive Then
··· sData = MSComm1.Input ' Get data (9 bytes)
··· Text6.Text = "Data"
··· Comm_Flag = 1
··· Text5.Text = sData
···
End If

I know the data is comming from the robot (RS232 App Mod) as I can see it on Hyperterminal.

I know that the VB6 app can see data from the comm port as when I type to it from another pc with Hyperterminal it comes up on the GUI.

But when I connect the robot to the GUI, the VB6 program freezes. When I disconnect it, it runs again.

When I disconnect the robot, some data is visible on the GUI but it is corrupted.

My initial thought was a voltage difference between my laptop and the robot, but Hyperterminal works.

If I change the baud rate on MSComm and connect the VB6 App to the debug terminal on the BS2 on the robot, I get good data.

The only other thing that may affect anything is that the robot is running the RF app mods to communicate with another mobile robot. Maybe the RS232 app mod is picking up RF interference.

I KNOW my baud rates are all good.

Has anyone else had these problems?

Thanx

Istha

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔





The robot is going to lose. Not by much. But when the final score is tallied, flesh and blood will beat the damn monster.
Adam Smith

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-02-11 18:09
    Try testing one thing at a time. remove the other appmods and test only the rs232. Make sure the cable between the appmod and the computer is wired correctly and add an led to the stamp to make sure it's alive and sending when connected.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-02-11 19:22
    Hi Istha, do as Stephen suggests, test only the RS232. For test code in your Stamp begin with one byte and space the transmission interval with a 3 or 4 second pause. In the VB app make Text5 read Text5.Text=Text5.Text & sData

    Try this first

    main:

    SEROUT TXpin,Baud,[noparse][[/noparse]"A"]

    PAUSE 4000

    GOTO main

    If you still get nothing try this

    main:

    SEROUT TXpin,Baud,[noparse][[/noparse]"A",10]

    PAUSE 4000

    GOTO main

    The contents of the Text5 should display the AScii code for "A" (65) once you are able to recieve one byte you can expand and discover where the current problem lies.

    Jeff T.
  • Istha PowronIstha Powron Posts: 74
    edited 2007-02-13 13:52
    Thank you for your replies. I tried everything and it didn't work!

    But then I realised I had a spare RS232 mod and swapped them. Worked first go. DON'T you hate that.

    Sorry to waste everyone's time.

    Istha

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔





    The robot is going to lose. Not by much. But when the final score is tallied, flesh and blood will beat the damn monster.
    Adam Smith
Sign In or Register to comment.