| >the documentation on the Ayr web site, I don't have any way of printing
>postscript. What I need is something I can mail to a customer ASAP.
there is an excellent windows based PS reader which can print called
ROPS. The kit is on the Ayr server, but I know that you can also
find it with AltaVista.
It blows GhostScript away.
-Eric
|
|
Here are examples of both the Temperature Sensor / Watchdog Timer functionality
for the EBM3*-PA product.
First the Watchdog Timer
EBM3x-PA Watchdog timer example code
------------------------------------
The following are two example sets of code to enable
the watchdog timer. The code uses the Ms-DOS Debug utility
to show an an example. The code will only runs in DOS, Windows3.X or
Windows 95. A driver would have to be written to use the watchdog
with Windows NT.
-I is an 8 bit input from a ISA I/O address "IN port instruction"
-O is an 8 bit output to a ISA I/O address "OUT port instruction"
All number are in Hex.
Please consult chaoter 4 of the product manual for further
details on the registers.
The basic procedure is as follows.
1) Reset the watchdog.
2) Enable the watchdog in the required mode.
3) To stop the watchdog trigerring write data to ISA I/O 73
Example Sequences
-----------------
!This debug sequence will just set the watchdog flag
-O 75 03 Index register 3
-O 77 80 Reset the Watchdog timer and disable the watchdog.
-I 73 Read card status register
19 Bit 2 is a zero.
-O 75 03 Index register 3
-O 77 08 Enable the watchdog, Mode 1 ,delay 17.8mS
-I 73 Read card status register
1D Bit 2 is a one.
!This debug sequence will reset the SBC and 1.14 seconds
-O 75 03 Index register 3
-O 77 80 Reset the Watchdog timer and disbale the watchdog
-I 73 Read card status register
19 Bit 2 is a zero.
-O 75 03 Index register 3
-O 77 1B Enable the watchdog, Mode 3, delay 1.14S
!The SBC resets 1.14 seconds + 20ms delay after this command.
!A write of any data to I/O address 73 will reset the Watchdog timer
-O 73 FF
Martin McGregor
Next is a QBASIC example for the temperature sensor
REM
REM Basic program to convert temperature for a PIP10D-L
REM for a single CPU card.
REM
REM
CLS
start:
REM Initialise the variables
REM
REM
index = 0
idxport = 117
REM 75
dataport = 119
REM 77
REM AA
readtemp = 170
REM EE
startcon = 238
REM 22
stopcon = 34
REM 01
writeth = 1
REM 02
writetl = 2
REM A1
readth = 161
REM A2
readtl = 162
REM 0C
writecon = 12
REM AC
readcon = 172
REM The temperature setting =degrees c *2
hightemp = 40 * 2
lowtemp = 10 * 2
DATA dx(5)
RESET:
REM set the index to 0
OUT idxport, index
REM input a byte from the data port
ax = INP(dataport)
PRINT "Initial Data ";
GOSUB binaryprint
dx = INT(ax / 2)
REM Input data to check if bit 2 is set
REM This indicates that the temperature system
REM is setup if a "1"
IF dx / 2 <> INT(dx / 2) THEN GOTO inited
PRINT "Initialising"
ax = writecon
cx = 8
GOSUB sendcommand
REM 2(00000010b)= Continuous convertion
ax = 2
GOSUB senddata
ax = writeth
GOSUB sendcommand
ax = hightemp
cx = 9
GOSUB senddata
ax = writetl
GOSUB sendcommand
ax = lowtemp
cx = 9
GOSUB senddata
ax = readcon
cx = 8
GOSUB sendcommand
GOSUB getdata
PRINT "config ";
GOSUB binaryprint
PRINT
ax = readth
GOSUB sendcommand
GOSUB getdata
ax = ax / 2
bx = bx / 2
PRINT "High temp set 1="; ax; "C 2="; bx; "C"
ax = readtl
GOSUB sendcommand
GOSUB getdata
ax = ax / 2
bx = bx / 2
PRINT "Low temp set 1="; ax; "C 2="; bx; "C"
inited:
ax = startcon
GOSUB sendcommand
oldax = 0
oldbx = 0
loopr:
ax = readtemp
GOSUB sendcommand
GOSUB getdata
ax = ax / 2
bx = bx / 2
IF ax = oldax AND bx = oldbx THEN GOTO waitabit
PRINT "temperature Read 1="; ax; "C 2="; bx; "C at "; TIME$; " ";
oldax = ax
oldbx = bx
ax = readcon
cx = 8
GOSUB sendcommand
GOSUB getdata
GOSUB binaryprint
PRINT ; " ";
ax = bx
GOSUB binaryprint
PRINT ; "-";
ax = temp
GOSUB binaryprint
waitabit:
SLEEP 1
GOTO loopr
END
binaryprint:
REM routine to display in binary 8 bit format
IF ax > 255 THEN RETURN
tx = ax
FOR x = 7 TO 0 STEP -1
IF tx >= 2 ^ x THEN PRINT "1"; ELSE PRINT "0";
IF tx >= 2 ^ x THEN tx = tx - 2 ^ x
NEXT x
RETURN
sendcommand:
OUT idxport, index
OUT dataport, 2
OUT dataport, 0
GOSUB senddata
RETURN
senddata:
REM ax should contain the data in decimal
REM cx should have a counter of the number of bit to send.
REM ax will be destoyed by the command
REM PRINT ax,
FOR x = 0 TO cx - 1
IF ax / 2 <> INT(ax / 2) THEN OUT dataport, 17 ELSE OUT dataport, 0
REM IF ax / 2 <> INT(ax / 2) THEN PRINT ; "1"; ELSE PRINT ; "0";
ax = INT(ax / 2)
NEXT x
REM PRINT
RETURN
getdata:
ax = 0
bx = 0
REM ax should contain the data for temp 1 in decimal
REM bx should contain the data for temp 2 in decimal
REM cx should have a counter of the number of bit to receive.
REM PRINT "Data ",
FOR x = 0 TO cx - 1
temp = INP(dataport)
IF temp / 2 <> INT(temp / 2) THEN ax = ax + 2 ^ x
temp = INT(temp / 16)
IF temp / 2 <> INT(temp / 2) THEN bx = bx + 2 ^ x
REM IF temp / 2 <> INT(temp / 2) THEN PRINT ; "1"; ELSE PRINT ; "0";
NEXT x
REM PRINT
RETURN
Iain Grant
DMCC Product Support Engineer
|