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

PICkit2+18F4580

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ssfk



Joined: 01 Feb 2010
Posts: 2

View user's profile Send private message

PICkit2+18F4580
PostPosted: Mon Feb 01, 2010 2:09 pm     Reply with quote

Hello!
I'm sorry, I can't speak English, only little bit! :(

I have a problem with a CCS+MPLAB+Pickit2.
I write a program, in CCS, but not good :(

bit of the program:
Code:

for(i=4;i>0;i--)
{
fok=read_eeprom(i);   //EEPROM KIOLVASÁSA, első induláskor 20fokra állítása

if((fok>10) || (fok<35) )
   {
   write_eeprom(i,20);
   }
}

If i go debugger mode in MPLAB, the program all steps i=6. But, I replace i variable other (ex: k), then the decrement is fine, but the IF command always true. (Even if fok=20, and even if fok=255 )
And in running the program include a few similar bug.

I use, MPLAB 8.43
PICkit2 last firmware
and I tried two 18F4580.

Pleas help me!
Thx! Smile
andyfraser



Joined: 04 May 2004
Posts: 47
Location: UK

View user's profile Send private message

PICkit2+18F4580
PostPosted: Tue Feb 02, 2010 7:45 am     Reply with quote

Hi,

Your if statement reads (in English), if fok is greater than 10 OR fok is less than 35 then....

So, if fok = 20 then fok is less than 35 and if fok = 255 then fok is greater than 10 !

I think what you want to write is : if ( ( fok > 10 ) && ( fok < 35 ) )....

HTH

Andy
Ssfk



Joined: 01 Feb 2010
Posts: 2

View user's profile Send private message

Re: PICkit2+18F4580
PostPosted: Tue Feb 02, 2010 8:35 am     Reply with quote

Ohh, I'm idiot...
Right you are!
I reverse the relationals :S

Quote:
if((fok<10) || (fok>35) )


this time, the program is fine! Smile
Thanks you! Smile
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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