RS232 / Serial Scale Help

Post

Posted
Rating:
#1 (In Topic #739)
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Hi everyone

I need some advice

I am trying to get a scanner scale to send the weight to my application (I can get the barcode number with no problem)

I was sent this by the Manafactor

Single Cable:
RS232 Parameters:  9600, Odd, 7, 1, (recommended) - No software control
Weight Request:  STX, Address, FC, ETX, BCC
  STX = ASCII S (83 dec, 53 hex)
  Address = ASCII 1 (49 dec, 31 hex)
  FC (function code) = ASCII 1 (49 dec, 31 hex)
  ETX = ASCII CR (13 dec, 0D hex)
  BCC = Optional
Weight Format:  STX, 1, 1, xxxxx, ETX, BCC
Scale Cancel (optional - dependent on POS s/w):  STX, 1, 2, ETX

So working from this I have come up with this code

Code

Public STX As String = Chr(&H53)
Public Address As String = Chr(&H31)
Public FunctionCode As String = Chr(&H31)
Public ETX As String = Chr(&H0D)

Public Sub btnRequestWeight_Click()

    Write #RS232Scanner, STX & Address & FunctionCode & ETX

    Sleep 0.025
    
    Try Read #RS232Scanner, Global.ScaleData, Lof(RS232Scanner)
    
    If Error Then
        Print "Error With Incoming Serial Data"
    Else
        Print "Nothing from Scale"
    Endif
    
    If Len(Global.ScaleData) > 0 Then
        Print "Raw Scale Weight : " & CStr(Global.ScaleData)
        ' CleanUpBarcodeData(CStr(Global.ScannerData))
    End If
End

but I keep getting the Error Mesage "nothing from Scale" print

am I doing something wrong? any help or gidance would be most welcomed
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Regular
thatbruce is in the usergroup ‘Regular’

Code

Try Read #RS232Scanner, Global.ScaleData, Lof(RS232Scanner)
    
    If Error Then
        Print "Error With Incoming Serial Data"
    Else
        Print "Nothing from Scale"
    Endif

If it is printing "Nothing from scale" then there is no error, i.e. the Read worked.

Online now: No Back to the top

Post

Posted
Rating:
#3
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 So why is the scale not sending the weight?

I have even tried to send the Commands

Write #RS232Scanner, "S11\r"
Write #RS232Scanner, "S14\r"

But the scale still refuses to do anything (the scanner is still sending data to the PoS And this is on the same port)
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
Because you haven't told us, I have to ask the obvious.

At the

Code

If Len(Global.ScaleData) > 0 Then
line have you inserted a breakpoint and inspected the value of the Global and the value of Global.ScaleData?

b

Online now: No Back to the top

Post

Posted
Rating:
#5
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
I have done a print to the debug console and it is empty
Online now: No Back to the top

Post

Posted
Rating:
#6
Guru
BruceSteers is in the usergroup ‘Guru’
 I have no clue but..
I've seen issues using Sleep not Wait.

I've seen issues using CStr() not Str() to get values?
actually, looking at it, the Read command should read to a String variable  
Global.ScaleData should be a string , so CStr() is not needed. CStr converts a non string value to a String,

Does the Write command need a terminating Linefeed?

Are you receiving ANY info from the device using Read? Ie, you are sure the com link is working.
Online now: No Back to the top

Post

Posted
Rating:
#7
Guru
BruceSteers is in the usergroup ‘Guru’
I'd write it like this…

Code (gambas)

  1.  
  2. Public STX As String = Chr(&H53)
  3. Public Address As String = Chr(&H31)
  4. Public FunctionCode As String = Chr(&H31)
  5. Public ETX As String = Chr(&H0D)
  6.  
  7. Public Sub btnRequestWeight_Click()
  8.  
  9.     Write #RS232Scanner, STX & Address & FunctionCode & ETX
  10.  
  11.     Wait 0.1  ' wait a little longer
  12.      
  13.     Try Read #RS232Scanner, Global.ScaleData, Lof(RS232Scanner)
  14.    
  15.     If Error Then
  16.         Print "Error With Incoming Serial Data\n";; Error.Text
  17.     Else
  18.    
  19.       If Global.ScaleData Then
  20.         Print "Raw Scale Weight :";; Global.ScaleData
  21.         ' CleanUpBarcodeData(CStr(Global.ScannerData))
  22.       Else
  23.         Print "Nothing from Scale"
  24.       Endif ' no data if
  25.  
  26.     EndIf ' error if
  27.  
  28.  
Online now: No Back to the top

Post

Posted
Rating:
#8
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

BruceSteers said

I have no clue but..
I've seen issues using Sleep not Wait.

I've seen issues using CStr() not Str() to get values?
actually, looking at it, the Read command should read to a String variable  
Global.ScaleData should be a string , so CStr() is not needed. CStr converts a non string value to a String,

Does the Write command need a terminating Linefeed?

Are you receiving ANY info from the device using Read? Ie, you are sure the com link is working.

Yea I can get the barcodes from the device (it is a combined scanner / scale unit) and it sends the Barcode number out with no problem
Online now: No Back to the top

Post

Posted
Rating:
#9
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

BruceSteers said

I'd write it like this…

Code (gambas)

  1.  
  2. Public STX As String = Chr(&H53)
  3. Public Address As String = Chr(&H31)
  4. Public FunctionCode As String = Chr(&H31)
  5. Public ETX As String = Chr(&H0D)
  6.  
  7. Public Sub btnRequestWeight_Click()
  8.  
  9.     Write #RS232Scanner, STX & Address & FunctionCode & ETX
  10.  
  11.     Wait 0.1  ' wait a little longer
  12.      
  13.     Try Read #RS232Scanner, Global.ScaleData, Lof(RS232Scanner)
  14.    
  15.     If Error Then
  16.         Print "Error With Incoming Serial Data\n";; Error.Text
  17.     Else
  18.    
  19.       If Global.ScaleData Then
  20.         Print "Raw Scale Weight :";; Global.ScaleData
  21.         ' CleanUpBarcodeData(CStr(Global.ScannerData))
  22.       Else
  23.         Print "Nothing from Scale"
  24.       Endif ' no data if
  25.  
  26.     EndIf ' error if
  27.  
  28.  

Just tried that and I am sorry to say still nothing coming from the scale

Not sure if this will make a differance but this is my code i am using to open the comport (I asuume it is open to talk both ways)

Code (gambas)

  1. RS232Scanner = New SerialPort As "RS232Scanner"
  2.    
  3.     'Set up the Serial Device so it should start talking
  4.     With RS232Scanner
  5.         .PortName = "/dev/ttyS0"
  6.         .Speed = "9600"
  7.         .Parity = SerialPort.Odd
  8.         .DataBits = SerialPort.bits7
  9.         .StopBits = SerialPort.bits1
  10.         .FlowControl = SerialPort.None
  11.     End With
  12.    
  13.     Try RS232Scanner.Open(3)
  14.         If Error Then
  15.             Global.AddToListBox("Sorry Unable to connect to Scanner\nPlease check settings and try again")    
  16.         Else
  17.             If RS232Scanner.Status = Net.Active Then
  18.                 Global.AddToListBox("Ready to scan barcode")
  19.             End If
  20.         End If
  21.  
Online now: No Back to the top

Post

Posted
Rating:
#10
Guru
BruceSteers is in the usergroup ‘Guru’
How about setting up a read handler?

looking at the page /comp/gb.net/serialport - Gambas Documentation it has a number of other Events

Note: the below method is expecting the device to send text strings not binary values.

Code (gambas)

  1.     Try RS232Scanner.Open(3)
  2.         If Error Then
  3.             Global.AddToListBox("Sorry Unable to connect to Scanner\nPlease check settings and try again")    
  4.         Else
  5.             If RS232Scanner.Status = Net.Active Then
  6.                 Global.AddToListBox("Ready to scan barcode")
  7.                
  8.                 ' you may need to enable watching...
  9.                 RS232Scanner.Watch(gb.Read, True)
  10.  
  11.                 ' Attach the stream to "Scanner" in this class.
  12.                Object.Attach(RS232Scanner, Me, "Scanner")
  13.             End If
  14.         End If
  15.  
  16.  
  17. ' Then add a read event method for Scanner  (Ps, there are other events listed)
  18. ' PS. Sorry i was wrong about using Read giving a String.  Using stream.ReadLine() gives a string Read is binary :-\
  19.  
  20. Public Sub Scanner_Read()
  21. Dim sData As String
  22.   While Not Eof(RS232Scanner)
  23.     sData = RS232Scanner.ReadLine()
  24.     debug Quote(sData) ' lets see the result with escape chars in case the console is not showing data
  25.     Print "Recieved from Scanner:";; sData
  26.   Wend
  27.  
  28.  


I'd say your problem is probably either read/write is not set up properly or the command being sent is not the right format.
It's very very difficult for us to guess your problem with tiny snippets of code and none of us having the device you have.

I'd say you need the following..
More study on the differences between vb code and other examples you're finding and gambas code so your conversions look better.

More study on opening/reading/writing/watching streams
a bit more research to find some example code that uses your device. any programming language code should help give insights into the correct operation of the device.

Does it need a LF?
Write #RS232Scanner, STX & Address & FunctionCode & ETX & gb.Lf

Do the commands need to be sent individually?
Write #RS232Scanner, STX
Write #RS232Scanner, Address
Write #RS232Scanner, FunctionCode
Write #RS232Scanner, ETX

You are just going to have to play around with it till you crack it :)

PS. I do not have a device to test the above code so have no idea if it will work , it's just an example.
Online now: No Back to the top

Post

Posted
Rating:
#11
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
@BruceS,  Yes I was going to suggest the same but I still haven't got an answer from AndyGable to my question
At the

Code: Select all

If Len(Global.ScaleData) > 0 Then

line have you inserted a breakpoint and inspected the value of the Global and the value of Global.ScaleData?


AndyGable ,
I have done a print to the debug console and it is empty
is the answer to a different question. Printing something and inspecting something are not the same.

Online now: No Back to the top

Post

Posted
Rating:
#12
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

thatbruce said

@BruceS,  Yes I was going to suggest the same but I still haven't got an answer from AndyGable to my question
At the

Code: Select all

If Len(Global.ScaleData) > 0 Then

line have you inserted a breakpoint and inspected the value of the Global and the value of Global.ScaleData?


AndyGable ,
I have done a print to the debug console and it is empty
is the answer to a different question. Printing something and inspecting something are not the same.

Hi thatbruce

the Global.ScaleData is empty nothing is being placed into it
Online now: No Back to the top

Post

Posted
Rating:
#13
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
Hoowee. We are really going to have to go back to basics here.

Going back to your original post :
You appear to be setting STX, which I presume is the ANSI "start transmission" character, to &H53. But 53 is the printable "S" character ?
STX is $H02
Any reason for this discrepancy?

Also, according to your "Manafactor" ETX is a "CR" character, &0D which is a bit strange. But if they really mean it then ok.
Their REQUEST string is "Weight Request": STX, Address, FC, ETX, BCC where the BCC is optional (and is a low level and I mean UART level character added to the TX sequence).
So you should be sending (in hex):
02;31;31;0d
of which I find that 0D a bit weird in that why does it need a C/R and no ETX

Can you post a link to that "Manafactor" document.
b

Online now: No Back to the top

Post

Posted
Rating:
#14
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
Just to summarise where we are at the moment regarding Gambas.
<LIST>
  • <LI>Your program is using a Write command to send a request to the scale.</LI>
</LIST>
<LIST>
  • <LI>Your program waits a little while</LI>
</LIST>
<LIST>
  • <LI>It then attempts to get the scale's response using a Try Read construct</LI>
</LIST>
Now this read succeeds because it <COLOR color="#FF0000">almost always will*</COLOR>. By using Try Read you are essentially saying "Check for any data in the buffer and if so, stick it in Global.ScaleData". So the command will always work, there will be no error. Thus the "If Error" part will never happen and the "Else" part always will.
<LIST>
  • <LI>Your program then tests to see if the Read actually found some data.</LI>
</LIST>
As you say, it doesn't

Hence the above post.

* The only example I can think of is when someone runs away with the scale exactly during your Sleep pause.

Online now: No Back to the top

Post

Posted
Rating:
#15
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

thatbruce said

Hoowee. We are really going to have to go back to basics here.

Going back to your original post :
You appear to be setting STX, which I presume is the ANSI "start transmission" character, to &H53. But 53 is the printable "S" character ?
STX is $H02
Any reason for this discrepancy?

Also, according to your "Manafactor" ETX is a "CR" character, &0D which is a bit strange. But if they really mean it then ok.
Their REQUEST string is "Weight Request": STX, Address, FC, ETX, BCC where the BCC is optional (and is a low level and I mean UART level character added to the TX sequence).
So you should be sending (in hex):
02;31;31;0d
of which I find that 0D a bit weird in that why does it need a C/R and no ETX

Can you post a link to that "Manafactor" document.
b

That information I posted on the first page was the document I was sent by Datalogic

i know foe 100% that the scale works as it works with my windows PC and my windows software
Online now: No Back to the top

Post

Posted
Rating:
#16
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
This is the full file that was sent by Datalogic


Dual Cable (SASI):
RS232 Parameters:  9600, Even, 7,1 - No Flow Control
Weight Request:  ASCII W (87 dec, 57 hex)
Weight Format: STX, xx.xxx, CR
 
Dual/Single Cable (ICL):
RS232 Parameters:  2400, Even, 7,1 - works with ACK/NAK
Weight Request:
1. Enquire (scale status): ASCII ENQ (05 dec, 05 hex)
Answers:  
Error = NAK
Weight Not Stable = NUL (00 dec, 00 hex)
Weight OK = ACK (06 dec, 06 hex)
2.  Data Request:  ASCII DC1 (17 dec, 11 hex)
Answers:
Error = NAK (05 dec, 05 hex)
Data = STX, Status, xxxxx, BCC, ETX


Single Cable:
RS232 Parameters:  9600, Odd, 7, 1, (recommended) - No software control
Weight Request:  STX, Address, FC, ETX, BCC
  STX = ASCII S (83 dec, 53 hex)
  Address = ASCII 1 (49 dec, 31 hex)
  FC (function code) = ASCII 1 (49 dec, 31 hex)
  ETX = ASCII CR (13 dec, 0D hex)
  BCC = Optional
Weight Format:  STX, 1, 1, xxxxx, ETX, BCC
Scale Cancel (optional - dependent on POS s/w):  STX, 1, 2, ETX
 
To do this in Hyperterminal you need to do it via sending a text file.

So to send STX do an alt function 002,S11,Enter,Alt Function 003

Or do via another program that sends data in Hex


test in com test serial single cable option.

send the following command to get weight, then put the weight on.
\x53\x31\x31\x0D
A comtest session is saved in the FRS folder for RS232 SC Host command examples.
Online now: No Back to the top

Post

Posted
Rating:
#17
Guru
BruceSteers is in the usergroup ‘Guru’
send the following command to get weight, then put the weight on.
\x53\x31\x31\x0D

Well i wish you'd posted that in the first post.
I'm not sure what it means but i bet the other Bruce has a pretty good idea after seeing their example of sending the command.
far easier to understand than "what are you doing wrong"

did you try
Write  #RS232Scanner, "\x53\x31\x31\x0D"

 :)
Online now: No Back to the top

Post

Posted
Rating:
#18
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
I'm not sure what it means but i bet the other Bruce has a pretty good idea after seeing their example of sending the command.
far easier to understand than "what are you doing wrong"
Hey man, it took me three whole days to set up the GF's cash register in the pub. The people who write these POS manuals really should be taken out and horsewhipped. This is why I'm trying to go through this step-by-step (and keep asking what seems to be inane questions like what follows).

Andy,
1) What connector types are involved at your computer end here, DB25, DB9, USB, RSJ45, RSJ65?
That may seem a ridiculous question, but DataPoint use different software protocols (at the application message level) for different cables.
2) That file they sent you is self-contradictory and basically looks like something that was thrown together randomly.
a) "Weight Request: STX, Address, FC, ETX, BCC" - Let's assume that is the correct request for your scale and cables.
A bit of a look through a couple of datapoint manuals reveals that the STX character used by the scale is actually <COLOR color="#FF0000">programmable</COLOR>. So we need to find out what is is for the scales in question (or reset them). Also if you look at the schematics of these POS systems you will find that each component has its own processor, IO controller and UARTS in it. So whats good for the barcode scanner may not be the same for the scales (or the display etc). However, lets assume that for your scales the STX character is &H53 (the "S" character). Which
  1. makes their
So to send STX do an alt function 002,S11,Enter,Alt Function 003
line bullshit. (But it might be a half-garbled bit of "Hyperterminal" text and so is absolutely useless here.)
c) So looking at a couple of their technical specs it does appear that some, but not all, of their scales do have a default STX value of "S". Sheesh. Some comms programmers need horsewhipping as well.

Can you determine what the STX character really is for your test scales?
Are you trying to program for only one scales model, or multiple. If the latter we are going to have to find out how to query the damn things to get the STX character they are using.

My brain is starting to hurt and we have only looked at one character in the stream  :(  - more later/tomorrow.

b

Online now: No Back to the top

Post

Posted
Rating:
#19
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
thatbruce

I totally agree with you on the user manals for Point of sale hardware they are not done very well at all

I have the fun job of converting over from Windows the Printer, Cash drawer and card processing modules (they are NOT going to be fun but I have a example of the cash drawer status support in FreeBASIC) The hard part is going to figure out how the Printer status data

anyway in replay to your requests please see below

  1. I am using a DB9
  2. That was the only thing I received from Datalogic (I do have access to a C app that was designed to work with the scanner / scale but i'm being told it is not complete

3) Can you determine what the STX character really is for your test scales? I would have to look at the documents and come back to you on that one

4) I am going to use a Module per scale (but Datalogic is saying the wight command should work for all thier Scanner / scales ranges)

My brain is starting to hurt and we have only looked at one character in the stream :( I am sorry for this your brain is hurting mine is about to melt
Online now: No Back to the top

Post

Posted
Rating:
#20
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
Morning Andy,

Another side-ways question: Is there a device access controller (DAC or sometimes EAC, LAC or DCU <COLOR color="#BFFFFF">or even FIIK</COLOR> depending on the POS brand)? Because if so we may need to find out how to talk to it rather than the individual parts.

Regardless of that, good a DB9 connector usually means we are dealing with a fairly basic electronics system. By basic I mean they tend to follow the old serial comms protocols.

… hmmmm thinks

BINGO! I now see what this STX = "S" crapola is all about (and why there is no proper ETX). They are only talking about the message content, but <COLOR color="#FF0000">they are using flow control terms to describe it</COLOR>.  :evil:  :evil:  :evil: Right, the conversation is fundamentally:

Code

Computer sends "Weight Request" -> Operator puts item on scale ->  Scale measures weight -> Scale sends "Weight Format"
Alternatively and not specified is what happens if the item is not put on the scale or … or … or … (We may have an "or" here.)

But assuming everything is tickety-boo. Lets look at what I think they really mean.

The "Weight Request" message sent by the computer in one burst is :

Code

["Hey POS"]["Connect me to the scales"]["Hey scales, do a '1' function"]["That is all" and stops talking]
which they have specified as :

Code

[ STX ][ Address ][ FC ][ ETX ] or
[ S ][ 1 ][ 1 ][  C/R  ]
Now, we can do all that without resorting to hex at all. Just Write #RS232Scanner, "S11\n" should do it.

(miracle occurs here. The scale figures out it has something on it, measures its weight and sends a message back to the computer.)

The "Weight Format" message you should get is :

Code

[ STX ][ Address ][ FC ][ xxxxx ][ ETX ] or
[ S ][ 1 ][ 1 ][ <the weight I guess> ][ C/R ]
and as you implied originally,  that should be just a string of ascii characters. So, if
Read #RS232Scanner, Global.ScaleData, Lof(RS232Scanner) is giving an empty string instead of "S11xxxxx\n" then something is very wrong somewhere.

Let's try something silly…

Code

Public Sub btnRequestWeight_Click()

    Stream.EndOfLine = gb.Mac        ' Trust me, I am an expert

    Write #RS232Scanner, "S11\n"

    LineInput #RS232Scanner, Global.ScaleData

    If Not Global.ScaleData Then
        Print "Error With Incoming Serial Data"
    Else
        Print "Raw Scale Weight : "; Scan(Global.ScaleData, "S11*")[0]
    Endif

End

What happens?

b

Online now: No Back to the top

Post

Posted
Rating:
#21
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Hi thatbruce

I copied your code and I got a error saying End of file in FMain:108 and it is heighlighting the line Line Input #RS232Scanner, Global.ScaleData

Code (gambas)

  1. Public Sub btnRequestWeight_Click()
  2.      RS232Scanner.EndOfLine = gb.mac        ' Trust me, I am an expert
  3.    
  4.     Write #RS232Scanner, "S11\n"
  5.      
  6.     Line Input #RS232Scanner, Global.ScaleData
  7.  
  8.     If Not Global.ScaleData Then
  9.         Print "Error With Incoming Serial Data"
  10.     Else
  11.         Print "Raw Scale Weight : "; Scan(Global.ScaleData, "S11*")[0]
  12.     Endif
  13.  End
  14.  

*I had to update the Endofline to work with my RS232Scanner steam

This is what I am using to read the barcode from the scanner side

Code (gambas)

  1. Sleep 0.025
  2.    
  3.     Try Read #RS232Scanner, Global.ScannerData, Lof(RS232Scanner)
  4.    
  5.     If Error Then
  6.         Print "Error With Incoming Serial Data\n";; Error.Text
  7.     Endif
  8.    
  9.     If Len(Global.ScannerData) > 2 Then
  10.         Print "Raw Barcode Number : " & CStr(Global.ScannerData)
  11.         CleanUpBarcodeData(CStr(Global.ScannerData))
  12.     Endif
  13.  

If you know of a better why I am more then willing to see what you would do (best way to learn)
Online now: No Back to the top

Post

Posted
Rating:
#22
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
I copied your code and I got a error saying End of file in FMain:108 and it is heighlighting the line Line Input #RS232Scanner, Global.ScaleData
Good! Now we are getting somewhere. It looks like there is nothing in the input buffer as the Line Input is not waiting for some data.

Try this version

Code

Public Sub btnRequestWeight_Click()
     
    RS232Scanner.EndOfLine = gb.mac
    RS232Scanner.Blocking = True
  '  From the wiki: When this property is set, reading from the stream will block if there is nothing to read
     
    Write #RS232Scanner, "S11\n"
       
    ' Take little naps for a while to let anything happen like de operator putting de bananas on de scales
    While not Eof(#RS232Scanner)
        Wait 0.25 ' zzzz for 1/4 sec
    Wend
    ' TODO: If that loops forever, then I'm wrong. Let me know.

    Line Input #RS232Scanner, Global.ScaleData
 
    If Not Global.ScaleData Then
        Print "Error With Incoming Serial Data"
    Else
        Print "Raw Scale Weight : "; Scan(Global.ScaleData, "S11*")[0]
    Endif
 End

*I had to update the Endofline to work with my RS232Scanner steam
Ah, yes. I did wonder whether the static version would work in this situation. Don't forget I'm working blindly here, the only serial device at this location is me, so I can't check the code I'm posting. Also, the code "should be" atomic and you shouldn't have to make changes elsewhere to get it to work. So if other things break, undo it (use a dedicated branch for this stuff and use git revert? (or whatever it is)) and tell me.

Online now: No Back to the top

Post

Posted
Rating:
#23
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

Code (gambas)

  1.     RS232Scanner.EndOfLine = gb.mac
  2.     RS232Scanner.Blocking = True
  3.   '  From the wiki: When this property is set, reading from the stream will block if there is nothing to read
  4.      
  5.     Write #RS232Scanner, "S11\n"
  6.     Write #RS232Scanner, "S14\n"
  7.        
  8.     ' Take little naps for a while to let anything happen like de operator putting de bananas on de scales
  9.     'While Not Eof(RS232Scanner)
  10.     '    Wait 0.25 ' zzzz for 1/4 sec
  11.     'Wend
  12.     ' TODO: If that loops forever, then I'm wrong. Let me know.
  13.  
  14.     Line Input #RS232Scanner, Global.ScaleData
  15.  
  16.     If Not Global.ScaleData Then
  17.         Print "Error With Incoming Serial Data"
  18.     Else
  19.         Print "Raw Scale Weight : "; Scan(Global.ScaleData, "S11*")[0]
  20.     Endif
  21.  End
  22.  

Hi thatbruce,

I tired your code and the app just sits there doing nothing if I Step though the code it just sits on the

Line Input #RS232Scanner, Global.ScaleData Line

And yes I had to comment out the loop command otherwise It was just in the loop for ever

<IMG src="https://support.algpos.co.uk/images_help/barcodeReader-incoming.png"> </IMG>
this is just to show you I am getting data from the scanner side (so the scanner/scale is communicating to the Computer)
Online now: No Back to the top

Post

Posted
Rating:
#24
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
Woah! Where'd that
  Write #RS232Scanner, "S14\n"
come from?

Online now: No Back to the top

Post

Posted
Rating:
#25
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Sorry according to the C program it was needed (I must have forgotten to remove that before sending it to you)
Online now: No Back to the top
1 guest and 0 members have just viewed this.