Showing results for 
Search instead for 
Did you mean: 

XNET to send CAN message at variable a rate PXI 8512

I have managed to set up PXI 1082 chassis with PXI 8512 CAN card with 2 ports linking together. So that I can write to CAN1 and read on CAN2 to verify what I have written. (See attached Loopback Test 1.0vi)  Please refer the CAN DB file attached (Open in XNET Database editor)


My goal is to send 3 CAN frames (specified in XML file) one after the other, to a 3rd party instrument. Frames has to send at a rising edge of a clock event. So far I have tried by using an external clock to drive a real-time loop and at each iteration CAN frames will be written sequentially. This external clock frequency can vary from 6 – 133Hz. However, this architecture doesn't seem to work when I integrate with the rest of the application.


Could anyone please suggest me if there is any other method which I could trigger XNET driver to write a CAN message. 

0 Kudos
Message 1 of 2

Hi there. 



At the moment i cant see that you're varying the loop rate. as your code is now, it runs at a constant wait.








This part of your code only updates the "LoopRate" Indicator on the front panel, it has no effect on the "Loop Rate (ms)" control. 

Also the get tick count function is returning not returning the values i think you're after, the first iteration of this loop would run at a rate of ca 10nHz. and in the following loops you have no control on the frequency(it varies around 1-10hz). This is because the shift registers are not initialised, and the get tick count is to unreliable in this use. 


I would recommend something like this: 



PS: adjust the variable to fit your application.


Best regards 


There are only two ways to tell somebody thanks: Kudos and Marked Solutions

Unofficial Forum Rules and Guidelines
0 Kudos
Message 2 of 2