mannyboy
Newbie level 1
Hello I am new PIC mcu and I am trying to program 16f88 pwm with 10Mhz clock for 50usec (20khz) pulse output.
How do I setup the delay & While(1) .... . javascript:emoticon('')
Here is my sample code but still need to
PORTA = 0x03; // RA0:RA1 input On/Off switch
PORTB = 0x0E ; // RB3 - output
//***** Set Up OPTION ******/
// RB Pullup = Enabled = 0 (0=enabeled, 1=disabled)
// T0 Src = Internal= 0 (0=falling, 1= Rising)
// T0 Edge = L to H = 0 (0=rising , 1=falling edge)
// Prescale = WDT = 1
//Prescale = 1:1 = 111 **/
OPTION=0b00000110; // WDT rate 1:64 TMR0=rate 128, bit value = 110
PR2 = 0x9B; //timer2 period registor=155
T2CON =0x07; // timer2 control
CCPR1L = 0x1F; // duty cycle reg <5:4> ;
CCP1CON = 0x0C; //pwm
---
------ a lot of people told me it's easy ! I might complicated myself
How do I setup the delay & While(1) .... . javascript:emoticon('')
Here is my sample code but still need to
PORTA = 0x03; // RA0:RA1 input On/Off switch
PORTB = 0x0E ; // RB3 - output
//***** Set Up OPTION ******/
// RB Pullup = Enabled = 0 (0=enabeled, 1=disabled)
// T0 Src = Internal= 0 (0=falling, 1= Rising)
// T0 Edge = L to H = 0 (0=rising , 1=falling edge)
// Prescale = WDT = 1
//Prescale = 1:1 = 111 **/
OPTION=0b00000110; // WDT rate 1:64 TMR0=rate 128, bit value = 110
PR2 = 0x9B; //timer2 period registor=155
T2CON =0x07; // timer2 control
CCPR1L = 0x1F; // duty cycle reg <5:4> ;
CCP1CON = 0x0C; //pwm
---
------ a lot of people told me it's easy ! I might complicated myself