So, you just made your first PIC10F322 XC8 program. Uploaded to the chip and….. Nothing…
Chances are – did you setup the Device Configuration Bits?
Here is the setup I generally use – put this at the top of your main.c file or in a header, include the header it in the main.c file. This will get you up and going quickly. Remember to set the _XTAL_FREQ to the speed of your processor – otherwise if you use the built in delay macros they will not work correctly.
/* * File: 10F322_deviceconfig.h * Author: Jamie Starling - GizoFoundry.com * * Created on: June 7, 2019, 9:45 PM * * Copyright 2018 - 2019 Jamie Starling THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Purpose : Provides Standard Configuration for 10F32X devices * */ #include <xc.h> #include <stdint.h> #ifndef DEVICECONFIG_H #define DEVICECONFIG_H #pragma config FOSC = INTOSC // Oscillator Selection #pragma config BOREN = ON // Brown-out Reset #pragma config WDTE = OFF // Watchdog Timer #pragma config PWRTE = ON // Power-up Timer #pragma config MCLRE = OFF // MCLR Pin Function Select bit->MCLR pin function is digital input, MCLR internally tied to VDD #pragma config CP = OFF // Code Protection #pragma config LVP = OFF // Low-Voltage Programming #pragma config LPBOR = ON // Brown-out Reset Selection bits #pragma config BORV = LO // Brown-out Reset Voltage Selection #pragma config WRT = OFF // Flash Memory Self-Write Protection //Used to calculate the delay time - Change depending on processor Speed #define _XTAL_FREQ 8000000 //8 MHz (default after Reset) #endif /* DEVICECONFIG_H */
Have a Project or Idea!?
I am Available for Freelance Projects
My skills are always primed and ready for new opportunities to be put to work, and I am ever on the lookout to connect with individuals who share a similar mindset.
If you’re intrigued and wish to collaborate, connect, or simply indulge in a stimulating conversation, don’t hesitate! Drop me an email and let’s begin our journey. I eagerly anticipate our interaction!