View previous topic :: View next topic |
Author |
Message |
jventerprises
Joined: 01 Apr 2004 Posts: 43 Location: Boston
|
Problem with passing by ref in functions dsPIC30F4012 |
Posted: Tue Oct 26, 2010 12:53 pm |
|
|
I am having problems with make32 in versions V4_113 and V4_114. V4_112 and below work fine.
DSPIC30F4012, Windows 7, x64
Specifically I pass a buffer to functions as follows:
Code: |
main()
{
int8 rx_len, buffer[8];
buffer[0] = 1;
buffer[2] = 2;
buffer[3] = 3;
buffer[4] = 9;
rx_len = 8;
process_update_data(buffer, rx_len);
} |
and i process is as follows:
Code: |
void process_update_data(int8* buffer, int8 rx_len);
void process_update_data(int8* buffer, int8 rx_len)
{
int32 temp32;
i=0;
// generate data, upper byte is always 0 (24-bit machine)
temp32 = make32(buffer[(i + 3)], buffer[(i + 2)], buffer[(i + 1)], buffer[i]);
...
|
temp32 should be 0x09030201 but i get 0x01010101
in v4_112 i get 0x09030201.
Any ideas? _________________ Jon |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 26, 2010 4:28 pm |
|
|
I don't have this compiler, but this looks like the typical CCS problems
with slightly complex expressions (varying between compiler versions).
As a test, create four int8 local variables, a, b, c, d. Load them with the
buffer values. Then run your make32 line on the locals, instead of the
buffer expressions. It may now work. |
|
|
jventerprises
Joined: 01 Apr 2004 Posts: 43 Location: Boston
|
That does work |
Posted: Tue Oct 26, 2010 6:27 pm |
|
|
Separating the variables works. Thanks for the help. _________________ Jon |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Tue Oct 26, 2010 10:41 pm |
|
|
File a bug report, wait for V4.115. |
|
|
|