Warning possible loss of data MC9S08GB60

cancel
Showing results for 
Search instead for 
Did you mean: 

Warning possible loss of data MC9S08GB60

Jump to solution
712 Views
Cn
Contributor I

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(;:smileywink: {
    // __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 */
}

Labels (1)
Tags (1)
0 Kudos
1 Solution
49 Views
Lundin
Senior Contributor IV

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.

View solution in original post

0 Kudos
2 Replies
50 Views
Lundin
Senior Contributor IV

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.

View solution in original post

0 Kudos
49 Views
CrasyCat
Specialist III

Hello

 

How did you define count?

 

CrasyCat

0 Kudos