CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Problem with passing by ref in functions dsPIC30F4012

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jventerprises



Joined: 01 Apr 2004
Posts: 43
Location: Boston

View user's profile Send private message Visit poster's website

Problem with passing by ref in functions dsPIC30F4012
PostPosted: Tue Oct 26, 2010 12:53 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Oct 26, 2010 4:28 pm     Reply with quote

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

View user's profile Send private message Visit poster's website

That does work
PostPosted: Tue Oct 26, 2010 6:27 pm     Reply with quote

Separating the variables works. Thanks for the help.
_________________
Jon
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Tue Oct 26, 2010 10:41 pm     Reply with quote

File a bug report, wait for V4.115.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group