Jump to content

Problem With Uart_Driver In Multi Port Mode

Recommended Posts

I am using SourceBoost 6.92 and I took uart_driver.h from a later version and heavily modified it and am using it in a PIC program I am writing, but it only works properly in SINGLE_PORT_MODE. When using multi-port mode, I noticed that the compiler creates temporary variables for values that are passed by reference, so an interrupt handler will copy values from the original variables on the way in, and copy the values from the temporary variables back to the original variables on the way out. I also noticed many argument and temporary variables share the same memory locations among different functions.


I have not been able to pinpoint the problem, but the behavior of my program that simply reads from the UART and echoes the character back to the UART, suggests that some variables are getting clobbered in the process. As I mentioned, things work fine in single-port mode, when parameter passing is not used - the problem only appears when the calling signatures to the various routines require parameters.


I have attached my code so you can see the behavior. It is written for a PIC16F628A running at 12 MHz, but it should work if you configure for another PIC. It seems this must be a result of a compiler bug, but like I said, I have yet to pinpoint the problem, and I have run out of time to debug it. I am moving forward in single-port mode, but eventually will need to have the multi-port functionality working. Any help would be appreciated.


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...