Jump to content
Sign in to follow this  
Guest Joe

End Of File Not Found

Recommended Posts

Guest Joe

Try compiling the attached code.

 

 

As you can see, the function has no closing brace } and the compiler does NOT complain (which is a bug)

 

 

It has somthing to do with EnableTriac(); define, as changing this to its defined value fixes the bug. Also, if there is no ELSE, it also fixes the fault...

 

 

 

Please confirm that you can reporduce this ?

 

 

Executing the code (when the compiler says its all ok) causes the device to reset.

 

 

If you insert the commented out brackets, the compiler finds the end of file (as expected) and the compiler fails (as expected).

 

 

 

 

Joe

 

 

 

 

 

 

#include	<system.h>
#pragma  CLOCK_FREQ  4000000 	 // 4Mhz clock

asm __config H'01c4';  // config word for PIC 12F629 (code protect disabled for debug)

#define EnableTriac();  gpio |=  0x20;    // Set bit


main(void)
{
            	 // note - input pins set low are Hi-Z
gpio	= 0x00;         	 // inital output levels = all pins low
trisio	= 11001111b;          // 1100 1111
cmcon |= 0x07;         	 // change CMCON to use digital inputs

for(;;)
{
 if( 1 )
//  {
	 EnableTriac();
//  }
 else
//  {
	 nop();
//  }
}

//}  //main() closing brace!

Share this post


Link to post
Share on other sites
Guest Joe

As it is, the file compiles without error, the problem is, there is clearly a closing brace missing - and the compiler does not notice it.

 

The code created is invalid.

 

 

Not sure where your getting ELSE without IF from. I said

 

"if there is no ELSE,"

 

 

Meaning IF without ELSE !

 

 

 

Copy and Paste the complete code into a new file and compile it...

 

 

Joe

Share this post


Link to post
Share on other sites

I'm sorry. For some reason I looked your code like you would have commented the IF clause.

 

Anyway, remove the extra ; at the end of your define and it should work.

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...