MikroElektronika PIC Microcontrollers PIC16 Manual do Utilizador Página 113

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 172
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 112
1-wire library provides routines for communicating via 1-wire bus, for example
with DS1820 digital thermometer.
Note that oscillator frequency Fosc needs to be at least 4MHz in order to use the
routines with Dallas digital thermometers.
function ow_reset(dim byref PORT as byte, dim PIN as byte) as byte
function ow_read(dim byref PORT as byte, dim PIN as byte) as byte
procedure ow_write(dim byref PORT as byte, dim PIN, par as byte)
function ow_reset(dim byref PORT as byte, dim PIN as byte) as byte
Issues 1-wire reset signal for DS1820.
Parameters PORT and pin specify the location of DS1820; return value of the
function is 0 if DS1820 is present, and 1 if it is not present.
function ow_read(dim byref PORT as byte, dim PIN as byte) as byte
Reads one byte via 1-wire bus.
procedure ow_write(dim byref PORT as byte, dim PIN, par as byte)
Writes one byte (parameter par) via 1-wire bus.
The following code demonstrates use of 1-wire library procedures and functions.
The example reads the temperature using DS1820 connected to PORTD, pin 7. Be
sure to set the Fosc appropriately in your project.
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
108
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
1-Wire Library
Example
Routines
making it simple...
page
Vista de página 112
1 2 ... 108 109 110 111 112 113 114 115 116 117 118 ... 171 172

Comentários a estes Manuais

Sem comentários