ArmandoCircuitos
Inicio
Electronica
Programacion
Diagrama
Codigo
void main() { TRISC.F0 = 0; // designate PORTC.0 pin as output PORTC.F0 = 0; // pone al bit RC0 en nivel bajo OPTION_REG.T0CS = 0; //Internal instruction cycle clock (CLKO) OPTION_REG.PSA = 0; //Prescaler is assigned to the Timer0 module OPTION_REG.PS0 = 1; //Prescaler Rate Select bits OPTION_REG.PS1 = 1; //Prescaler Rate Select bits OPTION_REG.PS2 = 1; //Prescaler Rate Select bits while(1) { //Bucle infinito. if (TMR0 == 0){ //desborde del timer0 PORTC.F0 = ~PORTC.F0; //cambio de estado al pin RC0 while (TMR0 == 0); //espera al cambio del timer0 } } }
Descarga del archivo
Descargar archivo