digital scale/ indicator in vb
digital scale/ indicator in vb
digital scale/ indicator in vb
digital scale/ indicator in vb
digital scale/ indicator in vb
digital scale/ indicator in vb digital scale/ indicator in vb digital scale/ indicator in vb digital scale/ indicator in vb digital scale/ indicator in vb digital scale/ indicator in vb digital scale/ indicator in vb digital scale/ indicator in vb
digital scale/ indicator in vb digital scale/ indicator in vb
digital scale/ indicator in vb
Go Back  Xtreme Visual Basic Talk > > > digital scale/ indicator in vb


Reply
 
Thread Tools Display Modes
  #21  
Old 04-12-2011, 05:58 AM
vdex vdex is offline
Newcomer
 
Join Date: Apr 2011
Posts: 19
Default


i see..
but i don`t know the meaning by putting a break point on the event handler.
that`s why i have been avoid from doing that.

can you show me some example?
Reply With Quote
  #22  
Old 04-12-2011, 06:37 AM
PlausiblyDamp's Avatar
PlausiblyDampdigital scale/ indicator in vb PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Put your cursor on the line
Code:
Private Shared Sub DataReceviedHandler(ByVal sender As Object, ByVal e As  SerialDataReceivedEventArgs)
and go to the debug menu and select New Breakpoint, or just press F9 while the cursor is on the line.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #23  
Old 04-15-2011, 05:43 AM
namrekka namrekka is offline
Junior Contributor
 
Join Date: Feb 2005
Location: Netherlands
Posts: 219
Default

Hmmm......
Most scales will send if weight is put.
Are you sure the rs232-connection is ok? Straight or 0-modem? RTS/CTS connections etc?
Reply With Quote
  #24  
Old 04-18-2011, 01:51 AM
vdex vdex is offline
Newcomer
 
Join Date: Apr 2011
Posts: 19
Default

>>namrekka

im not sure its type

its feature states :
-converts a standard USB to 9-pin serial port
-fully compliant with USB 1.1 and USB CDC v1.1
-USB full speed communication and bus powered.
-supports RS232 serial interface(standard 9-pin serial)
-supports up to 1Mbps data transfer rate
-supports remote wake-up and power management
-supports automatic handshake mode
-single cable USB to serial communication
-draws power directly form usb requiring no additional power adapter
-support plug and play specification

from the device manager, its display name is ports(COM & LPT)
Reply With Quote
  #25  
Old 04-18-2011, 02:03 AM
vdex vdex is offline
Newcomer
 
Join Date: Apr 2011
Posts: 19
Default

>>PlausiblyDamp

Imports System
Imports System.IO.Ports
Imports System.Threading
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.SerialPort1.Close()
Me.SerialPort1.PortName = "COM4"
Me.SerialPort1.BaudRate = 9600
Me.SerialPort1.Parity = IO.Ports.Parity.Odd
Me.SerialPort1.DataBits = 7
Me.SerialPort1.StopBits = IO.Ports.StopBits.One
AddHandler Me.SerialPort1.DataReceived, AddressOf DataReceviedHandler
Me.SerialPort1.Open()

Me.lbltrial.Text = Me.SerialPort1.BytesToRead
Me.TextBox1.Text = Console.Read



End Sub

Private Shared Sub DataReceviedHandler(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs)
Dim sp As SerialPort = CType(sender, SerialPort)
Dim indata As ULong = sp.ReadExisting()
Console.WriteLine("Data Received:")
Console.Write(indata)
End Sub

End Class

ady try out the breakpoint..
no difference but
-1 for the console.read()
0 for the bytestoread()

i mean.. like never run for the event..
Reply With Quote
  #26  
Old 04-18-2011, 07:42 AM
mkaras's Avatar
mkarasdigital scale/ indicator in vb mkaras is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Mar 2004
Location: Beaverton, OR
Posts: 1,874
Default

In the lab at your school is there any way that you can get someone with an oscilloscope to see if there is any signalling coming from the scale serial port connector? Until you know for sure that the scale is outputting something you are really wasting your time trying to receive something into software.

Michael Karas
Reply With Quote
  #27  
Old 04-18-2011, 08:41 AM
mkaras's Avatar
mkarasdigital scale/ indicator in vb mkaras is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Mar 2004
Location: Beaverton, OR
Posts: 1,874
Default

Some more information from just a few minutes of investigation...

The previously linked manual is not at the actual manufacturer web site. Instead the actual manufacturer site is:
http://www.andonline.com/weighing/pr..._num=JM_Series

If you look in the manual they say that to get the scale to work with the UPS World Ship software you have to configure the software as follows:

"b. Configure the UPS Online software for a Fairbanks 70-2453-4 scale."

This should give the clue that the protocol of your AND scale is same as the Fairbanks scale.

I suggest that you download the UPS WorldShip software and and try to get it working with your scale. As long as your USB serial cable shows as COM1 to COM4 it should work with the software set into Fairbanks 70-2453-4 mode.

There are other scale types supported by this software too. You can see here:
http://www.ups.com/content/us/en/res...ri/wor141.html

If you can get it working with the WorldShip software then you have several options to get to the root of the necessary protocol to talk to your AND scale.

1) Search diligently on the web to see if you can find protocol information for the the Fairbanks 70-2453-4 scale.

2) Contact AND scales directly and ask them for protocol information for the JM series. They are a USA company and I would find it hard to believe they wouldn't share this this information for a student research project.

3) Setup your PC with serial port snooping capability and capture the serial data flow between the port and the WorldShip software so that you can see first hand what gets sent over the wire. Snoopers of two types are available. One type uses two COMM ports and a special cable to TEE into the serial flow at the scale DB9 connector. The other type of snooper wedges into the COM4 stream that flows between the USB cable driver and the WorldShip software.

4) Get use of an oscilloscope to get basic serial port parameters for the working WorldShip to scale protocol. You should also be able to determine by this method if the scale is one that simply outputs all the time or is one that requires a command in order to spill out its message.

5) As a last resort chalk up your decision to purchase a scale without decent and complete information as a bad bad decision and purchase something else that does come with decent documentation and protocol definitions.

At this point I would say that your possibility for success will depend 100% on how diligent you are at rolling up your sleeves and getting into full learn and work mode.

Michael Karas
Reply With Quote
  #28  
Old 04-18-2011, 10:57 AM
namrekka namrekka is offline
Junior Contributor
 
Join Date: Feb 2005
Location: Netherlands
Posts: 219
Default

You also can use a "Terminal" program. Such a program will show any RS232 signals comming in on your screen and uses your keyboard to send info out.
With this you can test the cabling, scale and protocol.
Reply With Quote
  #29  
Old 04-18-2011, 12:38 PM
mkaras's Avatar
mkarasdigital scale/ indicator in vb mkaras is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Mar 2004
Location: Beaverton, OR
Posts: 1,874
Default

The "terminal" program is a very good start but may not be useful in two cases.

1) If the target device requires some serial data traffic stimulous to get it going there could be a lot of the "1 million monkeys at typewriters" trial and error to discover the magical recipe.

2) Terminal mode falls apart to a large degree if the protocol uses binary format date instead of ASCII type communications. If commands sent to the scale were packet type things that require CRCs the terminal will present some extreme difficulty.

Michael Karas
Reply With Quote
  #30  
Old 04-20-2011, 03:52 AM
mkaras's Avatar
mkarasdigital scale/ indicator in vb mkaras is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Mar 2004
Location: Beaverton, OR
Posts: 1,874
Default

Some additional information...

At the following link is a document that describes testing a postal digital weighing scale using the HyperTerm program under Windows XP. Now whilst this document is not directly applicable to the OPs AND scale or to the Fairbanks 70-2453-4 mode of operation it does give some information that could be quite helpful.

http://us.mt.com/global/en/home/supp...le_7-23-09.pdf

Looking on the last page of this document it is quite apparent that many scales will require a command to be sent to them in order to get them to spill out their current weight reading. A common command is a W followed by a <CR>.

Have fun.

Michael Karas
Reply With Quote
  #31  
Old 04-21-2011, 03:17 AM
vdex vdex is offline
Newcomer
 
Join Date: Apr 2011
Posts: 19
Default

hyperterminal doesnt show anything..
is that telling us either my device does not support data receive in computer?
Reply With Quote
  #32  
Old 04-21-2011, 03:26 AM
vdex vdex is offline
Newcomer
 
Join Date: Apr 2011
Posts: 19
Default

i had tried many third party software that could read data from digital scale,

www.billproduction.com
http://www.andonline.com/weighing/su...are_downloads/
collect v6.1
hyperterminal

hence, i worried that the device doesnt allow me getting anything from it.
(still i hope its just the cable i used not suitable)
Reply With Quote
  #33  
Old 04-21-2011, 03:41 AM
PlausiblyDamp's Avatar
PlausiblyDampdigital scale/ indicator in vb PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Without knowing what the scale expects to hear from your application before it transmits a signal it doesn't matter what tool you connect to the device.

You will need to know how to communicate with the device properly based on it's defined protocol, this will often (and this has already been mentioned) expect you to ask it for it's current reading before it will send the value.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #34  
Old 04-21-2011, 04:02 AM
namrekka namrekka is offline
Junior Contributor
 
Join Date: Feb 2005
Location: Netherlands
Posts: 219
Default

At this link, mkaras supplied, you can find an instruction manual with a cable layout. You have to check the wiring. There is no such thing as a standard RS232 cable!

http://www.andonline.com/weighing/pr..._num=JM_Series
Reply With Quote
  #35  
Old 04-21-2011, 08:26 AM
AtmaWeapon's Avatar
AtmaWeapondigital scale/ indicator in vb AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

Quote:
Originally Posted by vdex View Post
hyperterminal doesnt show anything..
is that telling us either my device does not support data receive in computer?
Here's one way to look at it.

Suppose an extraterrestrial landed and set up a tent in your backyard. You want to ask him what he's up to, but every time you approach and try to speak he ends up looking frustrated and angry because neither of you can understand the others' language. He keeps looking at a book that looks like it might serve as a whatever to English dictionary, but he obviously doesn't have the apparatus to pronounce English and you can't read the runes of his language that describe the phonemes. Why doesn't he just point at words? The book uses infrared ink and only the cover is visible to you.

An extraterrestrial landing is a pretty big deal, so some people contact you. Among them is a linguist. Your yard (and your house) are on quarantine, so the linguists can't directly approach the visitor. All you can do is say some things to the visitor, record what noises he makes, then take that recording back to the linguists, who will ponder over it and occasionally advise you to try some sounds or gestures.

This is where you sit with the scale. It's a black box with a serial port. You know it can communicate through this serial port, and you know some information about how the port should be configured. But you don't know exactly which kind of cable you need or the protocol the scale uses.

That whatever to English dictionary in infrared represents the scale's vendor. They know what protocol their scale uses because it's their scale. If you could find a way to contact them directly it's possible they could solve your problem in an instant.

This forum is the linguists stuck outside the quarantine zone. We have experts that have experience with serial communication, but without protocol documentation all they can do is say "try this and see what happens" based on their current knowledge. For all they know, the scale might want you to speak some magic words at it before sending its data. Perhaps there's a toggle switch. Maybe it wants you to buy it flowers. This could go on forever. Maybe namrekka's link has all the information you need. I'm hardheaded and would have given up by now.

It might be a bit hardheaded to decide that you will *make* this scale work. You said it was for your final year project; that deadline isn't getting any farther away and we've made little progress in 18 days. Maybe I'm getting old, but I'm starting to feel money's less valuable than time. You could pick up another scale and have 60 years left to get your money back, or you could put your project and the time you've spent on your schooling at risk by trying to save the money. I'd almost always take a shot at losing some money to save time than saving money to lose a lot of time, but then I don't have all the information about your situation. Maybe you're the kind of student who actually started on the project with months to spare and it's just not crucial yet.

I can say if you want to keep on working, why not start the project and abstract the scale away? You can write some dummy interface:
Code:
Interface IScale
    Function GetTemperature() As Double
End Interface
And for all the project cares you might just use this implementation:
Code:
Class VirtualScale
    Implements IScale

    Private _reading As Double

    Public Sub SetReading(ByVal reading As Double)
        _reading = reading
    End Sub

    Public Function GetTemperature() As Double Implements IScale.GetTemperature
        Return _reading
    End Function
End Class
Then you can just go about your merry way and when testing change the value to whatever you want. Say we figure out you have to send the string "open sesame" to start the readings and they come back where all values are in a range -1 to 1 that represents "error" to "100 kg"; you can replace VirtualScale with this guy and not worry about anything else:
Code:
Class VirtualScale
    Implements IScale

    Private _lastReading As Double
    Private _port As SerialPort

    Public Sub New()
        _port = New SerialPort(...)
        ' junk to configure the port
        ' Send "open sesame" to the port
        ' Add a handler for the data received event
    End Sub


    Public Function GetTemperature() As Double Implements IScale.GetTemperature
        Return ConvertReadingToTemperature()
    End Function

    Private Function ConvertReadingToTemperature()
        ' Suppose we want to display "8888" for "error".
        If _lastReading < 0 Then
            Return 8888
        End If

        Dim minimum As Double = 0
        Dim maximum As Double = 100
        Return (_lastReading * maximum) + minimum
    End Function

    Private Sub DataReceived(...) Handles (whatever the event is)
        ' read the data
        ' _lastReading = convert that data to a double
    End Function
End Class
Note how I had to fiddle with GetTemperature() to make it return the same values that VirtualScale did: so long as your "real" scale maintains the same output values as the "fake" one your application won't know the difference. This way you can finish the rest of your project and breathe easy while fiddling with the scale.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #36  
Old 04-21-2011, 04:03 PM
mkaras's Avatar
mkarasdigital scale/ indicator in vb mkaras is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Mar 2004
Location: Beaverton, OR
Posts: 1,874
Default

The OP needs to look closely at the Figure 1 in the manual for the JM Series. It says in there that to connect the scale's DB-9 female connector to the PC it is necessary to cross wire pins 2 & 3. Since the typical USB serial cable has a male DB-9 connector that mimics the pinning and configuration of a PC serial connector is it necessary to also cross connect these connections there as well. It will not work to simply plug the male connector of the USB/Serial cable directly to the scale.

It is possible to find null modem devices that provide the cross over these connectors with out having to build the special cable.

Michael Karas
Reply With Quote
  #37  
Old 04-21-2011, 06:48 PM
vdex vdex is offline
Newcomer
 
Join Date: Apr 2011
Posts: 19
Default

>>AtmaWeapon

you got me right, the presentation for this project suppose to be in 16th May 2011.
i ordered this device from UK as im from Malaysia. the shipping took months to get received. it was arrived at 2nd April 2011. since that, i was keep trying with the coding calling the device, however it doesnt resulting me anything. then i go for the third party software, hyperterminal.. tends to get the least respond from the device.. still nothing..

next week i have 2 papers for the final exam, (havnt prepare anything for the exam yet) my friends advice me to give up, but i feels like to keep on trying until the last second. even i fail at last, i want to know why i fail to communicate with the device. was it as simple as the cabling(9pin to USB convertor), or the wrong code/language (using vb), or even the wrong environment(windows 7, visual studio 2010)
Reply With Quote
  #38  
Old 04-21-2011, 08:36 PM
mkaras's Avatar
mkarasdigital scale/ indicator in vb mkaras is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Mar 2004
Location: Beaverton, OR
Posts: 1,874
Default

The manual says right out that you have to cross the connections between pins 2 and 3 of the scale's female DB-9 over to the male DB-9 on the USB Serial cable. It is clear that it will not work if you try to simply connect the USB serial cable directly to the scale.

If you cannot get a simple cable adapter cobbled up then get some help from an engineering student that can help. I suspect that you would have found this problem with the cable pinning if you had been able to follow my suggestion from a while back to find an engineer that could help you look at the signal lines with an oscilloscope.

------------

There is another quick diagnostic you can make of the PC and the USB Serial cable. Remove the scale from the picture entirely and carefully and temporarily short together the pins 2 and 3 on the serial connector (DB-9) end of the USB serial cable. Then with the cable attached to the PC and trying HyperTerminal see if stuff that you type comes back in the port to the Hyper terminal window. This will allow you to evaluate functionality of the cable and your PC. After you complete this test remove the shorting jumper off of pins 2 & 3.

Michael Karas
Reply With Quote
  #39  
Old 05-13-2011, 12:56 AM
vdex vdex is offline
Newcomer
 
Join Date: Apr 2011
Posts: 19
Default

hi guys, im back with good news..

and, yes, the issue was the CABLE...
hahahahahahahaha...
only NULL MODEM CABLE will do the connection, as the situation was like connection 2 DTE devices.

had been doing the cable soldering..
after i got confirmation result, as hyperterminal finally give me the results.
i got the coding right after i determined that the key to trigger the data transmission from the weighting scale to the PC is ENTER key a.k.a CR

so from the coding, i simply wrote,

serialport1.write(chr(13))
textbox1.text = serialport1.readexisting

it gives me exact result like the hyperterminal provided to me.

at last, it works, and quite funny because all these while was just because of the wrong cable usage.

thank you very much for all your help.
you guys are the best..

now i have 48hrs remaining to play around with the conditions in triggering the data transmission.
Reply With Quote
  #40  
Old 05-20-2011, 07:42 AM
vdex vdex is offline
Newcomer
 
Join Date: Apr 2011
Posts: 19
Default dedication

an appreciation dedicated to all of you who had helped me in understanding the serial connection in my thesis.

the grade is out today.. A-

not too bad. ^^

thank you very much for everything.
Attached Images
File Type: png dedication.png (7.8 KB, 11 views)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
digital scale/ indicator in vb
digital scale/ indicator in vb
digital scale/ indicator in vb digital scale/ indicator in vb
digital scale/ indicator in vb
digital scale/ indicator in vb
digital scale/ indicator in vb digital scale/ indicator in vb digital scale/ indicator in vb digital scale/ indicator in vb digital scale/ indicator in vb digital scale/ indicator in vb digital scale/ indicator in vb
digital scale/ indicator in vb
digital scale/ indicator in vb
 
digital scale/ indicator in vb
digital scale/ indicator in vb
 
-->