Troubleshooting ASCII Character Transmission in VB for RS232 Communication

AI Thread Summary
The discussion centers on challenges faced when communicating with an RS232 device using Visual Basic (VB). The user encounters an issue where ASCII characters with values of 128 or higher are displayed as '?' in HyperTerminal, despite the software's capability to show these characters correctly. This raises questions about whether the data is being transmitted correctly or if there are issues with the communication setup. The user shares code snippets for sending ASCII characters and inquires about easier methods for sending characters in different formats, such as hex or binary. Additionally, the user seeks clarification on "stick parity," noting that their protocol requires specific parity settings for the first byte and subsequent bytes. A suggestion is made to use a different encoding, such as Encoding.UNICODE, to address the character display issue.
ionlylooklazy
Messages
30
Reaction score
0
Hello all,


I am trying to communicate with a rs232 device using VB.

however, testing my program by using hypterminal, I noticed that any time I try to output an ascii character 128 or higher, it shows up as a '?' instead of the desired character.

I know hypterminal is able to display the character (its a u with a hat), but is the data getting lost somehow? are the correct bits being transmitted, or am I not setting up my communications correctly?


Heres my code (btw, is there an easier way to send ascii character? (either in hex,dec, or bin):


Code:
Dim ascii As Encoding = Encoding.ASCII
Dim test As Byte()
Dim test1 As String

test1 = Chr(8) + Chr(9) + chr(8) + Chr(17) + Chr(150) ' ect.. all bytes for a certain packet
test = ascii.GetBytes(test1)

value.Write(test, 0, 10)

ps. What is stick parity? I'm not familiar with this. The protocoling I'm using utilizes it by have the parity on the first byte set to 1, and the rest of the bytes in a packet set to 0. To mimick this, I've been using Mark and Space parity respectively, but am unsure whether or not this is the same. (i have been using no parity for tests with hyperterminal)


Thanks,

IOLL
 
Technology news on Phys.org
The ASCII encoding has printable characters from 32 to 126 only. You should try a different encoding, maybe Encoding.UNICODE.
 
Last edited:
Thank you !
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Back
Top