Name:
readowsn
Syntax:

READOWSN pin

Pin - is a variable/constant which specifies the input pin to use.

Description:

Read serial number from any Dallas/Maxim 1-wire device.

This command (read-one-wire-serial-number) reads the unique serial number from any Dallas 1-wire device (e.g DS18B20 digital temp sensor, DS2415 clock, or DS1990A iButton). If using an iButton device (e.g. DS1990A) this serial number is laser engraved on the casing of the iButton.

The readowsn command reads the serial number and then puts the family code in b6, the serial number in b7 to b12, and the checksum in b13 Note that you should not use variables b6 to b13 for other purposes in your program during a readowsn command.

This command cannot be used on the following pins due to silicon restrictions:

08, 08M, 08M2 3 = fixed input
14M, 14M2 C.3 = fixed input
18M2 C.4, C.5 = fixed input
20M, 20M2, 20X2 C.6 = fixed input
Applies To:
All (except 08, 18, 28, 28A)
See Also:
Related Create:
Share:
Print:

Read a serial number from a 1-wire device

This program reads the serial number of a 1-wire device when connected to input pin C.2

Code Example:
main:	let b6 = 0 ; reset family code to 0

	; loop here reading numbers until the
	; family code (b6) is no longer 0

loop1:	readowsn C.2		; read serial number on input2
	if b6 = 0 then loop1

	; Do a simple safety check here.
	; b12 serial no value will not likely be FF
	; if this value is FF, it means that the device
	; was removed before a full read was completed
	; or a short circuit occurred

	if b12 = $FF then main

	; Everything is ok so continue

	debug			; ok so display
	pause 1000		; short delay
	goto main
Copy Code Submit an Example

Submit Your Own Code!

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

Comments

  • Login to leave a comment.