CCS-C 3.203 bug

作者 mechwu 於 2004年07月04日 17:24:04
沒必要的話就不要升級!


// bug_3203_BSR_read_adc.c       by C-H Wu         2004/07/04
//
#include <18F458.H>
#fuses HS, PUT, NOLVP, NODEBUG

#device  ADC=10               // select 10-bit AD results
int16    ad_data;
#byte    ad_data = 0x300      // this line causes ADRESH missing !

#use delay ( clock = 20000000 )
#use rs232 ( baud  = 115200, xmit=PIN_C6, rcv=PIN_C7 )

#zero_ram
void main()
{
   
setup_adc_ports ( A_ANALOG );
   
setup_adc( ADC_CLOCK_DIV_32 );
   
set_adc_channel( 0 );

   while (
1 )
   {
   
// ad_data = read_adc();   // unmark this line will save the next line !!
                              // because bank select is no longer needed.

      
ad_data = read_adc();   // Bug !  MOVFF  ADRESH,ad_data+1  is missing !

      
printf("rn AN0 = %lu ", ad_data); delay_ms(1000);
   }
}

來自: http://www.microchip.com.tw/newbb/viewtopic.php?forum=1&topic_id=49&post_id=380