Search the Community
Showing results for tags 'uart serial template function'.
Found 1 result
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. uart.rar