May 21, 2003 #1 SphinX Advanced Member level 3 Joined Jan 25, 2002 Messages 822 Helped 58 Reputation 116 Reaction score 29 Trophy points 1,308 Location EGYPT Activity points 7,045 CCS C compiler Error ! Hi, When i run this easy program #include <16f84.h> 1 main() 2 { 3 int a; 4 int b; 5 a=6; 6 b=6; 7 loop: 8 a=a-1; 9 b=b-1; 10 goto loop; } and watch the varible a and b then run step the program it gives these reuslts a=6 b=6 a=0606 b=6 a=0505 b=5 a=0404 b=4 ... .... What is this shit ? Why when i decrement a, value of b changes too in this strange manner !? Thanks
CCS C compiler Error ! Hi, When i run this easy program #include <16f84.h> 1 main() 2 { 3 int a; 4 int b; 5 a=6; 6 b=6; 7 loop: 8 a=a-1; 9 b=b-1; 10 goto loop; } and watch the varible a and b then run step the program it gives these reuslts a=6 b=6 a=0606 b=6 a=0505 b=5 a=0404 b=4 ... .... What is this shit ? Why when i decrement a, value of b changes too in this strange manner !? Thanks
May 21, 2003 #2 S SAR Advanced Member level 4 Joined Sep 25, 2002 Messages 107 Helped 5 Reputation 10 Reaction score 2 Trophy points 1,298 Activity points 988 Compiler error Read the manual; a=a-1; is suposed to be a=a--1; decrement (--) not (-).
May 21, 2003 #3 SphinX Advanced Member level 3 Joined Jan 25, 2002 Messages 822 Helped 58 Reputation 116 Reaction score 29 Trophy points 1,308 Location EGYPT Activity points 7,045 Hi, I changed the code to a=a--1; b=b--1; But the compiler gives error --------------------------------- Deleting intermediary files... done. Executing: "C:\Program files\Picc\CCSC.exe" "a.c" +FM +DC +LN +T -A +M +Z +Y=9 +EA *** Error 76 "a.c" Line 10(6,7): Expect ; *** Error 76 "a.c" Line 11(6,7): Expect ; 2 Errors, 0 Warnings. Halting build on first failure as requested. BUILD FAILED Thanks
Hi, I changed the code to a=a--1; b=b--1; But the compiler gives error --------------------------------- Deleting intermediary files... done. Executing: "C:\Program files\Picc\CCSC.exe" "a.c" +FM +DC +LN +T -A +M +Z +Y=9 +EA *** Error 76 "a.c" Line 10(6,7): Expect ; *** Error 76 "a.c" Line 11(6,7): Expect ; 2 Errors, 0 Warnings. Halting build on first failure as requested. BUILD FAILED Thanks
May 22, 2003 #4 S SAR Advanced Member level 4 Joined Sep 25, 2002 Messages 107 Helped 5 Reputation 10 Reaction score 2 Trophy points 1,298 Activity points 988 compile error You need to go to: **broken link removed** and do a search for decrement there are examples here. If not ask for help on the forum.
compile error You need to go to: **broken link removed** and do a search for decrement there are examples here. If not ask for help on the forum.
May 22, 2003 #5 S SAR Advanced Member level 4 Joined Sep 25, 2002 Messages 107 Helped 5 Reputation 10 Reaction score 2 Trophy points 1,298 Activity points 988 compile error I tried the code and it compiles; #include <16f84.h> main() { int a; int b; a=6; b=6; while (1) a=a-1; b=b-1; } This also compiles: #include <16f84.h> main() { int a; int b; a=6; b=6; while (1) a=a--; b=b--; }
compile error I tried the code and it compiles; #include <16f84.h> main() { int a; int b; a=6; b=6; while (1) a=a-1; b=b-1; } This also compiles: #include <16f84.h> main() { int a; int b; a=6; b=6; while (1) a=a--; b=b--; }
May 22, 2003 #6 SphinX Advanced Member level 3 Joined Jan 25, 2002 Messages 822 Helped 58 Reputation 116 Reaction score 29 Trophy points 1,308 Location EGYPT Activity points 7,045 Hi, Yes, it compiles succeeded. But the problem is still there. I use MPASM 6.20. When he execute b=6 The watch window tells a=0606 b=06 !!!!!
Hi, Yes, it compiles succeeded. But the problem is still there. I use MPASM 6.20. When he execute b=6 The watch window tells a=0606 b=06 !!!!!
May 22, 2003 #7 S SAR Advanced Member level 4 Joined Sep 25, 2002 Messages 107 Helped 5 Reputation 10 Reaction score 2 Trophy points 1,298 Activity points 988 compiler error Yes that is true then You must do: #include <16f84.h> void main() { int a; int b; a=6; b=6; a=a-1; while (True) b=b-1; }
compiler error Yes that is true then You must do: #include <16f84.h> void main() { int a; int b; a=6; b=6; a=a-1; while (True) b=b-1; }
May 22, 2003 #8 SphinX Advanced Member level 3 Joined Jan 25, 2002 Messages 822 Helped 58 Reputation 116 Reaction score 29 Trophy points 1,308 Location EGYPT Activity points 7,045 Hi, Thanks, I solved the problem. The default size in watch window was 16 bit I changed it to 8 bit and it worked. Pharaoh Of Egypt
Hi, Thanks, I solved the problem. The default size in watch window was 16 bit I changed it to 8 bit and it worked. Pharaoh Of Egypt