Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
when sending "help" i receive "hp" but "h12e12l123p"i receive "help" which means after every letter the must be 2 space

What I have tried:

public void receiveMsg()
receivedMsgTextbox.AppendText(serialPort1.ReadExisting());
private void sendMsgTextbox_KeyPress(object sender, KeyPressEventArgs e)
byte c = (byte)e.KeyChar;
if(c == 0x0D)
c = 0x0A;
serialPort1.WriteLine(sendMsgTextbox.Text);
receiveMsg();
Posted
Updated 30-Aug-16 22:14pm
Comments
Member 12623023 31-Aug-16 4:14am    
Add up to the question ive checked the daude rate fine,encoding fine read n write buffer size fine i need help on what can i check now which might be causing the message to loose every 2 letters after printing the 1st

1 solution

Check your serial port configuration: it may be that you need to "tweek" the BPC, stop bits, and / or parity to match the target hardware.

Start by using something like Hyperterminal to make sure you have good solid communications between your PC and the target - until you have that provably working perfectly, you are just adding complications by coding SerialPort code. At present, you don't know if the problem is at your end or the remote device just can't cope with data as "quickly" as you are sending it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900