AN114 Xicor, AN114 Datasheet
![no-image](/images/manufacturer_photos/0/7/721/xicor_sml.jpg)
AN114
Available stocks
Related parts for AN114
AN114 Summary of contents
Page 1
... P1 P1.1 3 P1.2 4 P1.3 5 P1.4 6 P1.5 7 P1.6 8 P1.7 21 P2.0 22 P2 P2 ALE/P 29 PSEN www.xicor.com U2 3 SCL VH0 4 SDA VW0 2 VL0 10 VH1 11 VW1 9 VL1 15 VH2 14 VW2 16 VL2 22 A3 VH3 21 A2 VW3 23 A1 VL3 A0 1 VCC VSS V- X940 8 -5V AN 114 ...
Page 2
... These can be modified for different device addresses, different registers and different DCPs within the device. 80C51 MICROCONTROLLER ROUTINES FOR MANIPULATING AN X9408 ;----------------------------------------------------------------------------- ; ; 80C51 MICROCONTROLLER ROUTINES FOR MANIPULATING AN X9408 ; QUAD EEPOT ; ; (C) XICOR INC. 2002 ; ; ; FILE NAME : X9408_8051.TXT ; TARGET MCU: Cygnal C8051F000 ; DESCRIPTION: ...
Page 3
... Bits -> DATA_BYTE equ r7 ; Bits -> ;----------------------------------------------------------------------------- ; Constant Definition ;----------------------------------------------------------------------------- SLAVE_ADR0 equ 050h SLAVE_ADR1 equ 051h SLAVE_ADR2 equ 052h SLAVE_ADR3 equ 053h SLAVE_ADR4 equ 054h SLAVE_ADR5 equ 055h SLAVE_ADR6 equ 056h REV 1.1 11/12/02 Application Note www.xicor.com AN 114 ...
Page 4
... READDR equ 8 WRITEDR equ 12 XFRDR equ 16 XFRWCR equ 20 GXFRDR equ 24 GXFRWCR equ 28 INCDECWIPER equ 32 ;----------------------------------------------------------------------------- ; INTERNAL RAM ;----------------------------------------------------------------------------- STACK_TOP equ 060H ; Stack top ;----------------------------------------------------------------------------- ; RESET and INTERRUPT VECTORS ;----------------------------------------------------------------------------- cseg AT 0 ljmp main REV 1.1 11/12/02 Application Note ; Locate a jump to the start of code at www.xicor.com AN 114 ...
Page 5
... WCR to one of its data registers ; gxfr_drGlobal transfer of data registers to WCRs ; gxfr_wcrGlobal transfer of WCRs to Data Registers ; inc_wiperSingle Step Increment/Decrement of wiper position for WCR ; REV 1.1 11/12/02 Application Note Switch to this code segment. Specify register bank for the following program code. www.xicor.com AN 114 ...
Page 6
... Jump to the addr for this instruction call instr_gen ret gxfr_dr: mov a,ID ; Get bits orl a,#010h ; Append to the GXFR DR instruction code mov ID Save the result mov dptr,#case4 ; Jump to the addr for this instruction call instr_gen ret REV 1.1 11/12/02 Application Note www.xicor.com AN 114 ...
Page 7
... If program gets here, then it is done case2: mov a,DATA_BYTE ; Send X9408 data byte call send_byte jmp stop_gen case1: call get_byte ; Receive X9408 Data Byte jmp stop_gen case3: mov a,DATA_BYTE ; Send X9408 Data Byte call send_byte REV 1.1 11/12/02 Application Note www.xicor.com AN 114 ...
Page 8
... FUNCTION: Places a bit on SDA and initiates a clock pulse on SCL ; INPUTS OUTPUTS: NONE ; CALLS: clock ; AFFECTED: SDA ; ;----------------------------------------------------------------------------- send_bit: clr SDA ; Pull SDA Low jz sent_zero ; Should SDA really be LOW? setb SDA ; If Not, pull SDA HIGH sent_zero: call clock ; Initiate a clock pulse ret ;----------------------------------------------------------------------------- ; REV 1.1 11/12/02 Application Note www.xicor.com AN 114 ...
Page 9
... AFFECTED: SDA, SCL ; ;----------------------------------------------------------------------------- start_cond: setb SDA ; Pull SDA HIGH and allow set-up setb SCL ; Pull SCL HIGH and hold nop nop nop nop clr SDA ;Pull SDA LOW (SCL=HIGH) and hold nop nop nop nop REV 1.1 11/12/02 Application Note www.xicor.com AN 114 ...
Page 10
... INPUTS: ADDR_BYTE ; OUTPUTS: NONE ; CALLS: start_cond, send_byte ; AFFECTED ;----------------------------------------------------------------------------- polling: call START_COND ; Re-establish I2C protocol mov a,ADDR_BYTE ; Attempt to send a dummy command again: call SEND_BYTE jc POLLING ; If C=1, then there was no ACK ret REV 1.1 11/12/02 Application Note www.xicor.com AN 114 ...
Page 11
... COMMAND, #READWCR; Read WCR call execute ; WCR value is in DATA_BYTE write_2_dr: mov ADDR_BYTE, #SLAVE_ADR12; Load Slave address byte mov ID, #DCP2_R1; Specify DR#1 for DCP#2 mov COMMAND, #WRITEDR; Write to DR mov DATA_BYTE, #21; Set data value to 21 call execute REV 1.1 11/12/02 Application Note www.xicor.com AN 114 ...
Page 12
... PULSES, #0Fh; Decrement DCP#2 for 16 pulses mov COMMAND, #INCDECWIPER; INC wiper call execute incr_wiper: mov ADDR_BYTE, #SLAVE_ADR12; Load Slave address byte mov ID, #WCR_2 ; Select DCP#2 mov PULSES, #8Fh; Increment DCP#2 for 16 pulses mov COMMAND, #INCDECWIPER; DEC wiper call execute END REV 1.1 11/12/02 Application Note www.xicor.com AN 114 ...