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 CCS Technical Support

Error code problem

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



Joined: 04 Jun 2006
Posts: 35

View user's profile Send private message

Error code problem
PostPosted: Thu Sep 14, 2006 1:34 am     Reply with quote

HI

I MAKE A INT:
int son=0x00;

and use in a funtion:
analogoku(int k)
{
int i=0;
int1 neg=0;
int1 sonuc=0X0000;
int16 sonuc1=0X0000;
ilk=0x00;
son=0x00;



set_adc_channel( k );
delay_us(20);
sonuc1 = Read_ADC();//

switch (k){
case 0 :
break;
case 1 :
////hesap A�I

sonuc1=sonuc1-zerocrossangle;
if(sonuc1>0x8000)
{
sonuc=~sonuc;
neg=1;
}
sonuc=0x00;
while (sonuc1<=8000)
{
sonuc1=sonuc1-stepang;
sonuc++;
}
sonuc=MASK&&sonuc;
if (negoreg==0){
if (neg==1){
sonuc=sonuc || NEGATIF;//negoreg=0...negreg=1
}

}
else
{
if (neg==0){
sonuc=sonuc || NEGATIF;//nogoreg=1..negreg=0
}
}
sonuc=sonuc || ANGLE;
ilk=make8(sonuc,0);;
son=make8(sonuc,1);////////gives error Evil or Very Mad
putc(son);
delay_us(20);
putc(ilk);

break;
case 2 :
sonuc1=sonuc1-zerocrossdistance;
sonuc=0x00;
while (sonuc1<=8000)
{
sonuc1=sonuc1-stepdis;
sonuc++;
}
ilk=make8(sonuc,0);
son=make8(sonuc,1);////////gives error Evil or Very Mad
putc(son);
delay_us(20);
putc(ilk);


}
}

both Evil or Very Mad gives error:
Invalid parameters to built in function

why is that??
Ttelmah
Guest







PostPosted: Thu Sep 14, 2006 7:13 am     Reply with quote

Of course it does.
'Sonuc' as you have declared it, is a _single bit_. The 'make8' function, allows you to take one byte of a multi byte value. You can't use a function expectingf a value larger than a byte, with a variable that is smaller than a byte...

Best Wishes
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