Skip to content

Instantly share code, notes, and snippets.

@rutles
Created May 9, 2015 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rutles/b497458e2d45349c163f to your computer and use it in GitHub Desktop.
Save rutles/b497458e2d45349c163f to your computer and use it in GitHub Desktop.
PIC12F1822 application for MC6800 clock generator.
//mc6800 clock generator
//device: PIC12F1822(5V)
//compiler: HI-TECH PICC 9.80a
#include <pic.h>
__CONFIG(FOSC_INTOSC & WDTE_OFF);
void main(){
CCP1SEL = 1;
P1BSEL = 1;
OSCCON = 0b11110000; //32MHz
ANSELA = 0; //digital
TRISA = 0; //output
CCP1CON = 0b10001100; //half-bridge
PR2 = 7; //PWM cycle
CCPR1L = 4; //duty cycle
CCPR1H = 4; //initial duty cycle
PWM1CON = 1;//delay
T2CON = 0; //not use prescale
TMR2 = 0; //TMR2 clear
TMR2ON = 1; //TMR2 start
while(1){
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment