Discussion:
Frame and channel API ?
(too old to reply)
vamsi539
2008-08-10 18:40:05 UTC
Permalink
I'm working on a project that needs to read data  from the CAN bus and log the sample rate of each message.What I'm not sure is if I have to use Channel or Frame API ?
 
From what I understood reading the forum and some documents is this:
 
1) Channel API's use the Database to pull the properties of the message.(Ex: Sample rate,no.of bits etc using GetProperty.vi)
2) Frame API's are used to read Raw Data from the Bus.(Use GetAttribute.vi ?)
 
Now,for my application If I use channel API's (GetProperty.vi) to retreive the samplerate.Does it  read the samplerate from the database and hence not the actual value from the Bus ?
 
The Right way to do it would be to use Frame API's(GetAttribute.vi) to read the actual value from the bus instead of the value in the database?
 
Would the CAN Recevie.vi from the NI example finder the good example to start with ?
 
Any ideas would be great help..
 
Thanks
 
-Vamshi
DirkW
2008-08-11 14:10:11 UTC
Permalink
Since CAN is actually a BUS, there is nothing like a sample rate you can measure for incoming frames. The term sample rate is for the channel api and means a configuration attribute for your task. If your frame is received every 100 ms you could sample it with 10 Hz and would get every single frame and you could oversample it with 100 Hz und would get 10 times more frames then actually received.
So , in your case if you have a database file, it makes sense to use the channel api with the timestamped input mode. Then you could calculate your rate from the timestamp available for this mode only.
If you do not have a database file at all, it m,akes sense to use the frame api read mult to read the frames and to calculate the rate from the timestamp for your specific frame id.
DirkW
vamsi539
2008-08-11 21:10:07 UTC
Permalink
Hey DirkW,
                    Thanks for the help.I'm using the Channel Monitor.vi from the NI examples and making changes to suite my application.
Thanks
-Vamshi

Loading...