Author Topic: OS API in C/C++ Files  (Read 849 times)

Offline jraber

  • PLUS+1 User
  • **
  • Posts: 7
  • Karma: +2/-0
OS API in C/C++ Files
« on: April 29, 2026, 06:54:22 PM »
Hello,

I am working on an internal tool that converts .dbc files into POUs that can imported into GUIDE as a single source of truth for CAN communication. I have the actual CAN communication functionality implemented using the functions provided Middleware_CAN_Base_Public (from the middleware library), but along with this I would like to implement a sort of "watchdog" that monitors for connectivity issues. I was initially trying to use time.h (the standard C99 header), and it did not work. I currently have this set up by passing OS.ETime into my POU and saving that to a static variable when the corresponding CAN message is received. From there I compare the passed in value to the static variable, and if a certain amount of time has passed since the last message was received an output variable is set to true indicating a timeout or communication error.

Now, it would be really nice if I could get the OS.ETime value directly from within the POU instead of requiring it to be passed in (there will be many POU calls so the fewer manual routes I have to do the better). The "OS C APIs in PLUS+1 GUIDE" section in the GUIDE user manual gives me hope that it is possible because it states "The presence of an APIs sub-node under the HWD node within the Project Manager tree indicates that the used HWD offers OS C API support for your project."

But I am also doubtful for my situation because I am using an MC050-110 (MC050-110/112-0_nl ver:70089372v230), and I do not see the aforementioned "APIs" sub-node under the HWD node. Is the API functionality missing from this controller or am I just missing something?

Any help would be greatly appreciated.

Thanks,
JT