Skip to content

Instantly share code, notes, and snippets.

@vintagechips
Created March 6, 2016 05:11
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 vintagechips/88fd92d37f135ae32433 to your computer and use it in GitHub Desktop.
Save vintagechips/88fd92d37f135ae32433 to your computer and use it in GitHub Desktop.
PIC12F1822 application for MC6800 clock and reset.
/*
* File: LIKE6875.c
* Author: Tetsuya Suzuki
*
* Created on 2/16/2016 2:18:49 AM UTC
* "Created in MPLAB Xpress"
*/
#include <xc.h>
__CONFIG(FOSC_INTOSC & WDTE_OFF);
void main(void) {
// initialize
OSCCON = 0b11110000; //32MHz
ANSELA = 0; //digital
TRISA = 0; //output
P1BSEL = 1; //P1B assign RA4
OPTION_REG = 0b10000111; // TMR0 prescale 256
// clock
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
// reset
RA5 = 0; //reset
TMR0 = 0; // TMR0 clear
TMR0IF = 0; // overflow clear
while(TMR0IF = 0); // 32MHz/4 / 256 / 256
RA5 = 1; // release
while(1){
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment