View previous topic :: View next topic |
Author |
Message |
eng/ IBRAHIM
Joined: 14 Aug 2007 Posts: 31
|
universal motor |
Posted: Tue Mar 04, 2008 6:24 am |
|
|
hi all
i try control in ac universal motor speed.i use 16f877,4MHz
and use zero crossing detection to sync puls which trigger the triac
i want us pot to control of phase angle of trigger puls.
when i use PWM without ZCD the motor play unstable not smooth motion.any one know what is the code can used
D0 puls out
D1 ZCD
A0 POT input[/img] |
|
|
Bcox
Joined: 09 Oct 2007 Posts: 17 Location: Windsor, CT
|
|
Posted: Tue Mar 04, 2008 7:47 am |
|
|
i am not sure how you would do this using the 16f877. Look into using the build in pwm feature. i am using this feature in another chip but am not trying to adjust phase. You might want to look at using a power pwm module. check out the ex_power_pwm.c example. This might be more up your ally with what you need. Good luck. |
|
|
eng/ IBRAHIM
Joined: 14 Aug 2007 Posts: 31
|
|
Posted: Tue Mar 04, 2008 8:50 am |
|
|
hi bcox
what is chip you using. and how you cotrol of load current.
wher can find the ex_power_pwm.c example |
|
|
Bcox
Joined: 09 Oct 2007 Posts: 17 Location: Windsor, CT
|
|
Posted: Tue Mar 04, 2008 9:02 am |
|
|
For my application, I am just turning a high current solenoid valve on and off. We control the current by varying the duty cycle but it would be the same if you are controlling a motor with PWM. I am using an 18F4520, but we are using this because we needed to have large memory and low power and many ADCs. This has the standard PWM built in like the 877 but i am using the internal clock at 4MHz to achieve frequencies as low as 300Hz for the PWM module. A power PWM pic would be something like the 18F2431. you can find the example in your example directory of your CCS installation. should be something like: C:\Program Files\PICC\Examples depending on where you installed the program to.
All, Please correct me if I am leading Ibrahim in the wrong direction here. |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Tue Mar 04, 2008 12:08 pm |
|
|
Look at Microchip application note AN521 for the simplest and most reliable zero crossing detector you will ever find. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
eng/ IBRAHIM
Joined: 14 Aug 2007 Posts: 31
|
|
Posted: Wed Mar 05, 2008 5:05 am |
|
|
hi
ok i make ZCD
but what is the code for sync output with ZCD and change phase angle. |
|
|
eng/ IBRAHIM
Joined: 14 Aug 2007 Posts: 31
|
|
Posted: Sat Mar 08, 2008 3:47 am |
|
|
hi
any one can help me for dimmer project by PIC |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Mar 08, 2008 12:02 pm |
|
|
You can use http://www.google.com to search the Microchip website
for application notes about dimmers. Use the following search string:
Quote: | site:microchip.com dimmer |
|
|
|
eng/ IBRAHIM
Joined: 14 Aug 2007 Posts: 31
|
|
Posted: Sun Mar 09, 2008 5:01 am |
|
|
hi all
i try this code the phase angle changing sync with ZCD (pulse 50 Hz)
but the output is generated in half cycle only(when input pulse is 0)
i need generate output pulse at 1 & 0 of input pulse.
what is incorrect of this code
#int_ext
void key_interrupt(void)
{
INT phaseangle;
phaseangle=6;
if (input(PIN_B0))
{
OUTPUT_LOW(PIN_D0);
DELAY_MS(phaseangle);
OUTPUT_HIGH(PIN_D0);
DELAY_MS(1);
OUTPUT_LOW(PIN_D0);
}
if (!input(PIN_B0))
{
OUTPUT_LOW(PIN_D0);
DELAY_MS(phaseangle);
OUTPUT_HIGH(PIN_D0);
DELAY_MS(1);
OUTPUT_LOW(PIN_D0);
}
}
VOID MOTOR()
{
ext_int_edge( L_TO_H );
enable_interrupts(int_ext);
enable_interrupts(global);
ext_int_edge( H_TO_L );
enable_interrupts(int_ext);
enable_interrupts(global);
}
void main()
{
MOTOR();
} |
|
|
Ttelmah Guest
|
|
Posted: Sun Mar 09, 2008 11:07 am |
|
|
The EXT interrupt, can only interrupt on high to low changes, _or_ low to high changes. The best way, would be to move the connection to one of the high PORTB pins, and use the 'interrupt on change' feature, which is present on these, which will interrupt on both edges. However the alternative is:
Code: |
#int_ext
void key_interrupt(void) {
INT phaseangle;
phaseangle=6;
if (input(PIN_B0)) {
//Here since the input is low, we now need to look for a low to high
//transition
ext_int_edge( L_TO_H );
OUTPUT_LOW(PIN_D0);
DELAY_MS(phaseangle);
OUTPUT_HIGH(PIN_D0);
DELAY_MS(1);
OUTPUT_LOW(PIN_D0);
}
else {
//Here since the input is high, we need to next look for the high
//to low transition
ext_int_edge( H_TO_L);
OUTPUT_LOW(PIN_D0);
DELAY_MS(phaseangle);
OUTPUT_HIGH(PIN_D0);
DELAY_MS(1);
OUTPUT_LOW(PIN_D0);
}
}
void main(void) {
if (input(PIN_B0)) ext_int_edge( H_TO_L );
else ext_int_edge(L_TO_H);
//You can only set _one_ active edge. Set it to the next change that
//can occur
clear_interrupts(INT_EXT);
enable_interrupts(int_ext);
enable_interrupts(global);
//Must ensure code does not exit.
while (true) {
}
}
|
Best Wishes |
|
|
eng/ IBRAHIM
Joined: 14 Aug 2007 Posts: 31
|
|
Posted: Mon Mar 31, 2008 2:45 am |
|
|
hi all
i find the program in microchip site make a dimmer but this program use PIC12c508 I try convert it to PIC16F877A but it not play
how can use this way by PIC16f877a to control in ac motor?
Code:
http://ww1.microchip.com/downloads/en/AppNotes/40171a.pdf |
|
|
eng/ IBRAHIM
Joined: 14 Aug 2007 Posts: 31
|
|
Posted: Wed Apr 02, 2008 1:05 am |
|
|
hi all
any one have answer or help? |
|
|
umka
Joined: 28 Aug 2007 Posts: 99 Location: New Zealand
|
|
Posted: Sun Apr 13, 2008 11:20 pm |
|
|
cant a universal motor be run on a dc supply? so you can just use a straight PWM to control it rather than an AC variable frequency drive |
|
|
|