0% found this document useful (0 votes)
92 views7 pages

Tutorial Projeto C

The document provides instructions for creating a new PIC project in C and adding a driver to the project. The key steps are: 1. Create a new project and select the device and compiler. 2. Configure the project name and location. 3. Add a main.c source file and copy/paste a template with oscillator and code protection configurations. 4. Add the driver files to the project and include the driver header file to compile the driver functions.

Uploaded by

alphaeletrica
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views7 pages

Tutorial Projeto C

The document provides instructions for creating a new PIC project in C and adding a driver to the project. The key steps are: 1. Create a new project and select the device and compiler. 2. Configure the project name and location. 3. Add a main.c source file and copy/paste a template with oscillator and code protection configurations. 4. Add the driver files to the project and include the driver header file to compile the driver functions.

Uploaded by

alphaeletrica
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

TEMPLATE PARA NOVO PROJETO EM C

1. File->New Project
2. Next

3. Selecione o familie e o device conforme figura abaixo:


4. Selecione PicKit2
5. Selecione o compilador XC8

6. Configure o nome do projeto e tambm a pasta onde sera inserido


7. Clique em Finish.
8. Em source files clique com boto direito e New -> C Source File

9. De um nome ao arquivo (main.c) e clique em finish.

10. Copie e cole o template padro para o arquivo main.c


/* Templat projeto PIC
* */
#include <xc.h>

//#pragma config OSC = XT //XT oscillator


#pragma config OSC = HSPLL //HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1)

#pragma config FCMEN = OFF //Fail-Safe Clock Monitor disabled


#pragma config IESO = OFF //Oscillator Switchover mode disabled
#pragma config PWRT = ON //PWRT enabled
#pragma config BOREN = OFF //Brown-out Reset disabled in hardware and software
#pragma config WDT = OFF //WDT disabled (control is placed on the SWDTEN bit)
#pragma config PBADEN = OFF //PORTB<4:0> pins are configured as digital I/O on Reset

#pragma config MCLRE = ON //MCLR pin enabled; RE3 input pin disabled
//#pragma config MCLRE = OFF //RE3 input pin enabled; MCLR disabled

#pragma config STVREN = ON //Stack full/underflow will cause Reset


#pragma config LVP = OFF //Single-Supply ICSP disabled
#pragma config XINST = OFF //Instruction set extension and Indexed Addressing mode
enabled
#pragma config CP1 = OFF //Block 1 (002000-003FFFh) not code-protected
#pragma config CP2 = OFF //Block 2 (004000-005FFFh) not code-protected
#pragma config CP3 = OFF //Block 3 (006000-007FFFh) not code-protected
#pragma config CPB = OFF //Boot block (000000-0007FFh) not code-protected
#pragma config CPD = OFF //Data EEPROM not code-protecte

#pragma config WRT0 = OFF //Block 0 (000800-001FFFh) not write-protected


#pragma config WRT1 = OFF //Block 1 (002000-003FFFh) not write-protected
#pragma config WRT2 = OFF //Block 2 (004000-005FFFh) not write-protected
#pragma config WRT3 = OFF //Block 3 (006000-007FFFh) not write-protected
#pragma config WRTC = OFF //Configuration registers (300000-3000FFh) not write-
protected
#pragma config WRTB = OFF //Boot block (000000-0007FFh) not write-protected
#pragma config WRTD = OFF //Data EEPROM not write-protected

void main(void)
{
while(1) //Endless Loop
{
}
}
ADICIONANDO UM DRIVER AO PROJETO

1. Copie os arquivos .c e .h dos drivers que se deseja utilizar (e suas dependncias) e cole na
mesma pasta do seu projeto.

2. Selecione Source Files -> Add Existing Item...


3. Selecione os arquivos .c dosdrivers em questo.
4. Adicione o #include do driver em questao.

5. Agora o programa j estar pronto para compilar as funes do driver em questo


6. FIM!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy