UNIOUT pin, device, command

UNIOUT pin, device, command, (data)

UNIOUT pin, device, command, address, address, (data, data...)

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 write type command, either

UNI_WREN write enable
UNI_WRDI write disable
UNI_WRSR write status
UNI_ERAL erase all
UNI_SETAL set all

Address - is the 2 byte address required by UNI_WRITE.

Data - is the information to write.


Write data to the UNI/O device.

Note that the UNI/O parts have a 16 byte page boundary. A single write cannot go over a page boundary (ie a multiple of 16). This means, for instance, you may write 10 bytes in one UNI_WRITE command from address 0 up, but not 10 bytes from address 10 upwards, as this would overlap a page boundary (byte 16).

The 'uniout' command allows data to be written to 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 technically 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.