Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

CCS C compiler Error ! - please help

Status
Not open for further replies.

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
 

Compiler error

Read the manual; a=a-1; is suposed to be a=a--1; decrement (--) not (-).
 

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
 

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

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

}
 

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

!!!!!
 

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;

}
 

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
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top