Name:
owin
Syntax:

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.

Description:

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.

Applies To:
20X2, 28X1, 28X2, 40X1, 40X2
See Also:
Related Create:
Share:
Print:

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 main
Copy Code Submit an Example

Submit Your Own Code!

You must be logged in to submit code examples. Login now.

Comments

  • Posted by grim_reaper

    I'm about to embark on attempting to read 3 DS18B20 sensors from a single one-wire bus, starting with 1 sensor and the code example above to see if I can get it to work!

    It seems no-one on the internet has documented this exact task with a PICAXE -- has anyone actually got multi-drop working nicely??

  • Posted by westaust55

    See here:http://www.picaxeforum.co.uk/showthread.php?15306-One-Wire-Devices-Networks

  • Login to leave a comment.