Hello forum, i'm new programming this devices. Well when i debug my program a warning appear.. Possible loss of data(see the bold text), could you indicate what is my error? and how can i fix? because i want to transmit data who is storage in a variable thanks
byte SCI1_Transmit(byte Chr){
if(!SCI2S1_TDRE) { // Is the transmitter empty?
return -1; // If no then error
}
SCI2D = (byte)Chr;
return 0; // OK
}
void main(void) {
byte TransmitStatus;
SOPT = initSOPT;
ICGC2 = initICGC2;
ICGC1 = initICGC1; //32kHz -> 18.874368MHz bus rate
while(!ICGS1_LOCK); //loop until FLL locks
ICGC2_LOCRE = 1; //enable reset if ref clock fails
InitSCI1();
EnableInterrupts; /* enable interrupts */
count=0;
/* include your code here */
for(; {
// __RESET_WATCHDOG(); /* feeds the dog */
count++;
TransmitStatus = SCI1_Transmit(count);
delay();
//TransmitStatus = SCI1_Transmit('A');
// delay();
} /* loop forever */
/* please make sure that you never leave this function */
}
Solved! Go to Solution.
If count is an integer type larger than 8 bits, then you should typecast it to "byte".
If not, CW is being silly. The "possible loss of data warning" seems to contain compiler bugs, as it is given randomly, without any logic. In some cases it is valid and points out defects in your program, and in some cases it is just nonsense.
If count is an integer type larger than 8 bits, then you should typecast it to "byte".
If not, CW is being silly. The "possible loss of data warning" seems to contain compiler bugs, as it is given randomly, without any logic. In some cases it is valid and points out defects in your program, and in some cases it is just nonsense.
Hello
How did you define count?
CrasyCat