LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can Bus Baud rate change after initialise

Solved!
Go to solution

I using Labview 2016.

USB Can Bus NI-8473.

Also using the producer consumer loops in my program.

I have a test to perform were I need to change the Can Bus baud rate after the program has been initialise this becaus I need to test different products that need the Can Bus baud rate to be either 250000 or 500000. I would like to be able to this without re-starting the program.

0 Kudos
Message 1 of 6
(3,768 Views)

How about not initializing the serial port until you know what unit you are testing?  (Select the baud rate when selecting the unit, then init.  Close after the unit is finished.  Lather, rinse, repeat as necessary.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 6
(3,745 Views)

Thanks for the insable info. I all ready try to initiliase the Can Bus in the comsumer loop but I coul not get the can bus to talk to any unit I plug into the system.

0 Kudos
Message 3 of 6
(3,716 Views)

Post your code so we can offer some good advice.

 

I also have a USB-8473 so I have the needed CAN tool kit 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 6
(3,710 Views)

You need to reset and close the CAN port, set the new baud rate, then re-open it. The code looks a bit like this (I use this particular code when I open an NI-CAN port because if you abort a VI without closing the port first, it will still be open on the next run, and generate an error when you try to re-open it, which this code handles - but it's the same idea for closing and reopening it deliberately in the middle of your program).

Reset NI-CAN.png

0 Kudos
Message 5 of 6
(3,706 Views)
Solution
Accepted by topic author Toro

I got something similar.

The VI sample is a short version of my large VI. I did not included the Producer Loop

The only I am missing is the reset prior the closing the can. Hope this helps.

I will add the reset to my main vi and try it.

0 Kudos
Message 6 of 6
(3,671 Views)