Mikroelektronika MIKROE-724 データシート

ページ / 726
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
409
Ow_Read
Ow_Write
Prototype
sub function Ow_Read(dim byref port as word, dim pin as word) as byte
Description Reads one byte of data via the OneWire bus.
Parameters 
port
: OneWire bus port 
pin
: OneWire bus pin 
Returns
Data read from an external device over the OneWire bus.
Requires
Devices compliant with the Dallas OneWire protocol.
Example
‘ Read a byte from the One-Wire Bus connected to pin RF6
dim read_data as byte
...
read_data = Ow_Read(PORTF, 6)
Notes
None.
Prototype
sub procedure Ow_Write(dim byref port as word, dim pin, data_ as word)
Description Writes one byte of data via the OneWire bus.
Parameters 
port
: OneWire bus port 
pin
: OneWire bus pin 
data_
: data to be written 
Returns
Nothing.
Requires
Devices compliant with the Dallas OneWire protocol.
Example
‘ Send a byte to the One-Wire Bus connected to pin RF6
Ow_Write(PORTF, 6, 0xCC)
Notes
None.