interrupt problem

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

interrupt problem

Postby ho2000 » Wed Jun 29, 2011 7:31 pm

Im using pic16F690 to control the dc gear motor with encoder,SPG30E-20K.
1)what pwm coding should i write to get the feedback signal from the motor to pic.
2)as what i know dc motor will not able to run at low speed and i have to increase the frequency of the oscillator to make it turn.as what the effect to the dc motor if i set my frequency to maximum in order to make the motor able to run at low speed and high speed.
3)what will be maximum frequency can be provide by pic16F690.

thanks.
ho2000
Freshie
 
Posts: 7
Joined: Wed Jun 29, 2011 6:54 pm

Re: Regard about my project

Postby shahrul » Wed Jun 29, 2011 10:47 pm

ho2000 WROTE:Im using pic16F690 to control the dc gear motor with encoder,SPG30E-20K.
1)what pwm coding should i write to get the feedback signal from the motor to pic.
2)as what i know dc motor will not able to run at low speed and i have to increase the frequency of the oscillator to make it turn.as what the effect to the dc motor if i set my frequency to maximum in order to make the motor able to run at low speed and high speed.
3)what will be maximum frequency can be provide by pic16F690.

thanks.

1) Use PWM coding, ex Lesson PWM. The feedback is in pulse, you can read encoder by coding or interrupt.
2) No need to increase crystal frequency, but use right PWM frequency. 10kHz PWM can drive DC Motor. ex Lesson DC Motor.
3) Depends on your crystal frequency. Higher crystal frequenvy, higher PWM frequency you can get.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: Regard about my project

Postby robosang » Thu Jun 30, 2011 9:09 pm

I remember reading RH2T magazine and one of the article talk about using Cytron motor with encoder. They give example on the circuit and code. They even capture a video..... let me search the volume and get the video.

You can download the E-copy from the robot magazine website: http://www.robothead2toe.com.my/, of course the sample source code are there too. You should check out the volume 8. I like their work 8-)

Here is the video:
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: Regard about my project

Postby aurora » Fri Jul 01, 2011 12:35 am

I like the video, very nice demo. I haven't play with quadrature motor (heck, i never heard of it until I saw this video).

This video just make me want to try it some day. :lol:
aurora
Discoverer
 
Posts: 126
Joined: Sun Jun 07, 2009 4:52 pm

Re: Regard about my project

Postby ho2000 » Fri Jul 01, 2011 1:26 am

Thanks all the information you all give is really useful
ho2000
Freshie
 
Posts: 7
Joined: Wed Jun 29, 2011 6:54 pm

Re: Regard about my project

Postby ho2000 » Thu Jul 07, 2011 12:28 pm

i use interrupt at my feedback part but how i gonna set my mcu to only detect the feedback clock pluse in 1 second?so i can get the rpm.(as the motor wil run all the time when set to a speed)
ho2000
Freshie
 
Posts: 7
Joined: Wed Jun 29, 2011 6:54 pm

Re: Regard about my project

Postby shahrul » Fri Jul 08, 2011 9:06 pm

ho2000 WROTE:i use interrupt at my feedback part but how i gonna set my mcu to only detect the feedback clock pluse in 1 second?so i can get the rpm.(as the motor wil run all the time when set to a speed)

Use RB0 interrupt to count pulse and use timer interrupt to count 1 second.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: Regard about my project

Postby ho2000 » Tue Jul 12, 2011 12:10 pm

shahrul WROTE:
ho2000 WROTE:i use interrupt at my feedback part but how i gonna set my mcu to only detect the feedback clock pluse in 1 second?so i can get the rpm.(as the motor wil run all the time when set to a speed)

Use RB0 interrupt to count pulse and use timer interrupt to count 1 second.


how to type the code to let timer count in 1 second?
ho2000
Freshie
 
Posts: 7
Joined: Wed Jun 29, 2011 6:54 pm

Re: Regard about my project

Postby shahrul » Tue Jul 12, 2011 12:46 pm

ho2000 WROTE:
shahrul WROTE:Use RB0 interrupt to count pulse and use timer interrupt to count 1 second.


how to type the code to let timer count in 1 second?

See this interrupt example use Timer0, Timer1, Timer2 interrupt.
See this dc motor example calculate revolution per minute.
See this clock example calculate every second.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: Regard about my project

Postby ho2000 » Wed Jul 13, 2011 4:09 pm

to let pic capture the feedback from motor i only can use timer1 to do it?
ho2000
Freshie
 
Posts: 7
Joined: Wed Jun 29, 2011 6:54 pm

Next

Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 5 guests