UNIIN pin, device, command, (var, var...)

UNIIN pin, device, command, address, address, (var, var...)

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

Device - is the UNI/O type, %10100000 for EEPROM devices

Command - is the read type command, either

UNI_READ Read from specified address
UNI_CRRD Read from current address
UNI_RDSR Read status byte

Address - is the optional 2 byte address, only used by UNI_READ.

Variable - receives the data.


Read data from the UNI/O device into the PICAXE variable.

The 'uniin' command allows data to be read in from an external UNI/O part such as the 11LCxxx series EEPROM chips. UNI/O parts only require one i/o pin to connect to the PICAXE microcontroller. A 4k7 pullup resistor is not required by the UNI/O specification, but is highly recommended.

Note that when first powered up (after a power-on or brown out reset) the UNI/O device is in a special low-power standby mode. It is necessary to 'wake' the device, via a rising edge pulse (using the pulsout command), before the uniin / uniout commands will function correctly.

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

20X2 C.6 = fixed input
Applies To:
20X2, 28X2, 40X2
See Also:
Related Create:



Code Example:
reset_uni:	pulsout C.3, 1					; ESSENTIAL - enable device via a rising edge pulse

main:		inc b1
		uniout C.3, %10100000, UNI_WRSR, (0)		; clear status
		uniout C.3, %10100000, UNI_WREN			; write enable
		uniout C.3, %10100000, UNI_WRITE, 0, 1, (b1)	; write
		pause 10					; wait for write
		uniout C.3, %10100000, UNI_WRDI			; write disable
		pause 1000					; wait
		uniin C.3, %10100000, UNI_READ, 0, 1, (b2)	; read
		debug						; display
		goto main					; loop
Copy Code Submit an Example

Submit Your Own Code!

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