Jump to content
Sign in to follow this  
moyoyoyo

what is a #pragma?

Recommended Posts

For the sake of those few unfortunate souls who are not completly inagurated into the C language what is a pragam and how can I sue it?

 

What is that clock pragama that I keep seen?

Share this post


Link to post
Share on other sites
Guest Dave

A pragma tells the compiler to perform a particular action or provide imformation that is used at compile time. Pragmas do vary from compiler to compiler.

 

The clock frequency pragma, eg:

#pragma CLOCK_FREQ 1000000

 

Tells the compiler the code is to run on a processor with, in this case, a clock frequnency of 1MHz.

 

The compiler then nows how long it takes to execute an instruction.

The compiler can then produce code for the built in delay functions and the RS232 functions, that produces the correct results - these routines use software delays

 

Regards

Dave

Share this post


Link to post
Share on other sites
Guest Pavel

Generally speaking pragmas is one of the ways to add non standard features to a compiler. For example C standard doesn't say anything about target clock rate. To pass this information to the c2c compiler a pragma CLOCK_FREQ is used.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

How can I put more than one #pragma DATA in a project?

When I try, I get an:

 

asm error: wrong code page

 

 

with 2 #pragma DATA lines

 

 

But if I try to put all data together, I get a read overflow error.

 

How can I write all data eeprom without copying & pasting at the .asm file before assembling?

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...