02-16-2012 10:14 AM - edited 02-16-2012 10:21 AM
Bonjour,
Je travaille sur labview 7.1 et je n'arrive pas à communiquer correctement avec ma balance (ohaus arc120).
Pour comuniquer j'utilise un cable rs232 croisé que j'ai fabriqué à partir d'un cable droit et un adaptateur usb/rs232.
Lorsque je récupère les données de la balance via le bouton print de la balance, tout marche, j'ai la bonne valeur.
Mais lorsque je la commande avec le pc, je n'ai pas toujours de signal. Lorsque j'en ai un, la valeur que je recois est éronnée. le nombre d'octets lu n'est pas constant et il y à des erreurs de cadrage: il manque une partie de la valeur (ex: 2,3g au lieu de 2,83g) ou m'indique totalement autre chose ( caractères spéciaux, lettres...)
De plus je ne recois aucun signal si dans mon VI je ne répète pas 7 fois l'instruction écrire dans une boucle. Pour la tare c'est pareil, je dois répété l'instruction 5 fois.
Pour réussir à écrire puis à lire il faut que j'ouvre un session visas pour écrire, que je la ferme, puis que j'en ouvre une nouvelle pour lire. Sinon il n'écrit pas.
J'ai aussi essayé de communiqué directement en rs232. je recois la bonne valeur en appyuant sur le bouton print, mais je n'arrive pas commander la balance.
J'ai vérifié les paramètres de transmissions, ils sont correctes.
Pouvez-vous m'aider ?
Merci beaucoup
Cordialement
Solved! Go to Solution.
02-16-2012 01:47 PM
Please attach screen shots in a standard graphics format such as PNG (you can do this easily in mspaint). Microsoft Word is not an image transfer format.
Most likely there's a problem with your serial port configuration. Make sure the balance is set to the default and that your settings match that. Try connecting to the balance using HyperTerminal. Do you get correct readings there? It appears from the documentation that you do not need any end-of-line character, which could be part of the problem. You'll be able to determine this quickly in HyperTerminal. Instead of sending the command multiple times, add a small delay between sending and receiving. It is possible the balance does not respond immediately and that you'll lose characters if you try to read before transmission is complete.
N'hesite pas repondre en francais, je le comprends mieux que je l'ecris. Par contre ce forum est majorite anglophone - il existe aussi une communaute francais - et donc pour recevoir plus d'aide il est conseille de poser des questions en anglais.
02-16-2012 03:27 PM
Try this PIN out for RS232 cable :
Below are the two cable configurations that will work with 9 pin and 25 pin serial ports. You will notice that pins 2 and 3 are not crossed in the 9 pin but are in the 25 pin. In any case pins 5 and 6 have to be shorted at the balance end of the cable. One cable type will work with both balances.
Ohaus Part number - AS017-09 Used with AP, AS, C, CT, E, G, GT, I5, TP, TS, MB200, Adventurer, Explorer, Voyager, Navigator and Scout.
Cable - balance to PC
9 pin(F) to 9 pin(F)
Balance pin -----to----- PC pin
PIN 2 (TXD) -----to----- PIN 2 (RXD
) PIN 3 (RXD) -----to----- PIN 3 (TXD)
PIN 7 (GND) -----to----- PIN 5 (GND)
For balances other than Adventurer pins 5 & 6 must be shorted together at the balance and NOT connected to the computer. This is not required in the Adventurer balances.
02-17-2012 04:03 AM
Sorry, i did a mistake. My rs232 cable isn't crossed. it's connected like that :
Balance PIN-----to-----PC PIN
PIN2-----to-----PIN2
PIN3-----to-----PIN3
PIN7-----to-----PIN7
And the PIN8 and the PIN5 are connected together on the balance and not connected to the PC.
I change my cabling :
Balance PIN-----to-----PC PIN
PIN2-----to-----PIN2
PIN3-----to-----PIN3
PIN7-----to-----PIN5
And it works !!!
Two days i'm searching what's wrong and it was just one cable.
Thanks a lot
02-17-2012 04:09 AM
Pleased to hear this.
03-14-2013 12:50 AM
I tried the same configuration
Balance pin -- Computer pin
2--2
3--3
7--5
shorted 5 and 8 on the balance side, not connected to the computer.
I am trying to query the communication using VISA, but i get a "timeout expired before operation completed" error. I also tried using TeraTerm (hyperterminal emulator) but with no success.
Have been trying to get this working for almost a week. Any help will be much appreciated.
Thanks!