Weighbridge integration

anton1987anton1987 Member Posts: 35
I have recently done a weighbridge integration with the Nfcomm OCX.

But getting strange return from the weighbridge.
CLEARALL;
NFCOM.ClearBuff;
WBLocation.GET(Location);                                  
WBLocation.TESTFIELD("No. Characters to Retrieve");
WBLocation.TESTFIELD("Weight String Length");
IF WBLocation."Integration Type" = WBLocation."Integration Type"::"Continuous Transmission" THEN
   WBLocation.TESTFIELD("Weight Identifier");

I := 1;
WHILE I < 3 DO BEGIN
   NFCOM.ComX := WBLocation."COM Port";
   NFCOM.BaudRate := WBLocation."Baud Rate";
   NFCOM.DataBits := WBLocation."Data Bits";
   NFCOM.Parity := WBLocation.Parity;
   NFCOM.StopBits := WBLocation."Stop Bits";
   NFCOM.ClosePort;
   NFCOM.ClearBuff;
   NFCOM.OpenPort;
   TempRawStr := NFCOM.ReceiveStr(WBLocation."No. Characters to Retrieve");
   IF WBLocation."Debug Mode" THEN BEGIN
      IF CONFIRM(Debug900, TRUE, TempRawStr, STRLEN(TempRawStr)) THEN;
   END;
   ErrNo := NFCOM.CommError;
   NFCOM.ClosePort;
   CLEAR(NFCOM);
   IF ErrNo = -2 THEN
      I += 1
   ELSE
      I := 10;
END;

CASE TRUE OF
   ErrNo = -2: BEGIN
      ERROR(Err902);
   END;
   ErrNo <> 0: BEGIN             
      ERROR(Err900, ErrNo);
   END;
END;
CASE WBLocation."Integration Type" OF
   WBLocation."Integration Type"::"Manual Trigger": BEGIN
      WBLocation.TESTFIELD("Weight Start Character");
      TempRawStr := COPYSTR(TempRawStr, WBLocation."Weight Start Character",WBLocation."Weight String Length");
   END;
   WBLocation."Integration Type"::"Continuous Transmission": BEGIN
      CASE WBLocation."Marker Position" OF
         WBLocation."Marker Position"::"Before Weight": BEGIN
            TempStrPos := STRPOS(TempRawStr, WBLocation."Weight Identifier") + 1;
         END;
         WBLocation."Marker Position"::"After Weight": BEGIN
            TempStrPos := STRPOS(TempRawStr, WBLocation."Weight Identifier") - WBLocation."Weight String Length";
         END;
      END;
      IF TempStrPos <= 0 THEN
         CASE ReadingNo OF
            1: BEGIN
               ERROR(Err901, Text901);
            END;
            2: BEGIN
               ERROR(Err901, Text902);
            END;
         END;
      TempRawStr := COPYSTR(TempRawStr, TempStrPos, WBLocation."Weight String Length");
   END;
END;

IF WBLocation."Debug Mode" THEN BEGIN
   IF CONFIRM(Debug901, TRUE, TempRawStr) THEN;
END;                                                      

The weighbridge is supposed to send a text string as follows
$123456 for example but this seems to look correct in hyper terminal that it is indeed sending this value.

but when it get to navision and other software the string is read as follows
$0±6²60

One other strange thing is when I use a virtual comport everything seems fine.

Any ideas would greatly be appreciated.

Comments

  • ta5ta5 Member Posts: 1,164
    Are you sure your com port (not the virtual one) is configured properly concerning parity, etc.?
    Thomas
  • anton1987anton1987 Member Posts: 35
    Hi Tomas.

    My comport settings for both Hyperterminal and nav are as follows

    Comport = Com1
    BaudRate = 2400
    Databits = 8
    Parity = None
    Stopbits = 1
    Flowcontoll = Hardware.

    HyperTeminal See's the values as it is supposed to see it ie $123456

    but nav sees it differently.

    I can post my form that controlls how it all works online if that will help
  • ta5ta5 Member Posts: 1,164
    Hi Anton
    Can you test with another serial tool, just to be sure nfcom works ok. You can use a test version of active com port (http://www.activexperts.com/activcomport/), it's a very good tool.
    Good luck
    Thomas
  • travischetravische Member Posts: 1
    anton1987 wrote: »
    Hi Tomas.

    My comport settings for both Hyperterminal and nav are as follows

    Comport = Com1
    BaudRate = 2400
    Databits = 8
    Parity = None
    Stopbits = 1
    Flowcontoll = Hardware.

    HyperTeminal See's the values as it is supposed to see it ie $123456

    but nav sees it differently.

    I can post my form that controlls how it all works online if that will help

    Does anyone got a solution for this? Having the exact same problem :neutral:
  • OplauddlyOplauddly Member Posts: 2
    edited 2020-07-29
    travische wrote: »

    Does anyone got a solution for this? Having the exact same problem :neutral:delicerecipes.com

    exact same thing. i see the post is really old so hopefully there's going to be someone updating/ posting a solution. thanks
Sign In or Register to comment.