OWIN pin,mode,(variable, variable...)
Pin - is a variable/constant which specifies input pin to use.
Mode is a variable/ constant which selects the mode.
Each bit of 'mode' has a separate function:
Bit 0 reset pulse sent before data Bit 1 reset pulse sent after data Bit 2 bit mode (receive 1 bit rather than 8 bits (1 byte)) Bit 3 apply strong pullup after data
For convenience these predefined constants may be used:
0 ownoreset 4 ownoreset_bit 1 owresetbefore 5 owresetbefore_bit 2 owresetafter 6 owresetafter_bit 3 owresetboth 7 owresetboth_bit
Variables(s) - receives the data.
This command is used to read data from a one-wire device.
Read data (either full byte or single bit) from one-wire device connected to an input pin, with optional reset pulses before and after the read. This command cannot be used on the following pins due to silicon restrictions:
20X2 C.6 = fixed input
Use of one-wire parts is covered in more detail in the separate 'One-Wire Tutorial' datasheet.
Read raw temperature value from DS18B20
This achieves a similar function to the readtemp12 command
- Code Example:
main: owout C.1,%1001,($CC,$44) ; send ‘reset’ then ‘skip ROM’ then ‘convert’ then apply ‘pullup’ pause 750 ; wait 750ms with strong pullup owout C.1,%0001,($CC,$BE) ; send ‘reset’ then ‘skip ROM’ then ‘read temp’ command owin C.1,%0000,(b0,b1) ; read in result sertxd (#w0,CR,LF) ; transmit value goto mainCopy Code Submit an Example
Submit Your Own Code!
You must be logged in to submit code examples. Login now.