From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use my own RF switch without NI Switch

Hi,

I have a product with RX and TX. I am going to hook with the RF switch with MCU, and use a RS232 to send commond for the MCU. I also set up two MCU I/Os (high or low) to RF switch to switch a spectrum instrument or a signal generators instrument. I wanna to have these functions: RF Switch initial, RF Switch trigger, RF Switch abort, and RF Switch close. I don't have any idea to build for LabView. I know using NI switch is very convenient, but I don't have much funds to get it. Does anyone can tell me how to have above four functions using LabView so that the product can send TX through RF Switch to spectrum instrument, and RX from signal generators instrument? I appreciated that your help.     

0 Kudos
Message 1 of 7
(3,182 Views)
If i understand you correctly you want to use labview to send rs232 commands to your mcu. If you search the example finder in labview there should be some easy examples for rs232 communication with labview.
0 Kudos
Message 2 of 7
(3,163 Views)

Is the MCU going to control the RF Switch?  So you would send a command to the MCU via RS232, and the MCU would perform some action on the switch?  The only thing Labview would do is use RS232 to send commands.  The MCU would have to be programmed to do the action.  Is this what you want to do?

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 7
(3,149 Views)
Yes, that's right. I am going to use rs232 to send command to MCU, then MCU control the RF switch. Does anyone can post some simple labview about how to do it?
0 Kudos
Message 4 of 7
(3,126 Views)

Post examples on what? Serial communication? Examples for that ship with LabVIEW - just open the Example Finder and search for serial. However, you should make sure you can talk to the MCU using a terminal program first (such as HyperTerminal on Windows) to make sure you've got the right serial port settings and cable.

 

As for the MCU, that would have nothing to do with LabVIEW, and you'd need to write the code specific to the MCU. 

0 Kudos
Message 5 of 7
(3,113 Views)

Hi,

 

I attached my labview code to use rs232 communication with the mcu. I don't know why it can't communicate with the mcu. Do I make some fault in my code? How to revise my code if I wanna know it's sucessful to communicate with mcu? I post my labview code. Please tell me how to do. Thank you very much.

0 Kudos
Message 6 of 7
(3,088 Views)
  • You do not need the VISA Open, as that's incorporated inside the VISA Configure Serial Port VI.
  • I am assuming you have the correct termination on the command. It's unusual to see two termination characters - are you sure about this? 
  • You do not have a delay after the write. The MCU cannot respond immediately, and neither can Windows. However, you have the VISA Configure Serial Port set up to use a termination character for reads. When you do this you usually don't use the Bytes at Serial Port. So, if the response message from the MCU is terminated with some character you can eliminate the Bytes at Serial Port and just wire a large enough number into the VISA Read's byte count input. The VISA Read will stop once it sees the termination character, or the timeout occurs. But...
  • You have set the VISA timeout to 10 msec. The timeout input on the VISA Configure Serial Port is in msec, not sec.
0 Kudos
Message 7 of 7
(3,076 Views)