3 Replies - 906 Views - Last Post: 10 April 2013 - 04:29 AM Rate Topic: -----

#1 arun gokul  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-April 13

microcontroller interfaced by vb6 through comm port

Posted 10 April 2013 - 02:12 AM

I am a electronics student working on a microcontroller,i am using vb6 as the front end for the microcontroller
dsPIC33FJ128MC802 (http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en532302) i just wanted to acess the data received in the comm port,but am getting junk values, but i am getting the correct values in simulator PICTEST.EXE


Private Sub Command1_Click()
If (MSComm1.PortOpen = False) Then
MSComm1.PortOpen = True
End If
Command1.Enabled = False
Command2.Enabled = True
End Sub

Private Sub Command2_Click()
If (MSComm1.PortOpen = True) Then
MSComm1.PortOpen = False
End If
Command1.Enabled = True
Command2.Enabled = False
End Sub

Private Sub Form_Load()
With MSComm1
.CommPort = 1
.RThreshold = 1
.RTSEnable = True
.Settings = "9600,N,8,1"
.InputLen = 2
.SThreshold = 1
.PortOpen = True
End With
End Sub

Private Sub Form_Unload(Cancel As Integer)
If (MSComm1.PortOpen = True) Then
MSComm1.PortOpen = False
End If
End Sub
Private Sub MSComm1_OnComm()
Dim Buffer As String

Select Case MSComm1.CommEvent
Case comEvReceive
Text1.Text = " "
Buffer = MSComm1.Input
Text1.Text = Text1.Text & Buffer
End Select
End Sub


 


Is This A Good Question/Topic? 0
  • +

Replies To: microcontroller interfaced by vb6 through comm port

#2 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,797
  • Joined: 26-March 09

Re: microcontroller interfaced by vb6 through comm port

Posted 10 April 2013 - 02:40 AM

Can you give an example of the "junk" values you get and what the correct values should be.

Also, are you sure you've got your comms setup correctly (number of bits, parity etc.)
Was This Post Helpful? 0
  • +
  • -

#3 arun gokul  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-April 13

Re: microcontroller interfaced by vb6 through comm port

Posted 10 April 2013 - 03:18 AM

View Postmaj3091, on 10 April 2013 - 02:40 AM, said:

Can you give an example of the "junk" values you get and what the correct values should be.

Also, are you sure you've got your comms setup correctly (number of bits, parity etc.)

yes am sure because am getting the exact output in the simulator but am not getting it right in the text box
suppose am receiving FA from microcontroller in PICTEST simulator am getting OOOOOOOOO in textbox always
Was This Post Helpful? 0
  • +
  • -

#4 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,797
  • Joined: 26-March 09

Re: microcontroller interfaced by vb6 through comm port

Posted 10 April 2013 - 04:29 AM

Just to be clear, when you say FA you mean Hex (0xFA)??

If so, you need to be looking at converting what you receive in the buffer, as 0xFA will be a none printable character, so you can't just dump it to the textbox and expect it to show FA.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1