Shop OBEX P1 Docs P2 Docs Learn Events
Serial port problem with VB 2008 — Parallax Forums

Serial port problem with VB 2008

TerrachildTerrachild Posts: 2
edited 2010-04-22 12:04 in BASIC Stamp
I've done this before years ago with VB 6, but my attempt with VB 2008 isn't working.

This should be very simple.
Here is the BS2 code:

Loop:

SEROUT 16, 396,[noparse][[/noparse]"A"]
PAUSE 3000

GOTO Loop
Here is the VB 2008 code:

Imports System
Imports System.IO.Ports
Imports Strings = Microsoft.VisualBasic



Public
Class Form1

Private Sub cmdOpenPort_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdOpenPort.Click
SerialPort1.Open()

End Sub



Private Sub cmdClosePort_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClosePort.Click
SerialPort1.Close()

End Sub



Private Sub cmdReadPort_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdReadPort.Click

Dim strTemp As String

strTemp = SerialPort1.ReadExisting()
TextBox1.Text = strTemp


End Sub



End Class



Here are the settings for the serial port:

2400, N, 8, 1


When I run both programs, my Windows Form shows a question mark in the textbox·for every byte received.
A question mark is Ansi 63, which what the SerialPort1 ParityReplace character is set to.· That is a parity error replacement byte.· Since·parity is set to none in·SerialPort1, I'm not sure why this is happening.




Any ideas?

Thanks
228 x 456 - 36K

Comments

  • TerrachildTerrachild Posts: 2
    edited 2010-04-22 12:04
    Oops.....It been years since I've used these chips. I forgot that the BS2SX doesn't use the same values for Serout, and Serin as the original BS2.

    I substituted $3fd for the baudrate, and now it works fine.
Sign In or Register to comment.