Home » Archimedes archive » Acorn User » AU 1997-05 B.adf » Regulars » RTR/Peak1

RTR/Peak1

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 User » AU 1997-05 B.adf » Regulars
Filename: RTR/Peak1
Read OK:
File size: 026E bytes
Load address: 0000
Exec address: 0000
File contents
   10REM> Peak1
   20DIM PBK% 5,PBA% 4,PBD% 3
   30
   40PRINT "Peak Detector 1"
   50PRINT "By Mike Cook"
   60PRINT "You need an IIC interface and"
   70PRINT "The hardware described in the May 97 Acorn User"
   80PRINT "Press SPACE for each reading"
   90REM Set up the control register
  100REM read only Channel 0
  110?PBA%=0
  120SYS "IIC_Control",&90,PBA%,1
  130PBD%?0=&80
  140PBD%?1=0
  150REPEAT
  160REM Discharge Capacitor
  170SYS "IIC_Control",&70,PBD%,1
  180REM Remove the short
  190SYS "IIC_Control",&70,PBD%+1,1
  200PROCdel
  210REM Read the A/D
  220SYS "IIC_Control",&91,PBK%,3
  230PRINT "Hex ";~PBK%?2;" Decimal ";PBK%?2
  240A$=GET$
  250UNTIL FALSE
  260END
  270
  280DEF PROCdel
  290LOCAL T%
  300T%=TIME+1
  310REPEAT UNTIL TIME>T%
  320ENDPROC

�> Peak1
� PBK% 5,PBA% 4,PBD% 3

(� "Peak Detector 1"
2� "By Mike Cook"
<%� "You need an IIC interface and"
F7� "The hardware described in the May 97 Acorn User"
P$� "Press SPACE for each reading"
Z!� Set up the control register
d� read only Channel 0
n?PBA%=0
xș "IIC_Control",&90,PBA%,1
�PBD%?0=&80
�PBD%?1=0
��
�� Discharge Capacitor
�ș "IIC_Control",&70,PBD%,1
�� Remove the short
�!ș "IIC_Control",&70,PBD%+1,1
��del
�� Read the A/D
�ș "IIC_Control",&91,PBK%,3
�'� "Hex ";~PBK%?2;" Decimal ";PBK%?2
�A$=�
�� �
�


� �del
"� T%
,
T%=�+1
6� � �>T%
@�
�
00000000  0d 00 0a 0c f4 3e 20 50  65 61 6b 31 0d 00 14 1a  |.....> Peak1....|
00000010  de 20 50 42 4b 25 20 35  2c 50 42 41 25 20 34 2c  |. PBK% 5,PBA% 4,|
00000020  50 42 44 25 20 33 0d 00  1e 04 0d 00 28 17 f1 20  |PBD% 3......(.. |
00000030  22 50 65 61 6b 20 44 65  74 65 63 74 6f 72 20 31  |"Peak Detector 1|
00000040  22 0d 00 32 14 f1 20 22  42 79 20 4d 69 6b 65 20  |"..2.. "By Mike |
00000050  43 6f 6f 6b 22 0d 00 3c  25 f1 20 22 59 6f 75 20  |Cook"..<%. "You |
00000060  6e 65 65 64 20 61 6e 20  49 49 43 20 69 6e 74 65  |need an IIC inte|
00000070  72 66 61 63 65 20 61 6e  64 22 0d 00 46 37 f1 20  |rface and"..F7. |
00000080  22 54 68 65 20 68 61 72  64 77 61 72 65 20 64 65  |"The hardware de|
00000090  73 63 72 69 62 65 64 20  69 6e 20 74 68 65 20 4d  |scribed in the M|
000000a0  61 79 20 39 37 20 41 63  6f 72 6e 20 55 73 65 72  |ay 97 Acorn User|
000000b0  22 0d 00 50 24 f1 20 22  50 72 65 73 73 20 53 50  |"..P$. "Press SP|
000000c0  41 43 45 20 66 6f 72 20  65 61 63 68 20 72 65 61  |ACE for each rea|
000000d0  64 69 6e 67 22 0d 00 5a  21 f4 20 53 65 74 20 75  |ding"..Z!. Set u|
000000e0  70 20 74 68 65 20 63 6f  6e 74 72 6f 6c 20 72 65  |p the control re|
000000f0  67 69 73 74 65 72 0d 00  64 19 f4 20 72 65 61 64  |gister..d.. read|
00000100  20 6f 6e 6c 79 20 43 68  61 6e 6e 65 6c 20 30 0d  | only Channel 0.|
00000110  00 6e 0b 3f 50 42 41 25  3d 30 0d 00 78 1f c8 99  |.n.?PBA%=0..x...|
00000120  20 22 49 49 43 5f 43 6f  6e 74 72 6f 6c 22 2c 26  | "IIC_Control",&|
00000130  39 30 2c 50 42 41 25 2c  31 0d 00 82 0e 50 42 44  |90,PBA%,1....PBD|
00000140  25 3f 30 3d 26 38 30 0d  00 8c 0c 50 42 44 25 3f  |%?0=&80....PBD%?|
00000150  31 3d 30 0d 00 96 05 f5  0d 00 a0 19 f4 20 44 69  |1=0.......... Di|
00000160  73 63 68 61 72 67 65 20  43 61 70 61 63 69 74 6f  |scharge Capacito|
00000170  72 0d 00 aa 1f c8 99 20  22 49 49 43 5f 43 6f 6e  |r...... "IIC_Con|
00000180  74 72 6f 6c 22 2c 26 37  30 2c 50 42 44 25 2c 31  |trol",&70,PBD%,1|
00000190  0d 00 b4 16 f4 20 52 65  6d 6f 76 65 20 74 68 65  |..... Remove the|
000001a0  20 73 68 6f 72 74 0d 00  be 21 c8 99 20 22 49 49  | short...!.. "II|
000001b0  43 5f 43 6f 6e 74 72 6f  6c 22 2c 26 37 30 2c 50  |C_Control",&70,P|
000001c0  42 44 25 2b 31 2c 31 0d  00 c8 08 f2 64 65 6c 0d  |BD%+1,1.....del.|
000001d0  00 d2 12 f4 20 52 65 61  64 20 74 68 65 20 41 2f  |.... Read the A/|
000001e0  44 0d 00 dc 1f c8 99 20  22 49 49 43 5f 43 6f 6e  |D...... "IIC_Con|
000001f0  74 72 6f 6c 22 2c 26 39  31 2c 50 42 4b 25 2c 33  |trol",&91,PBK%,3|
00000200  0d 00 e6 27 f1 20 22 48  65 78 20 22 3b 7e 50 42  |...'. "Hex ";~PB|
00000210  4b 25 3f 32 3b 22 20 44  65 63 69 6d 61 6c 20 22  |K%?2;" Decimal "|
00000220  3b 50 42 4b 25 3f 32 0d  00 f0 08 41 24 3d be 0d  |;PBK%?2....A$=..|
00000230  00 fa 07 fd 20 a3 0d 01  04 05 e0 0d 01 0e 04 0d  |.... ...........|
00000240  01 18 0a dd 20 f2 64 65  6c 0d 01 22 08 ea 20 54  |.... .del..".. T|
00000250  25 0d 01 2c 0a 54 25 3d  91 2b 31 0d 01 36 0c f5  |%..,.T%=.+1..6..|
00000260  20 fd 20 91 3e 54 25 0d  01 40 05 e1 0d ff        | . .>T%..@....|
0000026e