Click here to Skip to main content
15,914,943 members
Home / Discussions / C#
   

C#

 
QuestionPlease help with writing to a serial port Pin
turbosupramk31-Nov-11 20:12
turbosupramk31-Nov-11 20:12 
AnswerRe: Please help with writing to a serial port Pin
BobJanova1-Nov-11 23:51
BobJanova1-Nov-11 23:51 
GeneralRe: Please help with writing to a serial port Pin
turbosupramk32-Nov-11 2:10
turbosupramk32-Nov-11 2:10 
AnswerRe: Please help with writing to a serial port Pin
Luc Pattyn2-Nov-11 3:25
sitebuilderLuc Pattyn2-Nov-11 3:25 
GeneralRe: Please help with writing to a serial port Pin
turbosupramk32-Nov-11 3:55
turbosupramk32-Nov-11 3:55 
AnswerRe: Please help with writing to a serial port Pin
Luc Pattyn2-Nov-11 4:22
sitebuilderLuc Pattyn2-Nov-11 4:22 
GeneralRe: Please help with writing to a serial port Pin
turbosupramk32-Nov-11 5:48
turbosupramk32-Nov-11 5:48 
AnswerRe: Please help with writing to a serial port Pin
Luc Pattyn2-Nov-11 6:52
sitebuilderLuc Pattyn2-Nov-11 6:52 
You're still sending text, and so you are probably back now at sending two bytes, the one you intend and a NULL, as e.g. 'A' in ASCII is 0x41 but in Unicode it is 0x0041.

try this:
byte[] buff=new byte[1];
buff[0]=(byte)e.KeyChar;
serialPort1.Write(buff, 0, 1);


Once that works, fill an entire byte array as I told you before. That should work too, except there is a tiny chance your target isn't coping with a byte array at top speed, I noticed you are using a high baud rate, no parity, and a single stop bit, which is about the fastest you can hope for, however it might flood the target; remember for serial port, the source must use at least as many stop bits as the target is expecting, more is fine, less is not.

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

GeneralRe: Please help with writing to a serial port Pin
turbosupramk32-Nov-11 9:00
turbosupramk32-Nov-11 9:00 
AnswerRe: Please help with writing to a serial port Pin
Luc Pattyn2-Nov-11 9:11
sitebuilderLuc Pattyn2-Nov-11 9:11 
GeneralRe: Please help with writing to a serial port Pin
turbosupramk32-Nov-11 9:54
turbosupramk32-Nov-11 9:54 
AnswerRe: Please help with writing to a serial port Pin
Luc Pattyn2-Nov-11 10:10
sitebuilderLuc Pattyn2-Nov-11 10:10 
GeneralRe: Please help with writing to a serial port Pin
turbosupramk32-Nov-11 11:03
turbosupramk32-Nov-11 11:03 
AnswerRe: Please help with writing to a serial port Pin
Luc Pattyn2-Nov-11 11:20
sitebuilderLuc Pattyn2-Nov-11 11:20 
GeneralRe: Please help with writing to a serial port Pin
turbosupramk32-Nov-11 11:37
turbosupramk32-Nov-11 11:37 
GeneralRe: Please help with writing to a serial port Pin
Rob Philpott2-Nov-11 7:34
Rob Philpott2-Nov-11 7:34 
AnswerRe: Please help with writing to a serial port Pin
PIEBALDconsult2-Nov-11 9:00
mvePIEBALDconsult2-Nov-11 9:00 
GeneralRe: Please help with writing to a serial port Pin
turbosupramk32-Nov-11 9:10
turbosupramk32-Nov-11 9:10 
AnswerRe: Please help with writing to a serial port Pin
Alan N2-Nov-11 10:12
Alan N2-Nov-11 10:12 
GeneralRe: Please help with writing to a serial port Pin
turbosupramk32-Nov-11 11:40
turbosupramk32-Nov-11 11:40 
Questionerror handling Pin
dcof1-Nov-11 17:46
dcof1-Nov-11 17:46 
AnswerRe: error handling PinPopular
Luc Pattyn1-Nov-11 18:10
sitebuilderLuc Pattyn1-Nov-11 18:10 
GeneralRe: error handling Pin
Wayne Gaylard1-Nov-11 19:09
professionalWayne Gaylard1-Nov-11 19:09 
GeneralRe: error handling Pin
dcof2-Nov-11 4:13
dcof2-Nov-11 4:13 
GeneralRe: error handling Pin
fjdiewornncalwe2-Nov-11 4:21
professionalfjdiewornncalwe2-Nov-11 4:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.