View previous topic :: View next topic |
Author |
Message |
Ömer Faruk
Joined: 15 Nov 2018 Posts: 42 Location: Çanakkale
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19553
|
|
Posted: Sat Dec 15, 2018 4:28 am |
|
|
In each expression, one of the variables doesn't actually exist.
It could be either.
Remember a variable _only_ exists inside the function it is declared 'in',
unless you declare it outside any function, when it becomes 'global'.
So, since 'deger' exists inside the same function a few lines above, it has to
be 'keyit_1', and 'keyit_2', which either have not been declared at all, or
are declared somewhere which is making them not actually exist at this point. |
|
|
Ömer Faruk
Joined: 15 Nov 2018 Posts: 42 Location: Çanakkale
|
|
Posted: Sat Dec 15, 2018 6:28 am |
|
|
Ttelmah wrote: | In each expression, one of the variables doesn't actually exist.
It could be either.
Remember a variable _only_ exists inside the function it is declared 'in',
unless you declare it outside any function, when it becomes 'global'.
So, since 'deger' exists inside the same function a few lines above, it has to
be 'keyit_1', and 'keyit_2', which either have not been declared at all, or
are declared somewhere which is making them not actually exist at this point. |
Thanks for your reply.
İ define kayit_1 , kayit_2 and deger as global variables. İ didn't use them in any function except deger. İ used deger in an external interrupt. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Sat Dec 15, 2018 6:47 am |
|
|
I'm wondering if it's a 'case' problem ?
You've got KAYIT_1 and kayit_1 in your code.
CCS defaults to 'no case', so both names may refer to the same variable.
I KNOW I've been caught by this in the past......
Without seeing the whole program it is difficult to debug
Jay |
|
|
Ömer Faruk
Joined: 15 Nov 2018 Posts: 42 Location: Çanakkale
|
|
Posted: Sat Dec 15, 2018 7:05 am |
|
|
temtronic wrote: | I'm wondering if it's a 'case' problem ?
You've got KAYIT_1 and kayit_1 in your code.
CCS defaults to 'no case', so both names may refer to the same variable.
I KNOW I've been caught by this in the past......
Without seeing the whole program it is difficult to debug
Jay |
You are definetly right. Thank you very much. But ccs c language is case sensitive. Why this happens i dont understand. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Sat Dec 15, 2018 7:55 am |
|
|
It's ONLY case sensitive IF you add #CASE at the beginning of your code.
The default is NOT case so 'this', 'THIS',' ThIs','tHIs', 'thiS' are all the same and reference one RAM location.
Since you only posted part of your code, I assumed you didn't add #CASE, so the compiler would use noCASE.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19553
|
|
Posted: Sat Dec 15, 2018 1:09 pm |
|
|
Another thing that can cause this issue, is having something else with the
same name. If (for instance), you have a #define that also uses 'kayit_1',
then the declaration won't actually happen. So:
#define kayit_1 something
then
int16 kayit_1;
doesn't result in kayit_1 being declared. Instead 'something' gets declared.
Now depending on what 'something' is, this may not be a possible
declaration, so then things go wrong....
Similarly using the same name in an enum, can also give problems. |
|
|
|