Dear Pic List members I want to hear from someone if there are know problems relate to C compiler, demo version and final version of MPLAB-C18. I have a lot of trouble to compile some programs in my new project using on PIC 18C452 and a demo compiler from Microchip, MPLAB-C18, last demo version, together with a MPLAB 5.11.02. What happens? If I compile a program for example using PORTDbits.RD0 = 1; to set bit 0 of PORTD it does not work and also dont give any error in compilation time. if I use PORTD = 0; it work only and only in small programs like test programs. If I read from A/D and send it to USART in a small piece of code, everithings looks fine, but if I join code with more rotines where program can be a little large, it stop to work well. I feel that the compiler does not work well to programs with 100 lines of code or more. I am not sure, but in some pages at forum in Microchip there are some comments that a demo version of compiler does not compile identical at the full version and also that large programs can not run well I attached a code that are not working, so I will be glad with your help Thanks Elton Spode EXAMPLE 1 - Code does not work. PORTD does nothing. Also A/D and USART does not work /************************************************ EXAMPLE 1 /************************************************ void main(void) { // setup ClosePORTB(); // Disabilita pull-ups e interrupcoes INTCON = 0; // Desabilita interrupcoes PORTB = 0; // Clear PORTB output data latches PORTC = 0; // Clear PORTC output data latches PORTD = 0; // Clear PORTD output data latches PORTE = 0x00; // Clear PORTE output data latches TRISD = 0; // PORTD all outputs. file://open ad OpenADC(ADC_FOSC_16&ADC_RIGHT_JUST&ADC_8ANA_0REF,ADC_CH0 & ADC_INT_OFF); file://open usart OpenUSART(USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, 12); esc = 0; m = 0; smin = 10; smax = 1000; // Apaga LEDS LED = 0; PORTD = 0xFF; PORTD = 0b11111110; Delay100(); PORTD = 0b11111100; Delay100(); PORTD = 0b11111000; Delay100(); PORTD = 0b11110000; Delay100(); PORTD = 0b11100000; Delay100(); .... .... /************************************************ /************************************************ EXAMPLE 2 - Execute de Loop for, but never go outside the loop. it runs like forever inside of for. Now the A/D, USART and PORTD work well, but never and loop for {....} { // setup ClosePORTB(); // Disabilita pull-ups e interrupcoes INTCON = 0; // Desabilita interrupcoes PORTB = 0; // Clear PORTB output data latches PORTC = 0; // Clear PORTC output data latches PORTD = 0; // Clear PORTD output data latches PORTE = 0x00; // Clear PORTE output data latches TRISD = 0; // PORTD all outputs. file://open ad OpenADC(ADC_FOSC_16&ADC_RIGHT_JUST&ADC_8ANA_0REF,ADC_CH0 & ADC_INT_OFF); file://open usart OpenUSART(USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, 12); for (i=0; i<100; i++) { Delay10TCYx(5); // Delay for 50TCY ConvertADC(); // Start Conversion while(BusyADC()); // Done Converting? result = ReadADC(); // read result itoa(result,str); // convert to string while (BusyUSART()); putsUSART(str); // Write string to USART PORTD = ADRESL; } esc = 0; m = 0; smin = 10; smax = 1000; ..... ..... ..... /***************************************************** ---------------------------------------------------------------------------- ----------------------------- www.onshop.com.br - O Seu Shopping Virtual - Compre e Venda pela Internet com Facilidade www.dominiolivre.com.br - Registre o seu dominio, preserve a sua marca na internet. www.espocomp.com.br - A sua loja de informatica na internet. www.exposhop.net - O site que cria a sua loja virtual ---------------------------------------------------------------------------- --------------------------- -- http://www.piclist.com hint: PICList Posts must start with ONE topic: "[PIC]:","[SX]:","[AVR]:" =uP ONLY! "[EE]:","[OT]:" =Other "[BUY]:","[AD]:" =Ads