|
|
View previous topic :: View next topic |
Author |
Message |
Ssfk
Joined: 01 Feb 2010 Posts: 2
|
PICkit2+18F4580 |
Posted: Mon Feb 01, 2010 2:09 pm |
|
|
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! |
|
|
andyfraser
Joined: 04 May 2004 Posts: 47 Location: UK
|
PICkit2+18F4580 |
Posted: Tue Feb 02, 2010 7:45 am |
|
|
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
|
Re: PICkit2+18F4580 |
Posted: Tue Feb 02, 2010 8:35 am |
|
|
Ohh, I'm idiot...
Right you are!
I reverse the relationals :S
Quote: | if((fok<10) || (fok>35) ) |
this time, the program is fine!
Thanks you! |
|
|
|
|
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
|