home *** CD-ROM | disk | FTP | other *** search
- \ A-TO-D.SEQ words to measure 80c196 a-to-d channels
-
-
- : .RZ ( 16bit n -- ) \ type a 16bit number with leading zeros
- >R (.) R> OVER - 0 ?DO ASCII 0 FEMIT LOOP TYPE ;
-
- : .volts ( adresult -- ) \ display voltage
- u16/ u2/ ( /32 ) 1 or ( add .5 LSB ) 5000 2048 */
- 1000 /mod 2 .R ascii . femit 3 .RZ ." v.\0 " ;
-
- : measure ( channel -- ) \ measure A to D channel
- 5 command
- com-out \ send channel number
- getword \ wait for result
- .volts \ show the result
- key? if key drop ." aborted" then ;
-
-
- create old-vertical 8 allot
-
- : measure-all ( -- ) \ measure all channels repeatedly
- savecursor
- cursor-off cls old-vertical 8 erase
- 0 1 at 16 spaces ." Mike's 80c196 8-channel voltmeter" 0 3 at
- ." 0 1 2 3 4 5 6 7"
- 0 22 at
- ." 0 1 2 3 4 5 6 7"
- begin
- 8 0 do
- 5 command i com-out getword \ measure channel i
- key? if drop leave then
- 20 over U16/ U16/ U16/ - \ vertical position for this voltage
- old-vertical i + c@ \ old vertical position
- 2dup <> if i 9 * swap at 9 spaces \ blank old position
- else drop then
- i 9 * over at \ go to new position
- old-vertical i + c! \ save new position
- >rev .volts >norm
- loop
- key? until
- key drop
- purge
- restcursor 0 23 at ;
-
-