RCM 6000 using wrong library

Hi, im trying to run my main code with a function that i created in my library, but it keeps going into the wrong library. I have already #use the library that i wanted and included it in the library path for projection option. but the main code is not executing the function and keeps going into other function. how can i rectify this issue. hope someone can help me out! thanks

You will likely need to rename your function so it doesn’t conflict with the one provided in the Dynamic C libraries. Even if your program doesn’t load that library via #use, other Dynamic C libraries may do so. If you load multiple libraries with the same function name, Dynamic C won’t know which one to use.

Thank you for your reply. I have another question. I am working on a code to get some status and send then out via RS232 serial. I have placed all the functions into my main code in a while(1). However, when i run the programme and use a usb to serial to read my serial message, the code stopped working after around 30 mins. I wasnt able to receive any more serial message from my usb to serial and also on the Dynamic C, the code isnt running on the Stdio but the code hasnt stop, because the stop button is still available. May i know what might be the cause of this? because i need the code to run without stopping. Thanks!

What happens if you hit the stop button? My guess is that the program is stuck somewhere (likely your code, but it could be a library) and isn’t getting back to your main loop. If it’s stuck in a debugable function, hitting stop should give you an idea of where it’s stuck. You might be able to view a Stack Trace (one of the debug windows) to determine the call path to where the program got stuck.

If you want your program to run outside of Dynamic C, be sure to “Compile to Flash”. And look at Samples/STDIO_SERIAL.C for macros to redirect printf output to a serial port (like port A, when using the DIAG connector of the programming cable) when running outside of Dynamic C.

sorry for the late reply. When i hit the stop button, nothing seems to happen. i wasnt able to view any Stack Trace either. how can i make sure my while loop is indefinite?

If it doesn’t stop, your program is stuck in an infinite loop inside of a function flagged as ‘nodebug’ (or __nodebug). You’ll need to figure out a way to isolate where the code fails. Changing some I/O pins between each function of your big while(1) loop could help (I once had I/O pins going to a 7-segment display so I could output a number). When your program gets stuck, you can check those I/O lines to know which function it’s stuck on, and then repeat the process to find out WHERE in that function it’s stuck.

thank you for the reply. apparently, when i try to run it in normal mode, not in debug mode, the program is able to run as per normal.
May i ask you something about serCread? i have a if condition to serCread anything, and do some function. However, there’s always a period where it failed to read the incoming message, even though the message is sent every 2 sec, i try to increase the tmout for serCread but it doesnt work. What can i do so that i can ensure my serCread does not miss out any message coming in?

If your program works fine in normal mode but times out in debug mode, it could be because you’re spending too much time in a sequence of functions marked “nodebug”.

serCread: Increase the buffer size? Make sure you’re reading all bytes available in the buffer?