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.

pic 24 motortr control conumdrum :0)

Status
Not open for further replies.

neddie

Full Member level 5
Full Member level 5
Joined
Feb 23, 2010
Messages
251
Helped
41
Reputation
82
Reaction score
35
Trophy points
1,308
Location
South Africa
Visit site
Activity points
3,026
pic 24 motor control conumdrum :0)

Hi to all.

I hope this explanation makes sense. I'm using a pic24fj256ga104 to control an AC motor using a triac. Speed control is achieved by varying the firing of the triac

with respect to the zero crossing. Phase control I think it called. It is all working as expected.

The issue I have is I'm sure I've made a "mountain out of a moll hill" with the coding. I'm sure the peripherals on this chip are powerful enough

do do this almost without processor intervention , just modifying the OC1R and OC1RS registers to adjust the firing angle.

My current implementation is as follows.Processor running at 16Mhz.

I have a zero crossing detector that gives me a 50% dutycycle (50 Hz) into the micro. That is connected to IC1 , configured to interrupt on both edges.

I get interrupted every 10mS , at zero crossing.(or close enough)

My output compare module is set for mode 5(Dual compare , continuous pulse).

I've set the OC1 clock source to Timer4. Timer4 clock is prescaled by 8 and a period (PR4 of 15000 = 7.5mS)

I've set the OC1 Trigger/Sync to timer 4 as well.

On interrupt from the IC1 module I clear timer 4 (TMR4 = 0) , Start timer 4 (T4CONbits.TON = 1) and set up the OC1R and OC1RS registers to the values I want.

I just send a quick pulse (50us) to the opto to fire the triac , I don't leave the triac drive on. I can then set a pulse that can occur from just after the zero crossing up

to 7.5ms after zero crossing , depending on the OC1R and OC1RS registers.

When Timer 4 interrupt occurs (15000 counts or 7.5mS later) , I turn off Timer 4 (T4CONbits.TON = 0).

On the next IC1 interrupt , the cycle repeats. Hope you get my explanation.

I'm sure I'm doing this all wrong and there is a more efficient way of doing this. I shouldn't be turning timers on and off ect. I'm sure the trigger/sync etc should

handle all of that automatically.

Anyone got any better ways of doing this.

Cheers

Neddie
 

Do you want a pulse train or a single pulse to turn ON the TRIAC..?

If you just need a pulse means

=> Give the ZCD in a ext interrupt
=> when it invokes start a timer whose value is depend on the firing angle
=> in timer Isr Set the output pin
=> also clear all the output pins in ZCD (step 1)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top