Download RAMAC RESTORATION PROJECT

Transcript
HlGH 9
GOSUB Sense-And-Lock-Disk
ENDlF
LOOP
I******This function senses continuously and locks in when destination
I******has been reached******
Sense-And-Lock-Disk:
ADch = 0
HlGH CS
LOW CS
LOW CLK
SHIFTOUT Dataoutput, CLK, MSBFIRST, [ADch\l2]
SHIFTIN Datalnput, CLK, MSBPRE,[adcBits\l2]
IF (Disk-Dest =c 260) THEN
Disk-Current =( (adcbits*lO - 768 ) 1155) 'This is the curve fit equation
ELSEIF (Disk-Dest > 260) THEN
Disk-Current =( ( (adcbits* 10) 1 158 ) + (41422 1158) )
ENDlF
IF (Moving-UporOut = IAND Disk-Current =< Disk-Dest - 6 ) THEN
'This if statement provides the control system with a destination error margin
HlGH 8
LOW 9
SEROUT 0,240, ["!PWMSSU,% I 0000000]
SEROUT 0, 240, ["!PWMM4", 0, 0, 80, 6)
SEROUT 0,240, ["!PWMSS", %00100000]
SEROUT 0, 240, ["!PWMMPU,0, 0, 80, 61
GOSUB Check-And-Correct-Disk
ELSEIF (Moving-UporOut = 0 AND Disk-Current => Disk-Dest - 8) THEN
HlGH 8
LOW 9
SEROUT 0,240, ["!PWMSS", % I 0000000]
SEROUT 0, 240, ["!PWMM4", 0, 0, 80, 61
SEROUT 0,240, ["!PWMSSN,%00100000]
SEROUT 0, 240, ["!PWMM2", 0, 0, 80, 61
GOSUB Check-And-Correct-Disk