LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 Interface with CompactRIO

Hi,

 

I’m having some issues trying to use an RS232 interface to send and receive information at a fast enough rate.

 

The code should constantly monitor for any signals being received and deal with them as necessary and every 10ms it should output one of four words defined by the states of local variables.

 

The problem is that the code seams to take awhile to boot up and start running, but even then it will only output a word once it has received one even though the codes are running in separate loops. If left for between 15-20 minuets the RIO starts outputting words continuously (as required) however only at a rate of approximately 6Hz. I have tried altering the time associated with the wait block within the RS232 Output vi and it seams that even when this is deleted it still isn’t capable of running fast enough.

 

Dose anyone have any ideas on how I can speed up my code?

 

Attached are the files used within this segment of the code, there are however other sections that will have to run on the RT processor, but these are not yet finished.

 

Thanks on advanced for your help.

 

Rob

Download All
0 Kudos
Message 1 of 13
(4,466 Views)
Sorry I meant to state that ’Wheel Interface’ is the top level VI.
0 Kudos
Message 2 of 13
(4,453 Views)

Hello Rob,

Can you please post all of the VIs that are in your code as there are several that are missing (gearcalc.vi etc).

Cheers Smiley Wink

Tom
NIUK

0 Kudos
Message 3 of 13
(4,407 Views)
Sorry I did mean to.
Download All
0 Kudos
Message 4 of 13
(4,402 Views)
0 Kudos
Message 5 of 13
(4,402 Views)
Hi tall Rob,

you have no timing in you communications loops. Thus the loop executes as fast as possible, hogging the cpu.

Suggest that you add a delay so that the sytem can also executes your other 'parellel ' loops.

Start with a value say 50 ms wait  and experiment.

As already mentioned upload all necessary vi's.

Also isolate you communcation vi loop and try to get it up and running as you want. Running it in 'parellel 'with the other loops before you have debugged it will destroy you
desire.

xseadog




0 Kudos
Message 6 of 13
(4,394 Views)
Hello Rob,
 
If you're using LabVIEW 8/8.2 then build a zip file with all of your files in your project. To see how to do this look here.
 
If you want to do this at around 10ms either the aforementioned loop timing could be a factor aswell as the subVI's performance within those loops. To try and offer any advice we'd have to see the full code.
 
Cheers,
 
Tom
NIUK
0 Kudos
Message 7 of 13
(4,381 Views)

Thanks for the advice, I'll try them out today.

Hear is the zipped file as requested.

Regards

Rob

0 Kudos
Message 8 of 13
(4,378 Views)

Hello Rob,

You need to add ALL of the VIs that are called in this code to the project then Zip it up. I still can't try to test it out without ALL of the subVIs. Have you tried changing your timing considerations within the code yet?

Cheers,

Tom
NIUK

0 Kudos
Message 9 of 13
(4,348 Views)

Hi Tom/Xseadog,

 

I have now tried adding the timing into the loops and this has indeed solved the problem with the RS232, thank you, however I still require the CAN loop to rum at approximately 1 MHz, which seams to be the new problem. I’m going to try and get round this by putting this section of the Code onto the FPGA, hopefully I’ll be able to create enough space.

 

Sorry about not attaching all the VI’s to the zip file, I followed the online guidance but must have missed a step. I’ll try an zip up another copy over the weekend and post it up. Any further info you can give me on optimising the code would still be very much appreciated as I still have to merge this code with another.

 

Thanks Again

 

Rob Smiley Very Happy

0 Kudos
Message 10 of 13
(4,324 Views)