A personal repository of random information in compensation for a fatigued biological computer
Slider on a web page returns a get with a range of 0-512 (reflects the actual step range of the target stepper module
For this we will have to use a elapsed time check using the tick functions as the time between steps for a Sony DVD head position stepper device is 2-3ms (empirically tested) any faster and it slips due to the acceleration. We will make the delay able to be variable later (whole ms increments). It seems 1ms is fine when half steps, but 3ms is required when full stepping for this particular stepper arrangement. Interestingly this means we can actually move faster with halfsteps..
Also, a rapid direction change requires a larger delay or we will slip a step or 3..
Additionally, we will have togglable options:
- full steps only
- half steps only
- mixed. In this full steps are used for faster/coarser movement with a final half step when required.
Also noticed that starting in full steps misses a few sometimes depending on the start point..
TCPIP Site changes:
Added ~slider2~ to sliders.cgi
Added another page 'step1.htm' with YUI slider.
hardwareprofile.h in my board section:
//Stepper Controller
#define STEPPER_TRIS (TRISD)
#define STEPPER_LAT (LATD)
#define STEPPER_USEHIGHNIBBLE
I need a GLOBAL variable and after a lot of hair pulling this works:
Add new files fnf.h & fnf.c and add them to the project:
// fnf.h ///////////////////// //Globals // Stepper extern WORD stepperrequiredposition; |
// fnf.c #include "TCPIP Stack/TCPIP.h" ///////////////////// //Globals // Stepper WORD stepperrequiredposition = 0; |
ADD to tcpip.h:
// My Custom |
maindemo.c changes - declares:
/**************************************************************************** static signed char stepperdirection = 0; WORD stepperminposition = 0; BYTE LCDTemp[8+1]; //////////////////////////////////////////////////////////////////////////////// |
maindemo.c added to section '// Initialize application specific hardware' section:
//StepperPins to Output steppertime = TickGet(); |
maindemo.c at very bottom of main loop
// Stepper Movement stepperposition += stepperdirection; // move a half step first #if defined(STEPPER_USE_HIGH_NIBBLE)
|
Note that from a previous exercise we already knew the increments required to drive our stepper:
L293DMotorFullStep[0] = 0b00000001;
L293DMotorFullStep[1] = 0b00000100;
L293DMotorFullStep[2] = 0b00000010;
L293DMotorFullStep[3] = 0b00001000;
L293DMotorHalfStep[0] = 0b00001000; // 8
L293DMotorHalfStep[1] = 0b00001001;
L293DMotorHalfStep[2] = 0b00000001; // 1
L293DMotorHalfStep[3] = 0b00000101;
L293DMotorHalfStep[4] = 0b00000100; // 4
L293DMotorHalfStep[5] = 0b00000110;
L293DMotorHalfStep[6] = 0b00000010; // 2
L293DMotorHalfStep[7] = 0b00001010; 2