none
weighing machine output format

    Question

  • Hello everybody

    I have a project where I have to received the output from a weighing machine into computer and than catch in my software.

    The weighing machine information is as follows.

    Company Name   - Supertech

    Model No. - EMWP

    Machine is connected via 9 pin connector and using serial port

    Machine sends output at Hiper Terminal 1200 Broad Rate (I don't understand what does its mean)

    Now how can I received the weight shown on the machine's screen into a field for further use.

    Thanks In Advance

    Deepak Kharpate


     

    Sunday, January 15, 2012 7:22 AM

Answers

  • Hi Deepak

    COM1 is your Serial Port # where is your weighing Machine is connected. 1200 Baud Rate is Speed.

    Sample Code

    * Open Connection to scale

    nHandle = fopen("com1:1200,n,8,1",2)
    =fflush(nHandle)

    * Send Command
    nRet = fputs(nHandle,"GIVE_WEIGHT")
    =fclose(nHandle)

    * Read Result
    nHandle = fopen("com1:9600,n,8,1",0)
    cScaleValue = ""
    do while true
    cRead = fread(nHandle,1)
    if cread = chr(13)
    exit
    else
    cScaleValue = cScaleValue + cRead
    endif
    enddo
    =fclose(nHandle)

    above code is general code to read weight from Weighing Machine. 

    you can ask detailed question SuperTech Technican to Read Weight from Weigh Machine.

     

    Regards

    Kalpesh


    Please "Mark as Answer" if this post answered your question. :)

    Kalpesh Chhatrala | Software Developer | Rajkot | India

    Kalpesh 's Blog

    VFP Form to C#, Vb.Net Conversion Utility
    Sunday, January 15, 2012 9:47 AM

All replies

  • Hi Deepak

    COM1 is your Serial Port # where is your weighing Machine is connected. 1200 Baud Rate is Speed.

    Sample Code

    * Open Connection to scale

    nHandle = fopen("com1:1200,n,8,1",2)
    =fflush(nHandle)

    * Send Command
    nRet = fputs(nHandle,"GIVE_WEIGHT")
    =fclose(nHandle)

    * Read Result
    nHandle = fopen("com1:9600,n,8,1",0)
    cScaleValue = ""
    do while true
    cRead = fread(nHandle,1)
    if cread = chr(13)
    exit
    else
    cScaleValue = cScaleValue + cRead
    endif
    enddo
    =fclose(nHandle)

    above code is general code to read weight from Weighing Machine. 

    you can ask detailed question SuperTech Technican to Read Weight from Weigh Machine.

     

    Regards

    Kalpesh


    Please "Mark as Answer" if this post answered your question. :)

    Kalpesh Chhatrala | Software Developer | Rajkot | India

    Kalpesh 's Blog

    VFP Form to C#, Vb.Net Conversion Utility
    Sunday, January 15, 2012 9:47 AM
  • Dear Kalpesh

    I have tried at my customer place with your suggested codes but this not working.

    I was not able to get the weight displayed on weighing machine into my software.

    can you tell me whats wrong with the implementation and if possible please suggest me another codes for doing so.

     

    Thanks

    Deepak

     

    Wednesday, January 18, 2012 8:26 AM
  • That sample code for sure is just meant as a sample. There is no standard for scales. For example not every scale will correspond to  a command "GIVE_WEIGHT", that's very much depending on your model.

    For example I handle sartorius scales and the need a command ESC+"P" as in "PRINT". Don't try this code unchanged, gat a grip on your scale manual or ask the vendor, this must specify which commands it supports, also com seetings like baud rate and parity and other technical stuff needs to match the scale configuration.

    Accessing scales is very individual programming, not one code fits all.

    Bye, Olaf.

    • Edited by Olaf Doschke Wednesday, January 18, 2012 8:31 AM
    Wednesday, January 18, 2012 8:30 AM
  • Hi,

     

    I worked more than 10 years in the weighing industry and made a lot of integrations with scales.

    As I was working for the manufacter I knew the commands needed by the scale.

     

    First I need to confirm that the above code is the right way to do it.

    I also connected sometimes Sartorius together with our Avery-Berkel Weightronix scales but we didn't work the same way as Sartorius.

    It could be something like ANY_WEIGHT for example.

    Later on it was then the USA version and it was also another communications.

    BTW, mighty VFP is one of the best ways for working with devices like scales.

     

    Depending on the way how the scale was setup and also the kind of scale you could have different communications:

     

    First one is send the weight with the print button.

    Second one is the called "Prepack mode", it resends the weight with every new stable weight that is significantly different from the last one.

     

    In these 2 cases you need to trigger the OnCom() event and to read it.

     

    Another case could be with an ACK-NAK protocoll, that is some more complicated.

    Also some scales give the possibility to send commands to the scale and answer on that.

    In that case the above code should apply by replacing the message with the correct one.

    Then always listen to the OnCom() event.

     

    If you want us to help you, copy and paste the pages in the scales manual about the communication.

     

    The easiest way to trigger the output of the scale is to use the Windows Terminal or Hyperterminal but it has been removed from actual Windows :(

     


    • Edited by AlainSat Thursday, January 19, 2012 11:33 AM
    Thursday, January 19, 2012 11:29 AM
  • HI , I need your help!!!!

    I'm working with a sartorius but not recovery the wigth in my aplicattion

    can u help me please???

    Wednesday, October 30, 2013 7:05 PM