|
-
Dec 16th, 2010, 12:10 PM
#26
Re: Serial Port not writing back
 Originally Posted by dbasnett
Some of that code looks familiar, right down to the names.
I'm not surprised. Every time I find some slicker way to do this routine, I tweak the code and I know I've cribbed a lot of this routine off of here and Dick Grier's book. I believe the last change I did to it was fairly recently was I saw a way to use SerialPort.Read() rather than .ReadExisting() which I formerly used. The full routine though has a send-message queue, handles about 30 different scale indicators on the market, and has an off-thread that monitors connectivity and activity. It's also part of a UserControl and has a lot of UI functions for that as well.
 Originally Posted by Dubya007
I'm a little unclear as to how to get the weight actually show up on the form now. (sorry I've not programmed like this in years)
Which sub or function will i have to call in order to accomplish this?
Ok, first, make SURE your Mettler Toledo indicator is turned on in a streaming mode (or you're not going to get anything anyways since it's not sending anything). You can check to see if you're getting data via a program like Hyperterminal or any other terminal emulator like Putty.
Streaming mode means the indicator is sending weight information all the time, non-stop, whether the computer is listening or not.
Call Open_SerialPort. At this point, the computer begins listening and you should immediately be getting data in. The weighScale_DataReceived() routine will automatically be firing as the port detects new data coming in; if you put a breakpoint in that routine, you'll see it get hit now.
If the breakpoint doesn't get hit, then there's no data coming in on the port and either your port settings are off, or the indicator isn't transmitting anything.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|