views:

138

answers:

2

How to? I am using SerialPort.Write function and it looks like it works most of the time, but out of the blue it just stops working.

I also noticed that every time I send the command to print (even though I follow the manual, P with carriage return), I get string containing "ES" back - which according to the manual means error even though the weight is captured. Then suddenly, the scale stops reacting to the print command at all.

here is my code:

                    //send the print command to the balance:
                 Byte[] bytes = {80, 13}; //50 0D


                _sp.Write(bytes,0,bytes.Length);

_sp is an instance of SerialPort class. I am using OHAUS CD-11 balance; app is written with c# on compact framework 2.0, hp thin client, WinCE 5.0

Any ideas are appreciated. SHould be simple to do but apparently not.

A: 

Are you sure your baud rate / stop bits etc. are right (see page 12 & 13 in the manual)?

MarkusQ
yes, like I said the weight gets printed out and then suddenly stops.when the users use PRINT button on the balance, it's all good. all the serial port settings are checked and re-checked.I am just having issues with Write command.
gnomixa
A: 

Maybe just CR doesn't work even though the manual suggests it does? i.e. Have you tried

Byte[] bytes = {80, 13, 10}; //50 0D 0A
Dave
just tried this too, I still get ES back.Looking to give up at this point, not sure what else i can send to this balance w/o getting an error back.
gnomixa
Do you have access to other software that drives the balance over the serial link. There are programs that will let you capture the serial link traffic which would let you see the differences between your program and one that works (sorry, can't remember the name of any though...).
Dave