05-04-2011 06:37 AM
Bonjour,
Je souhaite envoyer des commandes de type chaînes de caractères à un appareil par l'intermédiaire d'un port USB de mon pc.
Le schéma de câblage est le suivant:
Appareil->RS-232->USB->PC
J'ai regardé les exemples fournis avec LV mais je n'ai pas réussi à envoyer/recevoir des données.
L'appareil n'était à la base pas reconnu par windows, j'ai donc suivi ce tuto : http://zone.ni.com/devzone/cda/tut/p/id/8523 pour l'installer en USB RAW.
J'ai ensuite utilisé les fonctions VISA Open, VISA Close, VISA Read et VISA Write mais rien ne semble fonctionner.
Merci de m'indiquer s'il existe des précautions particulière à prendre pour la communication par USB.
Cordialement,
Teka_22
05-04-2011 09:39 AM
English c/o Google Translate:
Hello,
I want to send commands to type string to a device via a USB port on my pc.
The wiring diagram is as follows:
Device-> RS-232-> USB-> PC
I looked at the examples in LV but I was not able to send / receive data.
The aircraft was the basis not recognized by Windows, so I followed this tutorial: http://zone.ni.com/devzone/cda/tut/p/id/8523 to install a USB RAW .
I then used the VISA functions Open, Close VISA, VISA Read and VISA Write, but nothing seems to work.
Thank you to indicate whether there are special precautions for communication via USB.
Step 1: Undo EVERYTHING you did regarding creating a USB RAW device.If you are using a USB<-->RS-232 converter then you will have virtual COM ports. To your application they will appear as "regular" serial (COM) ports.
Step 2: Treat the device as an RS-232 device. Communicate with it using the virtual COM port. Verify that you can communicate with it by using a communication program like HyperTerminal (if you're on Windows) and open a connection to the COM port to which your device is connected. Send some commands (check the documentation of your device). Then, take a look at the serial examples that ship with LabVIEW. Open the Example Finder (Help -> Find Examples) and search for "serial". The key thing to set is whether or not VISA Read should stop reading when a certain character is sent by the device. This is known as the termination character. You will need to check the device's programming manual for this information.
You should also spend some time here: http://zone.ni.com/devzone/cda/tut/p/id/4359
05-04-2011 11:16 AM
@smercurio_fc wrote:
English c/o Google Translate:
Hello,
I want to send commands to type string to a device via a USB port on my pc.
The wiring diagram is as follows:
Device-> RS-232-> USB-> PC
I looked at the examples in LV but I was not able to send / receive data.
The aircraft was the basis not recognized by Windows, so I followed this tutorial: http://zone.ni.com/devzone/cda/tut/p/id/8523 to install a USB RAW .
I then used the VISA functions Open, Close VISA, VISA Read and VISA Write, but nothing seems to work.
Thank you to indicate whether there are special precautions for communication via USB.
Step 1: Undo EVERYTHING you did regarding creating a USB RAW device.If you are using a USB<-->RS-232 converter then you will have virtual COM ports. To your application they will appear as "regular" serial (COM) ports.
Step 1.5: Read the instruction for the USB>Ser adaptor and install the Virtual COM port driver IAW the manufacturer's instructions.
Step 2: Treat the device as an RS-232 device. Communicate with it using the virtual COM port. Verify that you can communicate with it by using a communication program like HyperTerminal (if you're on Windows) and open a connection to the COM port to which your device is connected. Send some commands (check the documentation of your device). Then, take a look at the serial examples that ship with LabVIEW. Open the Example Finder (Help -> Find Examples) and search for "serial". The key thing to set is whether or not VISA Read should stop reading when a certain character is sent by the device. This is known as the termination character. You will need to check the device's programming manual for this information.
You should also spend some time here: http://zone.ni.com/devzone/cda/tut/p/id/4359
05-06-2011 01:22 AM
Thanks for your help, it's works!
Teka