Discussion:
CAN Periodics using Channel APIs
(too old to reply)
Pradeep_Bejugam
2007-12-01 14:10:05 UTC
Permalink
Hi All,
 
I need your suggestions on the application i have attached here with in the post.
 
The sample Application attached is used to send periodic messages on the CAN interface, by acquiring the message from a dbc. I need to send periodic message for every one second. The application requires to do few initializations and then enable the periodics to be sent. After performing few tests it has to disable the periodic messages.
 
I would like to know if the attached application does serve my purpose. Any suggestions would help me in learning and improve myself.
 
Thanks and Regards,
Pradeep


main_app.vi:
http://forums.ni.com/attachments/ni/30/3001/1/main_app.vi


Send_Periodics.vi:
http://forums.ni.com/attachments/ni/30/3001/2/Send_Periodics.vi


stop_periodics.vi:
http://forums.ni.com/attachments/ni/30/3001/3/stop_periodics.vi
Rima H.
2007-12-04 00:10:07 UTC
Permalink
Hi Pradeep,
It seems that several of the cases in the case structure are the same.  You can eliminate duplicate states by referencing 2 .. 5, or you could even reduce the states to just true and false.  Try placing the string indicator outside of the case structure.  Also, I think you can combine the two loops that are inside the larger loop.  Good luck!
Regards,
Rima
Pradeep_Bejugam
2007-12-06 14:40:07 UTC
Permalink
Hi Rima,
Thank you for your suggestions, however I would like to clarify some of the points you have suggested.
1. In the case structure, cases 2..5, would be having a different functionality implemented.
2. The critical part of the application is the placement of the loops. I tried experimenting with the code in all possible combinations. If I combine the two loops into one the CAN periodic VI would be called only once before the enable periodic message is enabled. This would not allow the CAN periodic function to run.
3. I have also noticed that if the enable periodic message set to true before the loop gets executed the application loops in the CAN periodic VI and the control does not go to the next state in the case structure.
Due to above reasons I had to use two loops, so that he CAN periodics VI will be executed when the enable periodic message variable is enabled and using a global variable to stop sending of the CAN periodics.
Regards,
Pradeep
Rima H.
2007-12-07 21:10:05 UTC
Permalink
Hi Pradeep,
If your VI currently works better with two loops, then you should leave the VI that way.  You might have to fine-tune a few parts of the VI, but if it works the way it is, then you don't need to change the overall architecture.
Regards,
Rima

Loading...