Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

how to know in software when PIC PWM cycle starts/ends?

Status
Not open for further replies.

coffeeCupPepsi

Junior Member level 2
Joined
May 30, 2010
Messages
24
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Location
Australia
Activity points
1,448
PWM sync

Hi!
I'm using a 16f88.
How can I sync to the PWM? i.e. can I know in software when the PWM cycle starts/ends?
I need to 'switch' the path of the PWM on alternate pulses, I'll use another digital output to control the path of the PWM via NAND gates.
I know there are other PICs with two or more PWM output pins, but I want to use my 16f88, and besides i need the pulses to alternate, so even if i had two PWMs i still need to know in software the start/end of cycle in order to sync them...
it could be as easy as just cheking a flag in some register, but i can't find it in the data sheet.
could i set an interrupt when tmr2 reaches 0 ? would this affect the opperation of PWM?

Thanks in advance this is my first post.
 

Hi,

Interesting point -- is Timer2 flag available when allocated to PWM ?

Well have just done this test on a 18F4520 and it seems to say it is.

Register PIR1, Bit1 TMR2IF is changed from 0 to 1 by the program - its the same in the 16F88.

You may be able to test that flag in your code loop although it might be better to use the interrupt system PIE1,TMR2IE etc.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top