Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _XTAL_FREQ_ 4000000
- #include <pic16f873.h>
- #include <stdio.h>
- #include <stdlib.h>
- int main(int argc, char** argv) {
- //Configuro PWM
- T2CONbits.TMR2ON = 0;
- PR2 = 24; //Periodo de 40 KHz
- CCP1CONbits.CCP1Y = 1;
- CCP1CONbits.CCP1X = 0;
- CCPR1L = 0b00000110;
- TRISCbits.TRISC2 = 0;
- //Configuro timer 2
- T2CONbits.T2CKPS = 0b00; //Pre 1:1
- CCP1CONbits.CCP1M = 0b1111;
- T2CONbits.TMR2ON = 1;
- while(1);
- return (EXIT_SUCCESS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement