Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

How to I use ncWaitforState or ncGetAttri in the Visual BASIC environment?

I have been using your PCI-CAN/2 card for a few years
now to communicate with a CAN-based microcontroller.
In our CAN setup, we tranmsit a message we call an
'Engineering Request' to our micro when we want it to
send a specific CAN message. (Sort of like an RTR)

I used ncWrite to send the message and immediately start polling for a received message. Sometimes it seems like my polling keeps my request message from being sent out. Putting in waits of 100 msec or so after executing ncWrite fixes the problem.

How would I use ncWaitforState or ncGetAttrib in the
Visual BASIC environment to freeze my program until I'm sure the 'Request' message is sent out? The 200
msec delay really s
lows things down.
Some sample code would be great.

Thanks,
Brad W. Wiitala
0 Kudos
Message 1 of 2
(3,623 Views)
Hi Brad,

I do not have any examples that you can use directly, but using wait for state shouldn't be difficult. The format is ncWaitForState(Handle, State, Timeout, State Ptr). You can find this in the programming manuals for NI-CAN at http://digital.ni.com/manuals.nsf/MainPage?OpenForm&node=132020_US

Hope this helps out! Let me know if there is anything else I can do.

Best Regards,
Aaron K.
Application Engineer
National Instruments
0 Kudos
Message 2 of 2
(3,623 Views)