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 support@ccsinfo.com

What the hell is this compiler doing ??????

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







What the hell is this compiler doing ??????
PostPosted: Sun Oct 24, 2004 8:23 am     Reply with quote

Hello to All friends using CCS C18

I sent to CCS already a lot of Error Reports about the funny results when defining RAM Arrays, okay after one week of no msg I asked them kindly to answer at least with "we dont like You or so", just to get a heartbeat from them.

The answer was okay, they ommitted that they are working on this problem, okay doesnt helped me but at least it looks that somebody is aware of.

Now I wanted to go on in my project I got a result which really brings me to explosion:


[code]if (IOBounce) // Debounce Counter expired
{
IO_Read();
if (AllIn = AllLev) // Accept Input Change !
{
AllCheck = AllIn ^ AllOld; // Check which Input Changed
// RTC_TimeDate(); // Get Time for this Sequenz only once !!

for (cnt1=0;cnt1 <=32; ++cnt1)
{
if (bit_test(AllCheck,cnt1) ==1) // Check for Changed Bits
{
if (bit_test(AllIn,cnt1) == bit_test(AllLev,cnt1)) // If new Input is equal all Level
{
if (bit_test(AllIn,cnt1)) Level = '1';
else Level= '0';
bit_clear(AllBou,cnt1);
index = cnt1+1;
RTC_TimeDate();
if (!noupd)
{
if (Buff = 1)
{
RAMBuffer1[Bufpoint1] = index; ++Bufpoint1;
RAMBuffer1[Bufpoint1] = Level; ++Bufpoint1;
RAMBuffer1[Bufpoint1] = Hour; ++Bufpoint1;
RAMBuffer1[Bufpoint1] = Min; ++Bufpoint1;
RAMBuffer1[Bufpoint1] = Sec; ++Bufpoint1;
RAMBuffer1[Bufpoint1] = mSec; ++Bufpoint1;
RAMBuffer1[Bufpoint1] = Date; ++Bufpoint1;
RAMBuffer1[Bufpoint1] = Month; ++Bufpoint1;
RAMBuffer1[Bufpoint1] = Year; ++Bufpoint1;
RAMBuffer1[Bufpoint1] = 0x00; ++Bufpoint1;
RAMBuffer1[Bufpoint1] = 0x55; ++Bufpoint1;
RAMBuffer1[Bufpoint1] = 0xAA; ++Bufpoint;
}
else
{
RAMBuffer2[Bufpoint2] = index; ++Bufpoint2;
RAMBuffer2[Bufpoint2] = Level; ++Bufpoint2;
RAMBuffer2[Bufpoint2] = Hour; ++Bufpoint2;
RAMBuffer2[Bufpoint2] = Min; ++Bufpoint2;
RAMBuffer2[Bufpoint2] = Sec; ++Bufpoint2;
RAMBuffer2[Bufpoint2] = mSec; ++Bufpoint2;
RAMBuffer2[Bufpoint2] = Date; ++Bufpoint2;
RAMBuffer2[Bufpoint2] = Month; ++Bufpoint2;
RAMBuffer2[Bufpoint2] = Year; ++Bufpoint2;
RAMBuffer2[Bufpoint2] = 0x00; ++Bufpoint2;
RAMBuffer2[Bufpoint2] = 0x55; ++Bufpoint2;
RAMBuffer2[Bufpoint2] = 0xAA; ++Bufpoint2;
}
strcpy(Disp1,Pin_def[index]);
fprintf(com1,Disp1);
fprintf(com1," %2U ",index);
fprintf(com1," %C ",Level);
fprintf(com1," %2U %2U %2U %4lu %2U %2U %2U \n\r",Hour,Min,Sec,mSec,Date,Month,Year);
// lcd_gotoxy(1,1); // lcd_Put_string(Disp1); // lcd_putc("L "); // lcd_putc(Level); // RTC_Time_Display();
}
}
AllOld = AllIn; IOBounce = false;
}
}
}
}



This code worked perfect for the last weeks, now I made a small change --
All I wanted was to remove the line with RTC_timeDate at this position<.



bit_clear(AllBou,cnt1);
index = cnt1+1;
>>>>>>> RTC_TimeDate();

The result was that my working program started to send some data to the com port, always the same sequenz and the rest of the programm is not working any longer
I am not able to find at which place the sending is coming from, the ICD is not helpful at all.


I am using a 18F8720 Processor.


I really hope that someone out there has some ideas

best regards and thanks for all Your answers

Andreas
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Oct 24, 2004 10:17 am     Reply with quote

Quote:
What the hell is this compiler doing ??????

Well, one answer might be GIGO.
Quote:
using CCS C18

The CCS compiler is called PCH. The Microchip compiler is called C18.
Which one are you using ?

Quote:
if (AllIn = AllLev) // Accept Input Change
if (Buff = 1)

These statements use '=' when they should use '=='.

Quote:
for (cnt1=0;cnt1 <=32; ++cnt1)

The line above will count from 0 through 32.
I suspect that you really want it to count from
0 to 31. In that case, I would do it like this:
for (cnt1=0; cnt1 < 32; cnt1++)


There may be other bugs.
Andreas
Guest







PostPosted: Sun Oct 24, 2004 3:40 pm     Reply with quote

Hello PCM Programmer,

What means GIGO ??

I am using the CCS PCHW Compiler

Quote:
if (AllIn = AllLev) // Accept Input Change
if (Buff = 1)

Here You are right, thank You for this hint !!!
Also about the count.

So far I found that sometimes which seems to run perfect is just facking You !

The reason why I am so doubtfully is that there are some Array troubles which are doing really strange things to Your programm.

Okay, will check my code now thanks a lot for Your help

Andreas
Guest








PostPosted: Sun Oct 24, 2004 3:48 pm     Reply with quote

It's a computer term, from the early days of computing.
Here is the definition from the de.wikipedia:
http://de.wikipedia.org/wiki/GiGo
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Oct 24, 2004 3:53 pm     Reply with quote

The post above was from me. I'm not at my normal
computer and I forgot to login on that one.
Andreas
Guest







PostPosted: Sun Oct 24, 2004 11:56 pm     Reply with quote

Hello, thanks for this Information, sounds very nice.

But You know, what drives me grazy is, that the program output was producing correct output all the time and after leaving one very nonimportant step out it runs wild !!!

Although I am new to C programming I am firstly thinking that <I am wrong , second also and than I am looking at the compiler.

This funny thing with the Array, see my post a week before, is definitly a compiler bug which CCS is already accepting, so of course I am again thinking about the integrity of the compiler.

Hope they will come with a Fix soon.

I tried to convert to Microchip mcc18, but this is really a hell of a work. A lot of goodies from CCS are not implemented, or to You know about a libary with all this Input and Output Port functions for the mcc18 ??

Best regards and again many thanks for Your Ideas and answers

ANdreas
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Mon Oct 25, 2004 6:45 am     Reply with quote

Andreas wrote:
But You know, what drives me grazy is, that the program output was producing correct output all the time and after leaving one very nonimportant step out it runs wild !!!


That is the power of C. The power to make really ghastly mystakes!
_________________
The search for better is endless. Instead simply find very good and get the job done.
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