RS232 Help
RS232 Help
(OP)
Hi
I have a problem as i need to write a simple comm's program to send one hex string to the serial port.. Ideally i would like this program to be a single .exe file that when run just sends the hex string and closes the port..
Also
-It needs to run in win2k
-It needs to run hidden but i assume that if it was an .exe i could just use hidden32.exe to hide it..
-I might need to send a different hex string in the future so it would be best to have an easy source file to edit..
Thats it really... I have searched and searched the net but cant seem to find any pre-made program that would be suitable... However i did find a few C++ and VB libraries that might be able to be edited...
I dont have any idea of what would be the best lanugage to use as i dont have any particular knowledge of any one lanugage but am willing to give it a go... If u have any input on the best lanugage and other info places to look or even a program that u have come across on your travels that might do the job or even a source code it will be apperciated..
And if u are able to reply please the more indepth the better...
Thank You :)
I have a problem as i need to write a simple comm's program to send one hex string to the serial port.. Ideally i would like this program to be a single .exe file that when run just sends the hex string and closes the port..
Also
-It needs to run in win2k
-It needs to run hidden but i assume that if it was an .exe i could just use hidden32.exe to hide it..
-I might need to send a different hex string in the future so it would be best to have an easy source file to edit..
Thats it really... I have searched and searched the net but cant seem to find any pre-made program that would be suitable... However i did find a few C++ and VB libraries that might be able to be edited...
I dont have any idea of what would be the best lanugage to use as i dont have any particular knowledge of any one lanugage but am willing to give it a go... If u have any input on the best lanugage and other info places to look or even a program that u have come across on your travels that might do the job or even a source code it will be apperciated..
And if u are able to reply please the more indepth the better...
Thank You :)





RE: RS232 Help
2) What's the purpose of this project?
RE: RS232 Help
I have a basic understanding of computer programming languages... i.e Pascal, C++, Cobal, ASM, i never liked programming i only ever done what i had to do to graduate. I graduated about 5 years ago so and besides java programming i dont really do anything other maybe edit a few source files for linux... Not to mention in my opionion it takes someone interested and special to be a good programmer and i am not...
The project is to control a simple rs232 device, I need to send the following to the serial port... 3FH 60H 80H 4EH 00H... Any advise would be apperciated
With Thanks
RE: RS232 Help
anything and replace/actuate the desired string.
The info content of a fix string is 1 bit ( received/not received)
<nbucska@pcperipherals.com>
RE: RS232 Help
You will have to use the windows.h header.
You will have to use the CreateFile() function to initialize the serial port.
You will have to use the WriteFile() function to write the hex byte to the port.
Hope this helps.
Kris
RE: RS232 Help
(Baud, parity etc ?)
<nbucska@pcperipherals.com>
RE: RS232 Help
from an ancient DOS book:
MODE will set the COM parameters
ECHO (string) > COM1
or the similar...
These commands exist in Win XP Home, so I suspect that they exist in Win 2K as well.
don't need no stinking .exe file!
Jay
Jay Maechtlen
RE: RS232 Help
If the serial communication is part of a larger program, why not use it to send the codes.
Sorry if this is off base, but a little more info in what you are rying to accomplish might lead to better solutions than a standalone exe.
RE: RS232 Help
(baudrate, COM1 or 2, parity, number of bits, text)
AND an E-mail address.
<nbucska@pcperipherals.com>
RE: RS232 Help
It basically is only one module but there must be a form to contain the MSCOMM control.
'===================
Option Explicit
Const theString = "&h3F&h60&h80&h4E&h00"
Sub Main()
Dim Instring As String 'this is not needed for now
Dim i As Integer
Dim cOut As Long
' Use COM1.
frmComm.MSComm1.CommPort = 1
' 9600 baud, no parity, 8 data, and 1 stop bit.
frmComm.MSComm1.Settings = "9600,N,8,1"
' Tell the control to read entire buffer when Input is used.
frmComm.MSComm1.InputLen = 0
' Open the port.
frmComm.MSComm1.PortOpen = True
'now spool out the string data
i = 1
While InStr(i, theString, "&")
cOut = Val(Mid(theString, i, 4))
frmComm.MSComm1.Output = Chr(cOut)
i = i + 4
Wend
frmComm.MSComm1.PortOpen = False
End Sub
'===================
It should run on any windows platform but the target machine must have the MSCOMM control installed and registered for the program to work.
I'll gladly email you the source and compiled code or I could post it on my web site. Let me know.
RE: RS232 Help
MODE command to set the COM parameters
Use the echo command to send the sequence of characters.
Once you've dialed it in then save the commands to a batch file and execute it whenever you want it to send.