|
-
Apr 12th, 2000, 08:00 PM
#1
Thread Starter
Junior Member
Hi,
Some days ago I posted a question about communicating with a dsp evaluation board.
Now, I sometimes receive an Framing error from the DSP, What can the problem be here?
I also think that my code to write to the Textbox isn't that good. It may be a stupid fault becuase I'm programming VB since 2 weeks.
If the input property is set to Binary mode, I receive question marks. And this is not a parity error, because I changed the symbol to "!" in the MSComm property window .
My code to write to texbox. The DSP need to send me some decimal or hexadecimal values, Is the dimention of Instring then good?
Private Sub MSComm1_OnComm()
Dim InString As String
'read entire buffer
MSComm1.InputLen = 0
TextBox.SelStart = Len(TextBox)
Select Case MSComm1.CommEvent
Case comEvReceive
If MSComm1.InBufferCount Then
InString = InString & MSComm1.Input
TextBox.SelStart = Len(TextBox)
'Zet waarden van buffer op het scherm
TextBox = TextBox & InString & vbCrLf
End If
Case comCDTO
MsgBox ("CD timeout")
Case comOverrun
MsgBox ("data lost")
Case comFrame
MsgBox ("Framing Error")
End Select
End Sub
This is what I send to the DSP board, the hexadecimal value 80
Private Sub MenuSend_Click()
Dim StartBit
StartBit = Hex(128)
MSComm1.DTREnable = True ' DTR High
MSComm1.Output = StartBit
End Sub
If somebody please can help me????
Thank you
Viperke
-
Apr 13th, 2000, 01:14 PM
#2
Member
I am sorry that I did not reply to your earlier post.
Here is what causes a framing error:
A framing error (Bit 3) occurs when the last bit is not a stop bit. This may occur due to a timing error. You will most commonly encounter a framing error when using a null modem linking two computers or a protocol analyzer when the speed at which the data is being sent is different to that of what you have the UART set to receive it at.
In your code, you did not show your port setup. I have provided sample program of a MSComm control. I tried this program only with a Null Modem cable.
1. Just add a textbox and named Text1
2. Set Mscomm1.CommPort to your free serial port available on your PC.
Code:
Private Sub Form_Load()
With MSComm1
.CommPort = 2 'use your free port
.Handshaking = 2 - comRTS
.RThreshold = 1
.RTSEnable = True
.Settings = "28800,n,8,1"
.SThreshold = 1
.InputMode = comInputModeText
.PortOpen = True
End With
End Sub
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
End Sub
Private Sub MSComm1_OnComm()
Dim inbuff As String
Select Case MSComm1.CommEvent
Case comEvReceive
inbuff = MSComm1.Input
Call HandleInput(inbuff)
End Select
End Sub
Sub HandleInput(inbuff As String)
Text1.SelStart = Len(Text1.Text)
Text1.SelText = inbuff
End Sub
This is the simplest serial communication program. It is limited to small data transfers. This program might clear up your problems. E-mail me if you have any problems. I have already started to research your DSP evaluation board.
[email protected]
[Edited by Sacred_knight on 04-14-2000 at 02:17 AM]
Sacred_Knight
Electronic Technologist
E-Mail: [email protected]
He who laughs last, laughs later.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|