Serial Port Programming

Hi, i have written an app that writes a datastring to the comm port every second. When i used the monitoring ultility provided by the multi port board appears..that the port has been successfully opened and data are transmitting. But my device don't seems to be acting upon receiving the data...... Anyway maybe i could have the datastring format screwed up.

Here's the datastring format given

<STX><POL><5 byte Ascii data><Space><PCS><CR><LF>

STX is chr(12),
POL which is either -ve or +ve...which is always chr(43) in my case
5 byte Ascii Data - i hardcoded it to be 55555
Space which is chr(32)
PCS which are 3 bytes chr(80), chr(67) and chr(83)
CR - return carriage chr(13)
LF - LineFeed chr(10)

In my code...i put it as

myValue = 55555
str_tx = chr(12) & chr(43) & myValue & chr(32) & chr(80) & chr(67) & chr(83) & _
            chr(13) & chr(10)

I am not sure if it is the way present my datastring.... By the way....if i were to type to above string using do i present it? like? STX+55555 PCS
what about the CR and LF and space character when testing it with hyperterminal?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I used this program to talk with COM port in binary mode:

This is my question with additional information:

You need to find also some COM port sniffer and to test what data is sent by your program. I don't think that using string variable is right way. Use Byte array instead.
jaxrpcAuthor Commented:
yup actually the data i sent in bytes...btyeArrary() = Encoding.ASCII.GetBytes(str_Tx)  
Test GetBytes return value in debugger. I am not sure that 55555 gives 5 bytes, each one is 5 (BTW, should it be 5 or '5'?). I think that this is better to work directly with Byte array.
Using program mentioned in my first post, get device working. You can set COM port parameters and send bytes giving their values as Hex numbers, and read device reply. Only when you see that device is really working and responds as expected, try to do the same with your program. This is standard to make such programs - in your current state, you don't know whether your program is wrong, or device is not working, or cable is not working, or you are using incorrect port settings.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

jaxrpcAuthor Commented:
I see...the link u gave is not working.... anyway what's the name of the program? maybe it is still available somewhere on the net.
I can post you this program name later, it is kept on one of my CDs, I don't have it here right now.
You can save your time asking this question in Programming and Hardware areas (give also link in the C area). Generally, you need program like Hyper Terminal, which can work with COM port (additional options like sockets are not required), and allows to type and read binary information.
jaxrpcAuthor Commented:
thanks...sorry but if i were to use the hyperterminal to test the textArea how do i present my dataString? Like ...... just simply type STX+12345 PCSCRLF ??
Sorry i am really new to this....and i am also not good with bits and bytes
I have never try to work with Hyper Terminal in binary mode. Usually I am working with COM port with my own program, written in C++. I also successfully worked with another program, but link to it is not working now.
You will not find many programmers who know communications here in VB .NET area. I suggest you to ask questions which are not related to VB, in C and C++ areas. Real time programmers can help you to fix many problems except your code in VB.
I will post program name later.
You can try out those tools
Really useful to me for every serial communication aspect
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.