Jump to content
Sign in to follow this  
don_erickson

Problem Comparing Locations In Eeprom Data

Recommended Posts

Using a 16F87, I am trying to compare a sequence of 4 locations in EEPROM data to another sequence of 4 locations also in EEPROM data.

When I try this:

void check_combo(char test )

{

char a, b, n ;

Match = 1;

for (n = 0; n <= 4; n++ ){

a = read_eeprom(combo+n);

b = read_eeprom(test+n);

if (a < b || a > B) Match = 0;

}

}

the compiler says:

 

timer20.c(454): Error: Unexpected end of file

timer20.c(451): Error: Unexpected end of file

 

One points to the opening {, and the other points to the for loop.

 

I have also tried a while loop:

void check_combo(char test )

{

char a, b, n ;

Match = 1;

n = 0;

while (n < 4) {

a = read_eeprom(combo+n);

b = read_eeprom(test+n);

if (a != B) Match = 0;

n++;

}

}

And for this, the compiler says I have a General Error, pointing to the closing } of the function. In both versions, the compiler is no help.

 

In both, Match is a global variable.

 

Maybe I am overlooking something obvious, but either version looks like it should work.

My read_eeprom function is OK.

The second version will compile successfully if I comment out the if statement, but of course the function can't work that way.

Any ideas?

don erickson

Share this post


Link to post
Share on other sites

I wasn't able to reproduce the problem. Can you provide a source file (simplified if possible) that will exibit this problem.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites
I wasn't able to reproduce the problem. Can you provide a source file (simplified if possible) that will exibit this problem.

 

Regards,

Pavel

 

That was using the C2C_ compiler, not Boostc. When I try BoostC, I get many more errors. I will try to put together a simplified version of the program and get back to you.

 

Thanks

Don Erickson

Share this post


Link to post
Share on other sites
That was using the C2C_ compiler, not Boostc.  When I try BoostC, I get many more errors.

 

I will be interested in BoostC errors as well. We prepare a new BoostC release and I'd like to fix as many defects as possible.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites
That was using the C2C_ compiler, not Boostc.  When I try BoostC, I get many more errors.

 

I will be interested in BoostC errors as well. We prepare a new BoostC release and I'd like to fix as many defects as possible.

 

Regards,

Pavel

 

OK, I got it figured out. I changed my program so it would run with Boostc (changing my statements like "output_low_port_b(Relay);" to "clear_bit(portb, Relay);, etc. Once I had that done, the Boostc compiler still reported an error, but it pointed to exactly where I had my error; I had a one-bit variable called Match, and I had been trying to Match = 1 and Match = 0. Once I changed that to set_bit(flags, Match) etc the compiler was happy.

 

It really helps when the compiler points out the error. I will stay with Boostc from now on.

 

Thanks

 

Don Erickson

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