Home » Archimedes archive » Archimedes World » AW_Vol15_Issue7 CD ROM Index Disc.adf » !Thermo1_part1 » 1624Test
1624Test
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 » Archimedes World » AW_Vol15_Issue7 CD ROM Index Disc.adf » !Thermo1_part1 |
Filename: | 1624Test |
Read OK: | ✔ |
File size: | 0561 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10DIM buf% 4, val% 4 20PRINT "DS1624 test program" 21PRINT 30PROCinit_1624 40 50REM 1st reading after power-up likely to be wrong 60 70t% = TIME + 100 80 90REM Wait 1 second for conversion to complete 100 110REPEAT 120UNTIL (TIME > t%) 130 140PROCget_sensors 150 160END 170 180DEF PROCinit_1624 190 200REM Init sensors 210 220FOR addr% = &90 TO &9E STEP 2 230 REM Access config - continuous conversion 240 buf%?0 = &AC 250 buf%?1 = &4A 260 e% = FNdo_iic(addr%,buf%,2) 270 IF (e% AND 1) =0 280 buf%?0 = &EE 290 e% = FNdo_iic(addr%,buf%,1) 300 ENDIF 310NEXT 320 330ENDPROC 340 350DEF PROCget_sensors 360 370text$ = "" 380@% = &01020206 390 400REM Read 8 sensors and print results 410 420FOR s% = 0 TO 7 430 addr% = &90 + s% * 2 440 IF addr% > &90 THEN text$ = text$ + ", " 450 PROCget_1624(addr%) 460 IF (e% AND 1) =0 THEN 470 PRINT "Sensor "; ~s%, !val%/256; "�C" 480 ELSE 490 PRINT "Sensor "; ~s%, "No response" 500 ENDIF 510NEXT 520 530@% = &0000090A 540 550ENDPROC 560 570DEF PROCget_1624(addr%) 580 590REM Read one sensor 600 610buf%?0 = &AA 620e% = FNdo_iic(addr%,buf%,1) 630IF (e% AND 1) =1 ENDPROC 640!val% = 0 650e% = FNdo_iic(addr%+1,buf%,2) 660IF (e% AND 1) =1 ENDPROC 670val%?0 = buf%?1 680val%?1 = buf%?0 681REM Check for negative value 690IF !val% > &7FFF THEN 691 REM Need to set top 16 bits 700 val%?2 = &FF 710 val%?3 = &FF 720ENDIF 730text$ = text$ + STR$(!val%/256) 740 750ENDPROC 760 770DEF FNdo_iic(addr%, ptr%, num%) 780LOCAL e% 790SYS "XIIC_Control", addr%, ptr%, num% TO ; e% 800WAIT 810= e%
� buf% 4, val% 4 � "DS1624 test program" � �init_1624 ( 23� 1st reading after power-up likely to be wrong < Ft% = � + 100 P Z.� Wait 1 second for conversion to complete d n� x� (� > t%) � ��get_sensors � �� � �� �init_1624 � �� Init sensors � �� addr% = &90 � &9E � 2 �- � Access config - continuous conversion � buf%?0 = &AC � buf%?1 = &4A e% = �do_iic(addr%,buf%,2) � (e% � 1) =0 buf%?0 = &EE "" e% = �do_iic(addr%,buf%,1) , � 6� @ J� T ^� �get_sensors h rtext$ = "" |@% = &01020206 � �&� Read 8 sensors and print results � �� s% = 0 � 7 � addr% = &90 + s% * 2 �* � addr% > &90 � text$ = text$ + ", " � �get_1624(addr%) � � (e% � 1) =0 � �) � "Sensor "; ~s%, !val%/256; "�C" � � �' � "Sensor "; ~s%, "No response" � � �� @% = &0000090A &� 0 :� �get_1624(addr%) D N� Read one sensor X bbuf%?0 = &AA le% = �do_iic(addr%,buf%,1) v� (e% � 1) =1 � � !val% = 0 � e% = �do_iic(addr%+1,buf%,2) �� (e% � 1) =1 � �val%?0 = buf%?1 �val%?1 = buf%?0 �� Check for negative value �� !val% > &7FFF � � � Need to set top 16 bits � val%?2 = &FF � val%?3 = &FF �� � text$ = text$ + �(!val%/256) � �� � � �do_iic(addr%, ptr%, num%) � e% /ș "XIIC_Control", addr%, ptr%, num% � ; e% Ȗ *= e% �
00000000 0d 00 0a 14 de 20 62 75 66 25 20 34 2c 20 76 61 |..... buf% 4, va| 00000010 6c 25 20 34 0d 00 14 1b f1 20 22 44 53 31 36 32 |l% 4..... "DS162| 00000020 34 20 74 65 73 74 20 70 72 6f 67 72 61 6d 22 0d |4 test program".| 00000030 00 15 05 f1 0d 00 1e 0e f2 69 6e 69 74 5f 31 36 |.........init_16| 00000040 32 34 0d 00 28 04 0d 00 32 33 f4 20 31 73 74 20 |24..(...23. 1st | 00000050 72 65 61 64 69 6e 67 20 61 66 74 65 72 20 70 6f |reading after po| 00000060 77 65 72 2d 75 70 20 6c 69 6b 65 6c 79 20 74 6f |wer-up likely to| 00000070 20 62 65 20 77 72 6f 6e 67 0d 00 3c 04 0d 00 46 | be wrong..<...F| 00000080 10 74 25 20 3d 20 91 20 2b 20 31 30 30 0d 00 50 |.t% = . + 100..P| 00000090 04 0d 00 5a 2e f4 20 57 61 69 74 20 31 20 73 65 |...Z.. Wait 1 se| 000000a0 63 6f 6e 64 20 66 6f 72 20 63 6f 6e 76 65 72 73 |cond for convers| 000000b0 69 6f 6e 20 74 6f 20 63 6f 6d 70 6c 65 74 65 0d |ion to complete.| 000000c0 00 64 04 0d 00 6e 05 f5 0d 00 78 0e fd 20 28 91 |.d...n....x.. (.| 000000d0 20 3e 20 74 25 29 0d 00 82 04 0d 00 8c 10 f2 67 | > t%).........g| 000000e0 65 74 5f 73 65 6e 73 6f 72 73 0d 00 96 04 0d 00 |et_sensors......| 000000f0 a0 05 e0 0d 00 aa 04 0d 00 b4 10 dd 20 f2 69 6e |............ .in| 00000100 69 74 5f 31 36 32 34 0d 00 be 04 0d 00 c8 12 f4 |it_1624.........| 00000110 20 49 6e 69 74 20 73 65 6e 73 6f 72 73 0d 00 d2 | Init sensors...| 00000120 04 0d 00 dc 1b e3 20 61 64 64 72 25 20 3d 20 26 |...... addr% = &| 00000130 39 30 20 b8 20 26 39 45 20 88 20 32 0d 00 e6 2d |90 . &9E . 2...-| 00000140 20 20 f4 20 41 63 63 65 73 73 20 63 6f 6e 66 69 | . Access confi| 00000150 67 20 2d 20 63 6f 6e 74 69 6e 75 6f 75 73 20 63 |g - continuous c| 00000160 6f 6e 76 65 72 73 69 6f 6e 0d 00 f0 12 20 20 62 |onversion.... b| 00000170 75 66 25 3f 30 20 3d 20 26 41 43 0d 00 fa 12 20 |uf%?0 = &AC.... | 00000180 20 62 75 66 25 3f 31 20 3d 20 26 34 41 0d 01 04 | buf%?1 = &4A...| 00000190 20 20 20 65 25 20 3d 20 a4 64 6f 5f 69 69 63 28 | e% = .do_iic(| 000001a0 61 64 64 72 25 2c 62 75 66 25 2c 32 29 0d 01 0e |addr%,buf%,2)...| 000001b0 13 20 20 e7 20 28 65 25 20 80 20 31 29 20 3d 30 |. . (e% . 1) =0| 000001c0 0d 01 18 14 20 20 20 20 62 75 66 25 3f 30 20 3d |.... buf%?0 =| 000001d0 20 26 45 45 0d 01 22 22 20 20 20 20 65 25 20 3d | &EE.."" e% =| 000001e0 20 a4 64 6f 5f 69 69 63 28 61 64 64 72 25 2c 62 | .do_iic(addr%,b| 000001f0 75 66 25 2c 31 29 0d 01 2c 07 20 20 cd 0d 01 36 |uf%,1)..,. ...6| 00000200 05 ed 0d 01 40 04 0d 01 4a 05 e1 0d 01 54 04 0d |....@...J....T..| 00000210 01 5e 12 dd 20 f2 67 65 74 5f 73 65 6e 73 6f 72 |.^.. .get_sensor| 00000220 73 0d 01 68 04 0d 01 72 0e 74 65 78 74 24 20 3d |s..h...r.text$ =| 00000230 20 22 22 0d 01 7c 12 40 25 20 3d 20 26 30 31 30 | ""..|.@% = &010| 00000240 32 30 32 30 36 0d 01 86 04 0d 01 90 26 f4 20 52 |20206.......&. R| 00000250 65 61 64 20 38 20 73 65 6e 73 6f 72 73 20 61 6e |ead 8 sensors an| 00000260 64 20 70 72 69 6e 74 20 72 65 73 75 6c 74 73 0d |d print results.| 00000270 01 9a 04 0d 01 a4 10 e3 20 73 25 20 3d 20 30 20 |........ s% = 0 | 00000280 b8 20 37 0d 01 ae 1a 20 20 61 64 64 72 25 20 3d |. 7.... addr% =| 00000290 20 26 39 30 20 2b 20 73 25 20 2a 20 32 0d 01 b8 | &90 + s% * 2...| 000002a0 2a 20 20 e7 20 61 64 64 72 25 20 3e 20 26 39 30 |* . addr% > &90| 000002b0 20 8c 20 74 65 78 74 24 20 3d 20 74 65 78 74 24 | . text$ = text$| 000002c0 20 2b 20 22 2c 20 22 0d 01 c2 16 20 20 f2 67 65 | + ", ".... .ge| 000002d0 74 5f 31 36 32 34 28 61 64 64 72 25 29 0d 01 cc |t_1624(addr%)...| 000002e0 15 20 20 e7 20 28 65 25 20 80 20 31 29 20 3d 30 |. . (e% . 1) =0| 000002f0 20 8c 0d 01 d6 29 20 20 20 20 f1 20 22 53 65 6e | ....) . "Sen| 00000300 73 6f 72 20 22 3b 20 7e 73 25 2c 20 21 76 61 6c |sor "; ~s%, !val| 00000310 25 2f 32 35 36 3b 20 22 b0 43 22 0d 01 e0 07 20 |%/256; ".C".... | 00000320 20 cc 0d 01 ea 27 20 20 20 20 f1 20 22 53 65 6e | ....' . "Sen| 00000330 73 6f 72 20 22 3b 20 7e 73 25 2c 20 22 4e 6f 20 |sor "; ~s%, "No | 00000340 72 65 73 70 6f 6e 73 65 22 0d 01 f4 07 20 20 cd |response".... .| 00000350 0d 01 fe 05 ed 0d 02 08 04 0d 02 12 12 40 25 20 |.............@% | 00000360 3d 20 26 30 30 30 30 30 39 30 41 0d 02 1c 04 0d |= &0000090A.....| 00000370 02 26 05 e1 0d 02 30 04 0d 02 3a 16 dd 20 f2 67 |.&....0...:.. .g| 00000380 65 74 5f 31 36 32 34 28 61 64 64 72 25 29 0d 02 |et_1624(addr%)..| 00000390 44 04 0d 02 4e 15 f4 20 52 65 61 64 20 6f 6e 65 |D...N.. Read one| 000003a0 20 73 65 6e 73 6f 72 0d 02 58 04 0d 02 62 10 62 | sensor..X...b.b| 000003b0 75 66 25 3f 30 20 3d 20 26 41 41 0d 02 6c 1e 65 |uf%?0 = &AA..l.e| 000003c0 25 20 3d 20 a4 64 6f 5f 69 69 63 28 61 64 64 72 |% = .do_iic(addr| 000003d0 25 2c 62 75 66 25 2c 31 29 0d 02 76 13 e7 20 28 |%,buf%,1)..v.. (| 000003e0 65 25 20 80 20 31 29 20 3d 31 20 e1 0d 02 80 0d |e% . 1) =1 .....| 000003f0 21 76 61 6c 25 20 3d 20 30 0d 02 8a 20 65 25 20 |!val% = 0... e% | 00000400 3d 20 a4 64 6f 5f 69 69 63 28 61 64 64 72 25 2b |= .do_iic(addr%+| 00000410 31 2c 62 75 66 25 2c 32 29 0d 02 94 13 e7 20 28 |1,buf%,2)..... (| 00000420 65 25 20 80 20 31 29 20 3d 31 20 e1 0d 02 9e 13 |e% . 1) =1 .....| 00000430 76 61 6c 25 3f 30 20 3d 20 62 75 66 25 3f 31 0d |val%?0 = buf%?1.| 00000440 02 a8 13 76 61 6c 25 3f 31 20 3d 20 62 75 66 25 |...val%?1 = buf%| 00000450 3f 30 0d 02 a9 1e f4 20 43 68 65 63 6b 20 66 6f |?0..... Check fo| 00000460 72 20 6e 65 67 61 74 69 76 65 20 76 61 6c 75 65 |r negative value| 00000470 0d 02 b2 15 e7 20 21 76 61 6c 25 20 3e 20 26 37 |..... !val% > &7| 00000480 46 46 46 20 8c 0d 02 b3 1f 20 20 f4 20 4e 65 65 |FFF ..... . Nee| 00000490 64 20 74 6f 20 73 65 74 20 74 6f 70 20 31 36 20 |d to set top 16 | 000004a0 62 69 74 73 0d 02 bc 12 20 20 76 61 6c 25 3f 32 |bits.... val%?2| 000004b0 20 3d 20 26 46 46 0d 02 c6 12 20 20 76 61 6c 25 | = &FF.... val%| 000004c0 3f 33 20 3d 20 26 46 46 0d 02 d0 05 cd 0d 02 da |?3 = &FF........| 000004d0 20 74 65 78 74 24 20 3d 20 74 65 78 74 24 20 2b | text$ = text$ +| 000004e0 20 c3 28 21 76 61 6c 25 2f 32 35 36 29 0d 02 e4 | .(!val%/256)...| 000004f0 04 0d 02 ee 05 e1 0d 02 f8 04 0d 03 02 20 dd 20 |............. . | 00000500 a4 64 6f 5f 69 69 63 28 61 64 64 72 25 2c 20 70 |.do_iic(addr%, p| 00000510 74 72 25 2c 20 6e 75 6d 25 29 0d 03 0c 08 ea 20 |tr%, num%)..... | 00000520 65 25 0d 03 16 2f c8 99 20 22 58 49 49 43 5f 43 |e%.../.. "XIIC_C| 00000530 6f 6e 74 72 6f 6c 22 2c 20 61 64 64 72 25 2c 20 |ontrol", addr%, | 00000540 70 74 72 25 2c 20 6e 75 6d 25 20 b8 20 3b 20 65 |ptr%, num% . ; e| 00000550 25 0d 03 20 06 c8 96 0d 03 2a 08 3d 20 65 25 0d |%.. .....*.= e%.| 00000560 ff |.| 00000561