Jump to content

TheRyan

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About TheRyan

  • Rank
    Newbrie
  1. Thanks Dave! I should have tried moving the pcon.3 elsewhere, but never thought about it. Now to program the chip.
  2. Thank's for the bits of code, c58, but unfortunately the compiler gives me errors every time. Here's my new source code for the project, ledtest.c : #include <system.h> #pragma CLOCK_FREQ 4000000 #pragma DATA _CONFIG,_INTOSC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _BODEN_OFF & _CP_OFF pcon.3 = 1; //Set PCON register to 4 MHz void main() { trisa = 11100000b; //Configure I/O trisb = 11000000b; while(1) { porta = 00000000b; //Set all pins OFF portb = 00000000b; delay_ms(1000); //Delay for program recognition porta = 00011111b; //Set all input pins ON portb = 00111111b; delay_ms(1000); } } I get this error log on the "Output" section of the SourceBoost IDE: I've got the settings all right, the clock speed to 4,000,000 Hz, chip to '628a... Is something wrong with the ordering of my #pragma DATA _CONFIG? That's the only problem the program can see, so something's gone funny.
  3. 'm new to both PIC microcontrollers and C programming alike, and recently downloaded SourceBoost. Very nice program! Well I am working on the usual, a blinking LED program to test a circuit I made on a PCB. Here's the code: #include <system.h> //Target PIC16F628A configuration word #pragma DATA _CONFIG, _PWRTE_ON & _WDT_OFF & _XT_OSC & _CP_OFF //4 MHz quartz #pragma CLOCK_FREQ 4000000 void main( void ) { //Configure tris A and B trisa = 11100000b; trisb = 11000000b; while(1) { porta = 00000000b; //Set all pins OFF portb = 00000000b; delay_ms(1000); //Delay for program recognition porta = 00011111b; //Set all input pins ON portb = 00111111b; delay_ms(1000); } } I want to set the clock under #pragma to the chip's internal oscillator. What is the code for this? I looked through the Boost C Help section on #pragma and didn't find much. Is there a list somewhere of the possible commands? Also, if it's not too much work, could anyone tell me if the above code is missing anything? I have seen code with <system.h> as part of it, but do you need to put the actual file name (<p16f628a.h>) here before programming to the PIC, or leave it as-is? Thanks for any help, I've been looking around the forums and you guys are good at this stuff! Gotta learn from the pros.
×
×
  • Create New...