Beginners: please read this post and this post before posting to the forum.
0 Members and 1 Guest are viewing this topic.
so that when the uC stops sending PWM signal, the leg of the patient after the second phase will be in its initial position before the initial phase begins.
I want the uC to send the PWM signal to the motor for the same duration that it did on the initial phase of the knee manipulation, only in reverse direction,
Quote from: Batienzaxcore on September 09, 2012, 12:28:12 AM I want the uC to send the PWM signal to the motor for the same duration that it did on the initial phase of the knee manipulation, only in reverse direction, So far, OK. That's pretty easy to do. If the duty cycle was constant, just use a timer.Quoteso that when the uC stops sending PWM signal, the leg of the patient after the second phase will be in its initial position before the initial phase begins.And this is where it falls apart. Applying the reverse torque / time profile won't move it back to the initial position. If gravity (or any other load) were never a factor, it might come somewhat close. Sorta. But the torque (function of duty cycle) * time required to lift the leg is going to be a lot different than the torque * time required to bring it back down.
This part of the topic would be in a different category, so I would like to focus first on the PWM signal timer thing.
bool raising_leg = false;int seconds_passed = 0;set ADC level shift interrupt;set timer1 to run PWM;set timer2 to call interrupts every 1 second;raising_leg = true;start PWM;start timer2;adc_level_shift_interrupt{ stop pwm; stop timer2; raising_leg = false; start timer2; start reverse pwm;}timer2_interrupt{ if(raising_leg) { seconds_passed++; } else { if(seconds_passed <= 0) { stop pwm; } seconds_passed--; }}
Could you post the link on it? I'm not really familiar with Microchip's sites.
Th problem I'm having is the code thing, [...]
and what value of a potentiometer would be preferable to use in converting it's resistance (or output voltage) to an angle output in an LCD Display.
Th problem I'm having is the code thing,