Baixe o app para aproveitar ainda mais
Prévia do material em texto
SISTEMAS A MICROPROCESSADORES – ARA0108 ROTEIRO 2 Prática: Utilizando o Microcontrolador PIC16F628A com o PICSIMLAB OBJETIVOS DA AULA • Programar microcontroladores PIC através da IDE MPLABX • Conhecer e explorar a plataforma de simulação PICSimLab • Desenvolver aplicações práticas com o através da plataforma PICSIMLAB MATERIAL NECESSÁRIO • Um Computador com sistema operacional Windows • Software MPLABX • Software PICSimLab CÓDIGO UTILIZADO NA PROGRAMAÇÃO UNIVERSIDADE ESTÁCIO DE SÁ CAMPOS DOS GOYTACAZES - RJ ENGENHARIA ELÉTRICA UNIVERSIDADE ESTÁCIO DE SÁ CAMPOS DOS GOYTACAZES - RJ ENGENHARIA ELÉTRICA // PIC16F628A Configuration Bit Settings // 'C' source line config statements // CONFIG #pragma config FOSC = HS // Oscillator Selection bits (HS oscillator: High-speed crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN) #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled) #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) #pragma config MCLRE = ON // RA5/MCLR/VPP Pin Function Select bit (RA5/MCLR/VPP pin function is MCLR) #pragma config BOREN = OFF // Brown-out Detect Enable bit (BOD disabled) #pragma config LVP = OFF // Low-Voltage Programming Enable bit (RB4/PGM pin has digital I/O function, HV on MCLR must be used for programming) #pragma config CPD = OFF // Data EE Memory Code Protection bit (Data memory code protection off) #pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off) // #pragma config statements should precede project file includes. // Use project enums instead of #define for ON and OFF. #include <xc.h> void main () { TRISB=0x00; //Todos os pinos do PORTB como saída PORTB=0; //Desliga todos os pinos while(1) //Laço principal { PORTBbits.RB0=1; //Liga RB0 PORTBbits.RB2=0; //Liga RB2 PORTBbits.RB4=1; // Liga RB4 PORTBbits.RB6=1; //Liga RB6 } }
Compartilhar