Okay, i need help help in solving a small visual basic (2005 ed.) problem.
Im sure your all tired of repetitive questions about visual basic when theres loads of information everywhere about it....
im using an 08m and i want to send information to the pc and vica versa using visual basic .
I know how to do this and im not asking how I go about this,
My problem is that the baud rate for sertxd is stuck at 4800 which is fine as I just set the baud rate for my programme (using Dim WithEvents serialPortcomm As New IO.Ports.SerialPort) in order to recieve data from the picaxe.
But heres my dilemma. When the pc sends information to the picaxe it sends it at the baud rate selected as above (4800) which you may well know that not only does the 08m not support serrxd but it also cannot serin using the 4800 baud rate. This proves a problem as I can only send data OR recieve data but not both as I have to change the baud rate.
Is there anyway of getting around this other than buying a picaxe that supports serrxd or the 4800 baud rate??
Heres the code......
'this is to connect the port and change settings so that information can be recieved
Private Sub btnConnect_Click(ByVal sender As Object, ByVal e As System.EventArgs)Handles btnConnect.Click
If serialPort2.IsOpen Then
serialPort2.Close()
End If
Try
With serialPort2
.PortName = cbbCOMPorts.Text
.BaudRate = 4800
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
End With
serialPort2.Open()
lblMessage.Text = cbbCOMPorts.Text & " connected."
btnConnect.Enabled = False
btnDisconnect.Enabled = True
Catch ex As Exception
MsgBox(ex.ToString)
End Try
' the following is an event when data is recieved onto the buffer from the picaxe using sertxd
Private Sub SerialPort_OnComm() Handles SerialPort.OnComm
ReceiveBuffer.Append(SerialPort.InputString)
Debug.WriteLine(ReceiveBuffer.ToString)
datapx = (ReceiveBuffer.ToString)
Updatelogs()
end sub
'this code below is to send a small string of data to the picaxe
Try
serialPort2.Write(txtDataToSend.Text & vbCrLf)
With txtDataReceived
.SelectionColor = Color.Black
.AppendText(txtDataToSend.Text & vbCrLf)
.ScrollToCaret()
End With
txtDataToSend.Text = String.Empty
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Any help with this would be much appreciated
thanks
Denz
Im sure your all tired of repetitive questions about visual basic when theres loads of information everywhere about it....
im using an 08m and i want to send information to the pc and vica versa using visual basic .
I know how to do this and im not asking how I go about this,
My problem is that the baud rate for sertxd is stuck at 4800 which is fine as I just set the baud rate for my programme (using Dim WithEvents serialPortcomm As New IO.Ports.SerialPort) in order to recieve data from the picaxe.
But heres my dilemma. When the pc sends information to the picaxe it sends it at the baud rate selected as above (4800) which you may well know that not only does the 08m not support serrxd but it also cannot serin using the 4800 baud rate. This proves a problem as I can only send data OR recieve data but not both as I have to change the baud rate.
Is there anyway of getting around this other than buying a picaxe that supports serrxd or the 4800 baud rate??
Heres the code......
'this is to connect the port and change settings so that information can be recieved
Private Sub btnConnect_Click(ByVal sender As Object, ByVal e As System.EventArgs)Handles btnConnect.Click
If serialPort2.IsOpen Then
serialPort2.Close()
End If
Try
With serialPort2
.PortName = cbbCOMPorts.Text
.BaudRate = 4800
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
End With
serialPort2.Open()
lblMessage.Text = cbbCOMPorts.Text & " connected."
btnConnect.Enabled = False
btnDisconnect.Enabled = True
Catch ex As Exception
MsgBox(ex.ToString)
End Try
' the following is an event when data is recieved onto the buffer from the picaxe using sertxd
Private Sub SerialPort_OnComm() Handles SerialPort.OnComm
ReceiveBuffer.Append(SerialPort.InputString)
Debug.WriteLine(ReceiveBuffer.ToString)
datapx = (ReceiveBuffer.ToString)
Updatelogs()
end sub
'this code below is to send a small string of data to the picaxe
Try
serialPort2.Write(txtDataToSend.Text & vbCrLf)
With txtDataReceived
.SelectionColor = Color.Black
.AppendText(txtDataToSend.Text & vbCrLf)
.ScrollToCaret()
End With
txtDataToSend.Text = String.Empty
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Any help with this would be much appreciated
thanks
Denz