Home » Archimedes archive » Acorn Computing » 1994 09.adf » 9409 » BodyBuild/Servo1

BodyBuild/Servo1

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn Computing » 1994 09.adf » 9409
Filename: BodyBuild/Servo1
Read OK:
File size: 029C bytes
Load address: 0000
Exec address: 0000
File contents
   10REM>Servo1
   20REM Servo Motor Control
   30PRINT"Servo Motor Control by Mike Cook"
   40PRINT"Using the USER PORT"
   50PRINT"Press a key (1 to 7) to change the motor position"
   60PRINT:PRINT:PRINT
   70DIM T%(16)
   80PROC_Pint
   90REPEAT
  100PRINTCHR$(11);
  110PRINT"Position ";P%;" shift pattern &";~S%;SPC(2)
  120P$=GET$
  130P%=ASC(P$) AND 7
  140S%=T%(P%)
  150SYS"OS_Byte",151,&6A,S%
  160UNTIL FALSE
  170END
  180
  190DEF PROC_Pint
  200LOCAL A%
  210SYS"OS_Byte",150,&6B TO ,,A%
  220A%=(A% AND &E3) OR &10
  230SYS"OS_Byte",151,&6B,A% : REM Set shift reg to mode 4
  240SYS"OS_Byte",151,&68,&C0 : REM Pulse peroid
  250S%=&F:P%=4
  260SYS"OS_Byte",151,&6A,S%  : REM Inital bit pattern
  270
  280REM Look up table for position
  290FOR A%=0 TO 7
  300READ T%(A%)
  310NEXT
  320DATA 1,1,3,7,&F,&1F,&3F,&7F
  330ENDPROC
�>Servo1
� Servo Motor Control
'�"Servo Motor Control by Mike Cook"
(�"Using the USER PORT"
28�"Press a key (1 to 7) to change the motor position"
<	�:�:�
F� T%(16)
P
�_Pint
Z�
d�(11);
n/�"Position ";P%;" shift pattern &";~S%;�(2)
xP$=�
�P%=�(P$) � 7
�
S%=T%(P%)
�ș"OS_Byte",151,&6A,S%
�� �
��
�
�� �_Pint
�� A%
�ș"OS_Byte",150,&6B � ,,A%
�A%=(A% � &E3) � &10
�6ș"OS_Byte",151,&6B,A% : � Set shift reg to mode 4
�,ș"OS_Byte",151,&68,&C0 : � Pulse peroid
�S%=&F:P%=4
2ș"OS_Byte",151,&6A,S%  : � Inital bit pattern

 � Look up table for position
"� A%=0 � 7
,� T%(A%)
6�
@� 1,1,3,7,&F,&1F,&3F,&7F
J�
�
00000000  0d 00 0a 0c f4 3e 53 65  72 76 6f 31 0d 00 14 19  |.....>Servo1....|
00000010  f4 20 53 65 72 76 6f 20  4d 6f 74 6f 72 20 43 6f  |. Servo Motor Co|
00000020  6e 74 72 6f 6c 0d 00 1e  27 f1 22 53 65 72 76 6f  |ntrol...'."Servo|
00000030  20 4d 6f 74 6f 72 20 43  6f 6e 74 72 6f 6c 20 62  | Motor Control b|
00000040  79 20 4d 69 6b 65 20 43  6f 6f 6b 22 0d 00 28 1a  |y Mike Cook"..(.|
00000050  f1 22 55 73 69 6e 67 20  74 68 65 20 55 53 45 52  |."Using the USER|
00000060  20 50 4f 52 54 22 0d 00  32 38 f1 22 50 72 65 73  | PORT"..28."Pres|
00000070  73 20 61 20 6b 65 79 20  28 31 20 74 6f 20 37 29  |s a key (1 to 7)|
00000080  20 74 6f 20 63 68 61 6e  67 65 20 74 68 65 20 6d  | to change the m|
00000090  6f 74 6f 72 20 70 6f 73  69 74 69 6f 6e 22 0d 00  |otor position"..|
000000a0  3c 09 f1 3a f1 3a f1 0d  00 46 0c de 20 54 25 28  |<..:.:...F.. T%(|
000000b0  31 36 29 0d 00 50 0a f2  5f 50 69 6e 74 0d 00 5a  |16)..P.._Pint..Z|
000000c0  05 f5 0d 00 64 0b f1 bd  28 31 31 29 3b 0d 00 6e  |....d...(11);..n|
000000d0  2f f1 22 50 6f 73 69 74  69 6f 6e 20 22 3b 50 25  |/."Position ";P%|
000000e0  3b 22 20 73 68 69 66 74  20 70 61 74 74 65 72 6e  |;" shift pattern|
000000f0  20 26 22 3b 7e 53 25 3b  89 28 32 29 0d 00 78 08  | &";~S%;.(2)..x.|
00000100  50 24 3d be 0d 00 82 10  50 25 3d 97 28 50 24 29  |P$=.....P%=.(P$)|
00000110  20 80 20 37 0d 00 8c 0d  53 25 3d 54 25 28 50 25  | . 7....S%=T%(P%|
00000120  29 0d 00 96 1a c8 99 22  4f 53 5f 42 79 74 65 22  |)......"OS_Byte"|
00000130  2c 31 35 31 2c 26 36 41  2c 53 25 0d 00 a0 07 fd  |,151,&6A,S%.....|
00000140  20 a3 0d 00 aa 05 e0 0d  00 b4 04 0d 00 be 0c dd  | ...............|
00000150  20 f2 5f 50 69 6e 74 0d  00 c8 08 ea 20 41 25 0d  | ._Pint..... A%.|
00000160  00 d2 1e c8 99 22 4f 53  5f 42 79 74 65 22 2c 31  |....."OS_Byte",1|
00000170  35 30 2c 26 36 42 20 b8  20 2c 2c 41 25 0d 00 dc  |50,&6B . ,,A%...|
00000180  17 41 25 3d 28 41 25 20  80 20 26 45 33 29 20 84  |.A%=(A% . &E3) .|
00000190  20 26 31 30 0d 00 e6 36  c8 99 22 4f 53 5f 42 79  | &10...6.."OS_By|
000001a0  74 65 22 2c 31 35 31 2c  26 36 42 2c 41 25 20 3a  |te",151,&6B,A% :|
000001b0  20 f4 20 53 65 74 20 73  68 69 66 74 20 72 65 67  | . Set shift reg|
000001c0  20 74 6f 20 6d 6f 64 65  20 34 0d 00 f0 2c c8 99  | to mode 4...,..|
000001d0  22 4f 53 5f 42 79 74 65  22 2c 31 35 31 2c 26 36  |"OS_Byte",151,&6|
000001e0  38 2c 26 43 30 20 3a 20  f4 20 50 75 6c 73 65 20  |8,&C0 : . Pulse |
000001f0  70 65 72 6f 69 64 0d 00  fa 0e 53 25 3d 26 46 3a  |peroid....S%=&F:|
00000200  50 25 3d 34 0d 01 04 32  c8 99 22 4f 53 5f 42 79  |P%=4...2.."OS_By|
00000210  74 65 22 2c 31 35 31 2c  26 36 41 2c 53 25 20 20  |te",151,&6A,S%  |
00000220  3a 20 f4 20 49 6e 69 74  61 6c 20 62 69 74 20 70  |: . Inital bit p|
00000230  61 74 74 65 72 6e 0d 01  0e 04 0d 01 18 20 f4 20  |attern....... . |
00000240  4c 6f 6f 6b 20 75 70 20  74 61 62 6c 65 20 66 6f  |Look up table fo|
00000250  72 20 70 6f 73 69 74 69  6f 6e 0d 01 22 0e e3 20  |r position..".. |
00000260  41 25 3d 30 20 b8 20 37  0d 01 2c 0c f3 20 54 25  |A%=0 . 7..,.. T%|
00000270  28 41 25 29 0d 01 36 05  ed 0d 01 40 1c dc 20 31  |(A%)..6....@.. 1|
00000280  2c 31 2c 33 2c 37 2c 26  46 2c 26 31 46 2c 26 33  |,1,3,7,&F,&1F,&3|
00000290  46 2c 26 37 46 0d 01 4a  05 e1 0d ff              |F,&7F..J....|
0000029c