CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

universal motor

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
eng/ IBRAHIM



Joined: 14 Aug 2007
Posts: 31

View user's profile Send private message

universal motor
PostPosted: Tue Mar 04, 2008 6:24 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Tue Mar 04, 2008 7:47 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Mar 04, 2008 8:50 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Tue Mar 04, 2008 9:02 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Mar 04, 2008 12:08 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Mar 05, 2008 5:05 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Mar 08, 2008 3:47 am     Reply with quote

hi
any one can help me for dimmer project by PIC
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Mar 08, 2008 12:02 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Mar 09, 2008 5:01 am     Reply with quote

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







PostPosted: Sun Mar 09, 2008 11:07 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Mar 31, 2008 2:45 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 02, 2008 1:05 am     Reply with quote

hi all
any one have answer or help?
umka



Joined: 28 Aug 2007
Posts: 99
Location: New Zealand

View user's profile Send private message

PostPosted: Sun Apr 13, 2008 11:20 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group