Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,578 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,945 people online right now. Registration is fast and FREE... Join Now!




rs232

 
Reply to this topicStart new topic

rs232

mgibson212
7 Oct, 2008 - 02:56 PM
Post #1

New D.I.C Head
*

Joined: 7 Oct, 2008
Posts: 1

Hi,

First of all i am hardware background and all my software programming experience is in assembly language.

I am trying to send specific codes to a controller and read data back into a text box(just for starters, planning on decoding to user friendly format later). If the data matches 'abcd' then i print 'Passed' in text2. text1 is purely used for displaying any data received. I want to loop on data received until a CR is received (end of data)

*****************************************
CODE
Private Sub Form_Load()

End Sub

Private Sub Command1_Click()
'open comm
MSComm1.PortOpen = True
'send rs232 data ff <CR> 4C
MSComm1.Output = "ff" + Chr$(13)
'receive data until <CR> received
Do
dummy = DoEvents()
Loop Until MSComm1.Input <> Chr$(13)
'print value in text box
Text1.Text = MSComm1.Input
'close port
MSComm1.PortOpen = False
End Sub

Private Sub Text1_Change()
Text1.Text = MSComm1.Input
End Sub

Private Sub Text2_Change()
If Text1.Text = "abcd" Then Text2.Text = "Passed"
End Sub

******************************************

Mode Edit - Please remember to paste your code in the code tags.
User is offlineProfile CardPM
+Quote Post

thava
RE: Rs232
7 Oct, 2008 - 04:27 PM
Post #2

D.I.C Regular
Group Icon

Joined: 17 Apr, 2007
Posts: 450



Thanked: 18 times
Dream Kudos: 50
My Contributions
is there any problem you have already loop it then ...........

one thing if you mean, CR is carriage return ,may i right

This post has been edited by thava: 7 Oct, 2008 - 04:30 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 12:26AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month