Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Bluetooth Serial port

Hi, i have a question about communication between two PCs with bluetooh serial port. I try to explain: i use two PCs with USB-Bluetooth adapter. I would send data from PC 1 to PC2 through serial port created by Bluetooth (in my situation this port is COM4). I i insert an "Initialize Serial VISA" linked to a "Close VISA Port" LabView create (and then close) communication (i can see on PC 2 message that PC 1 is trying to connect through Bluetooth serial port). If i send data to COM4 with the same procedure used to communicate with an external serial instrument i can't read data on PC 2. I have prepared two VIs, one on PC 1 that send data when a button is pressed, and one on PC 2 that control serial buffer (of COM4) and read existing data. Is there someone that can help me? Hi!
0 Kudos
Message 1 of 5
(5,071 Views)
Did you try and run the Examples for Bluetooth that come with LabVIEW?
By opening up the example finder, you can find a Bluetooth Server and Client examples that should be used to test communication.
 
Regards,
AlessioD
0 Kudos
Message 2 of 5
(5,056 Views)
Yes, i've seen examples in labview's directory but my work is different. I use two adapter USB-Bluetooth and i would realize a communication with serial port (serial bluetooth port), not a direct bluetooth communication. Thanks!
0 Kudos
Message 3 of 5
(5,028 Views)
MagicBoto,

Your problem can be solved.
But you should reconsider your process design. It might be much easier to transfer your data using networking. Establish a network connection between the two PCs and a share on one of the hard disks. Than, when your butten is pressed, just write the data to that share. On the readers site, check the existens of the data file and read it when its there.

If your serial solution is neede by some other reasons...
The effort depends on what  you plan to create. If you just want a plain solution to your existing problem, this is easily don. Assuming that your connection is established with blootooth and there are just the two communication partners 'connected', you should do the following:
On senders site:
* VISA configure serial port(Ressorce=Port, baudrate etc.) as used with your virtual port from the bluetooth adapter
* Your code
* Case button_pressed do
   * Data_string =: Flatten_to_String(your data)
     This 'casts' your data to a flat string called  'data string'
   * Sendstring =: concatenate(Flatten_to_String(length(Data_string)+4) & Datastring)
     This brings the length of the wole sendstring to its front in order to inform the receiver of the amount of data to expect
   * VISA_Write(Sendstring)
   This sends out your data
* Your code
* VISA_Close

On receivers site:
* VISA configure serial port(Ressorce=Port, baudrate etc.) as used with your virtual port from the bluetooth adapter
* Your code
* While not <Stop> do
   (create a buffer and a Readsize variable as shift registers on the While loop and wire an empty string from outside the loop to the left register of buffer and a zero to Readsize)
   * If VISA_Bytes_at_serial_Port > 0 than
      * Append(buffer, VISA_Read(Byte_Count=VISA_Bytes_at_serial_Port)
      * If size(buffer)>>=4 AND Raedsize=0 than Readsize=unflatten(Substring(buffer, from0, 4)_type I32
      * If size(buffer)>=Readsize than
         * Data=unflatten(Substring(buffer, from4, rest)_yourDataType
            Your Data might be sent to a processing parallel process using a queue or something. In this example I just put it into 'Data'
            Data will be overwritten when the next data is received!
         * Buffer=substring(buffer, from_Readsize, rest)
         * Readsize=0
          This prepares the receiver for the next chunk of data
        EndIf
     Else Wait 5ms
     IfEnd
   WhileEnd
* Your code
* VISA_Close

HTH   and    Greetings from Germany!<br>-- <br>Uwe
0 Kudos
Message 4 of 5
(5,014 Views)

Hi,

 

I try to send message from my pc to my mobile whit a bluetooth usb adaptor.

i think that the message i can send like a serial port.

Do you think i can do?

 

0 Kudos
Message 5 of 5
(4,078 Views)