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

CCP1 Capture Interrupt Latency (18F452)
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Flowmeter



Joined: 29 Oct 2013
Posts: 3

View user's profile Send private message

Syntax error
PostPosted: Tue Oct 29, 2013 1:45 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Oct 29, 2013 1:57 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Oct 29, 2013 2:03 am     Reply with quote

Thank you for your answer. So I try to get an answer from MicroChip and if not I will have to switch to CCS Smile

Thanks again.

By the way changing it to:

#define BytePtr(var, offset) ((char*)&var + offset)

was the solution.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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