Board index » delphi » Dallas DS1820

Dallas DS1820

Hi...
Does anybody know how to program the
Dallas DS1820 thermometer?.
The code I get is all in C/C++ and all DOS.
How do I send a hex value directly to a port?(equiv. outportb)
Thanks

--
         ________
___/\/                \/\___
M. Stevens

 

Re:Dallas DS1820


"M.Stevens" <steve...@mail.pentech.ac.za> ha scritto nel messaggio
news:9hhhg1$io$1@news.adamastor.ac.za...

Quote
> Hi...
> Does anybody know how to program the
> Dallas DS1820 thermometer?.
> The code I get is all in C/C++ and all DOS.
> How do I send a hex value directly to a port?(equiv. outportb)
> Thanks

Hi , sorry I don't know the chip but to read/send byte from an I/O port :

// read byte
Function rport(const Address:word):byte;register;
asm
  xchg ax,dx
  in   al,dx
end;

// read word
Function rportw(const Address:word):word;register;
asm
   xchg ax,dx
   in   ax,dx
end;
// write byte
Procedure wport(const Address:word;const V:byte);register;
asm
   xchg ax,dx
   out  dx,al
end;
// write port
Procedure wportw(const Address:word;const V:word);register;
asm
   xchg ax,dx
   out  dx,ax
end;

There is only a problem : they don't work under NT/W2000 because the OS
doesn't allow direct I/O access in user mode (ring 3). There is a workaround
for these OS, if You need it e-mail me.

By

Davide Nardella

Other Threads