Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

How to setup the delay & while(1) in PIC16f88 PWM program?

Status
Not open for further replies.

mannyboy

Newbie level 1
Joined
Aug 3, 2009
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
usa
Activity points
1,289
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(':cry:')

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
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top