Click here to Skip to main content
16,012,821 members
Home / Discussions / C#
   

C#

 
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 
turbosupramk3 wrote:
If I send "pin1=2" via the simpleserial object, it is received
and the microchip code reacts. When I try and send it through the below method,
the data is not received by the microchip and it does not react.
 


Like Bob, I can't see any functional difference between the simpleserial code and your version.

Here are a few random ideas which may help.

1) Are you sending the correct message?
When you use simpleserial and type in the characters individually, how does the device know when it has a complete message? Does it respond as soon as the 2 of pin1=2 is typed in or do you have enter something more?

{EDIT} I see from your response to Luc that you must have been pressing the enter key.

2) Is the loop sending the message too quickly?
Test the effect of a delay (~300ms) between each character to simulate the transmission rate of a typed message.

foreach (char chr in lineToWrite)
{
    char[] buff = new char[1];
    buff[0] = chr;
    serialPort1.Write(buff, 0, 1);
    System.Threading.Thread.Sleep(300);
}



3) Is the port configured correctly?
In the simple serial class insert some code to log the values of all properties after the port has been opened.
e.g.
port.Open();
Debug.Print("Baud {0}", port.BaudRate);
// etc etc etc

and then make sure that your code uses the same settings.

Alan.
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 Pin
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 
AnswerRe: error handling Pin
Luc Pattyn2-Nov-11 4:25
sitebuilderLuc Pattyn2-Nov-11 4:25 
AnswerRe: error handling Pin
AditSheth1-Nov-11 18:32
AditSheth1-Nov-11 18:32 
GeneralRe: error handling Pin
Pete O'Hanlon1-Nov-11 21:04
mvePete O'Hanlon1-Nov-11 21:04 
GeneralRe: error handling Pin
BobJanova1-Nov-11 23:55
BobJanova1-Nov-11 23:55 
AnswerRe: error handling Pin
V.2-Nov-11 0:22
professionalV.2-Nov-11 0:22 
QuestionWin service jumps out Pin
suunker1-Nov-11 10:01
suunker1-Nov-11 10:01 
AnswerRe: Win service jumps out Pin
DaveyM691-Nov-11 11:22
professionalDaveyM691-Nov-11 11:22 
AnswerRe: Win service jumps out Pin
PIEBALDconsult1-Nov-11 13:32
mvePIEBALDconsult1-Nov-11 13:32 
QuestionTheming Custom Controls At Design-Time Pin
Matt U.1-Nov-11 8:48
Matt U.1-Nov-11 8:48 
AnswerRe: Theming Custom Controls At Design-Time Pin
BobJanova2-Nov-11 0:00
BobJanova2-Nov-11 0:00 
Questioncreate DSN for oracle programatically Pin
KKSharma31-Oct-11 22:56
KKSharma31-Oct-11 22:56 

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.