Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Choise between FrameAPI and ChannelAPI?

Hello, everyone,
 
I have a little question concerning the Frame/Channel API for my CAN Card NI
 
In fact, i have an application in Labview that if the user click a button on the front panel, the application should send a CAN message on the network. The ID of the message is 0x01 and only 8 bits of data will be sent. I want to know which should I choose between the FrameAPI and the ChannelAPI to simplify the communication with the NI-CAN Card.
 
Thanks a lot
0 Kudos
Message 1 of 4
(4,156 Views)

Both is possible. If you choose the channel api, you need to configure at least  one channel first. because the confioguration has to be done for both, in the end you would use the read in a case to catch the button press. The channel has to bge configured with sample rate 0 to send only on call of nct read.

In the end your choice depends on your data you would like to send. If you need to change the bits or bytes before sending, i would prefer the frame api. If it is easier to use physical values use the channel api.

DirkW

0 Kudos
Message 2 of 4
(4,148 Views)

Thank you very much DirkW

Just a little question : when you said that the configuration has to be done for both, what do you mean BOTH? The Frame and the Channel API?? I have actually a message named MsgFT which is associated with my database created under Vector Database Editor (.dbc) and it dispose a channel named Action with 8 bits of data, so that i think the first channel is configured as you said in your message.

In fact, there isn't physical values in my message CAN, just some significative values for my buttons (i have 20 on my front panel and each button is associated with a value, ex : 0000 0001 for the first button and 0000 0010 for the second). I should send the right message on the network if the corresponding button is clicked.

So i thought to creat a sub-VI "SendMsg" with on his input the value to send and the function "Write" will be called in this sub-VI. In this case, it is better to use the Frame api, right?

Thanks

0 Kudos
Message 3 of 4
(4,146 Views)

Hi,

No. don't get me wrong. If you have a channel using a single byte, this is like using the frame API, because CAN uses the byte format to transfer the raw data.

Only if your channel uses more then a byte, it would be easier to get the bits with the frame api. In your case the channel api should work.

DirkW

0 Kudos
Message 4 of 4
(4,130 Views)