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.

Clock delay using Interrupt .

Status
Not open for further replies.

deeplearns

Member level 4
Joined
May 19, 2011
Messages
75
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,939
Hi Friends ,

I am using PIC 18F4520 (Instruction cycle 125 ns )to run a bipolar stepper motor . I need to give the driver card clock pulses .
But whatever I set the timer value to It does not generate a clock pulse ;lesser than 16 ms ..8 on , 8 off .
I have checked the pulses in Proteus , also with a CRO .
But when I just tried the same using delay function it works exactly fine .

Please help .
 

An instruction cycle of 125ns, so the FOSC is 32MHz?

What is the frequency and duty cycle of the pulse you desire?

BigDog
 

..i am using internal clock so it makes it to Fosc/4 .
i am using a formula to convert the rpm desired into no of instruction ..and then i set the timer value accordingly .

Timervalue=65,535- constant / RPM . where the constant varies depending upon the rpm range .in general for 37 to 200 rpm it is 2400000 . It is calculated as follows .1 rotation means completed 200 steps(1 step=1.8 degree ) . hence 200 interrupts .
 

i think the best idea is to see the timer not to wait for the instruction.

please give me more details what frequency do you need?
 
RPM decides the frequency ... i have even tried to give the timer a fixed interrupt period ..like putting the TIMER VALUE =2400 and then creating interrupts . As said what ever timer value i select the pulse period remains to be 8 milli seconds .

I have initialized a port and then on every interrupt i switch the port value .1 0 1 0 ... cretaing a clock to a bipolar motor driver ...but the pulse duration does not change .

what can i do . can someone give me a simple program for the same .


also what do you mean by ::: to see the timer not to wait for the instruction.
 

sorry a stupid question the PWM module did you use it?

because 8 msec is like 125Hz it is very slow speed and with PWM you can do it easilly.

You can use PWM interrupt to make the pulse duration
 

the speed requirements are actualy yery high to very low i.e 0.75 ms to 8ms will the pwm technique work ...if not can you tell me why timers arent giving the correct ..what could be the possible debugging points .

Appreciate your help.
 

the pwm will work no problem i think.

with timer i did understand the solution sorry..

---------- Post added at 12:51 ---------- Previous post was at 12:50 ----------

the pwm will work no problem i think.

with timer i did understand the solution sorry..
 
pwm is generally used to vary the on and off time , and in this stepper motor control application i do not want to vary the on and off time . its just that i can set the RPM*(variable ) , once set it has to be same for that instance .I should be able to reprogram it to a new RPM value .
Hence i think timers will be a better option .
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top