Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/07/04 07:11
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#71948 - RE: Ramping up Freq with PCA
Responding to: ???'s previous message
Try this:

Note that from 1 KHz to 16 KHz there are a 15 steps needed if you change the frequency 1 KHz at a time.

Decide how long you want it to take for the ramp to get from 1 KHz to 16 KHz. For example decide that this ramp time should be 90 milliseconds.

Divide the ramp time by the number of steps to derive the time per step. In this example divide 90 msec by 15 steps to get 4 milliseconds per step.

Program a timer interrupt to produce an interrupt every 4 milliseconds.

Initialize a control variable that will be used by the timer interrupt. When this is zero it indicates that the 4 msec timer interrupt should start the ramp. If the value is negative or greater than 15 it means that a ramp activity is not going on. Initially set its value to -1 (0xFF).

Build a simple table of reload values for the PCA timer that produce timing outputs of 1 KHz, 2 Khz, 3 KHz etc up to 16 KHz. This table will have 15 entries and can be placed into the CODE part of the program. In assembler language this table would be accessed via the MOVC instruction.

In the 4 mSec timer interrupt routine you add code that looks at the control variable. If the control variable value is negative or greater than 15 then exit from the timer interrupt. Otherwise have the timer interrupt logic use the control variable as an index into the ramp lookup table. Fetch the current indexed table value and plug that value into the PCA timer re-load register and enable the PCA channel to run. Finally have the interrupt code increment the control variable value.

In the main line code whenever you want to start the ramp set the control variable value to 0. The 4 msec timer interrupt routine will see the zero and start the ramp.

The main line code can poll the control variable and know that the ramp is complete when the variable value is greater than 15.

You could enhance this logic by introducing a second control variable that decrements instead of increments. A second block of code in the timer interrupt could look at this additional variable and implement a scheme that would support a down ramp of the pulse generation. The main line code can then initiate a ramp down by setting this second control variable to a value of 15 and poll till the interrupt has decremented it to past zero (-1 or 0xFF) to know when the down ramps is complete.

You can translate that from text to a flow chart and then to code. Good luck getting your motor going.

Michael Karas


List of 8 messages in thread
TopicAuthorDate
Ramping up Freq with PCA            01/01/70 00:00      
   RE: Ramping up Freq with PCA            01/01/70 00:00      
      RE: Ramping up Freq with PCA            01/01/70 00:00      
   For Michael Karas            01/01/70 00:00      
      RE: For Michael Karas            01/01/70 00:00      
         RE: Aluminum Elec Caps            01/01/70 00:00      
      RE: Ramp and Torque            01/01/70 00:00      
   RE: Ramping up Freq with PCA            01/01/70 00:00      

Back to Subject List