Jump to content

Mitch

Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Mitch

  • Rank
    Newbrie
  1. I can't seem to get the 4MHz external XTAL osc working on my 16F777. I program the following code onto the chip (along with the config/fuses) And the program works, but it also works when I remove the XTAL. This makes me think it's only using the INTRC osc. Can anyone find anything wrong with the code or offer me any advice? Is the "osccon" line what is throwing it off? Thanks for your help. //16F777 #include <system.h> //#pragma DATA _CONFIG, _PWRTE_ON & _WDT_OFF & _INTRC_IO & _CP_OFF & _MCLR_OFF & _IESO_OFF #pragma DATA _CONFIG, _PWRTE_ON & _WDT_OFF & _XT_OSC & _CP_OFF & _MCLR_OFF & _IESO_OFF //Set clock frequency #pragma CLOCK_FREQ 4000000 void Startup(void) { osccon = 0b01101110; //Set oscillator to 4MHz adcon1 = 1111b; //Set all pins to digital trisa = 0b00000000; //Set porta for output trisb = 0b00000000; //Set portb for output porta = 0; portb = 0; delay_s(1); } void main(void) { Startup(); while(1) { porta = 1; delay_s(1); porta = 0; delay_s(1); } }
  2. This code seems to work with OR without the XT on pins 13 and 14. This makes me think that the int osc is activated. Any clue how I can disable the int osc and use only the external XT? BTW: I AM programming the config along with the code. Thanks for you help //16F777 #include <system.h> #pragma DATA _CONFIG, _PWRTE_ON & _WDT_OFF & _XT_OSC & _CP_OFF & _MCLR_OFF & _IESO_OFF void Startup(void) { osccon = 0b01101110; //Set oscillator to 4MHz adcon1 = 1111b; //Set all pins to digital trisa = 0b00000000; //Set porta for output trisb = 0b00000000; //Set portb for output porta = 0; portb = 0; portc = 0; portd = 0; delay_s(1); } void main(void) { while( 1 ) { delay_s(1); porta = 1; delay_s(1); porta = 0; } }
  3. I create a new project, then program some code, compile it. It compiles fine. But if I change the target to PIC16F88 and recompile, it compiles then gives me a msgbox saying: "Out of memory." This happens EVERYTIME thereafter. Also, if I close out, restart the computer, then startup the IDE again and open the project, it'll give me the error. Any clue what's going on? Thanks Mitch
  4. I can't seem to figure out how to get the ADC working on the PIC18 and haven't found ANYTHING on google. Can anyone paste me some sample code? I want to read in the value from RA0, and check if it's less than 128. THANKS!
×
×
  • Create New...