jun86dia
Newbie level 5
here is my codes.Pls do try it .. and tell me where is the problem occured.
PROblem is whenever i input 1 to RB0, CCP1 able to generate pulse for 3 or 4 cycles only.then there isnt any pulse anymore.pls help..thankz in advance!
PROblem is whenever i input 1 to RB0, CCP1 able to generate pulse for 3 or 4 cycles only.then there isnt any pulse anymore.pls help..thankz in advance!
Code:
#include <htc.h>
#include <pic.h>
#include <stdio.h>
#include "delay.h"
#include <math.h>
void main(void)
{
//initialisation
TRISB = 0xff;
TRISC = 0x00;
PORTB = 0x00;
PORTC = 0x00;
while(1)
{
//PORTB0 = 1;
T2CON = 0b00000100;
CCP1CON = 0b00001100;
PR2 = 255;
switch (PORTB)
{
case 0b00000001:{
CCPR1L = 127;
break;
}
default:
{
CCPR1L = 200;
break;
}
}
}
}
Code: