|
|
View previous topic :: View next topic |
Author |
Message |
Flowmeter
Joined: 29 Oct 2013 Posts: 3
|
Syntax error |
Posted: Tue Oct 29, 2013 1:45 am |
|
|
Thank you very much for your reply.
When I change the line to the suggested code
#define BytePtr(var, offset) (&(char)var + offset))
I receive a syntax error e.g. for this line
*BytePtr(test0,0)=addOn;
Do I also need to change something in this line?!
Thank you already so much for your help. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 29, 2013 1:57 am |
|
|
This test program compiles with no errors with vs. 5.013:
Code: | #include <18F67J50.h>
#fuses INTRC_IO,NOWDT
#use delay(clock=4M)
#use rs232(baud=9600, UART1, ERRORS)
#define BytePtr(var, offset) (&(char)var + offset)
INT32 test0 = 0x0000ff00;
INT32 test1 = 0x0000ff00;
INT32 test2 = 0x0000ff00;
INT32 test3 = 0x0000ff00;
INT8 addOn=0x0f;
//===========================
void main(void)
{
*BytePtr(test0,0)=addOn;
*BytePtr(test1,1)=addOn;
*BytePtr(test2,2)=addOn;
*BytePtr(test3,3)=addOn;
printf("%lx \r", test0);
printf("%lx \r", test1);
printf("%lx \r", test2);
printf("%lx \r", test3);
while(1);
} |
This is from the MPLAB output window:
Quote: | Build Successful.
Loaded C:\Program Files\PICC\Projects\PCH_Test\PCH_Test.cof.
BUILD SUCCEEDED: Tue Oct 29 00:51:36 2013
|
Your post says you're using C18. I disregarded that because you're
declaring your variables with CCS style data types, such as int8 and int32.
If you're actually using C18, we can't help you. This is a CCS forum.
The place to ask would be on the microchip.com C18 forum.
If you are using CCS, then post your version. |
|
|
Flowmeter
Joined: 29 Oct 2013 Posts: 3
|
|
Posted: Tue Oct 29, 2013 2:03 am |
|
|
Thank you for your answer. So I try to get an answer from MicroChip and if not I will have to switch to CCS
Thanks again.
By the way changing it to:
#define BytePtr(var, offset) ((char*)&var + offset)
was the solution. |
|
|
|
|
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
|