AN114 Xicor, AN114 Datasheet - Page 11

no-image

AN114

Manufacturer Part Number
AN114
Description
Interfacing the X9408/X9418 XDCP to 8051 Microcontrollers
Manufacturer
Xicor
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
AN1149FHKEBV
Manufacturer:
PANASONIC/松下
Quantity:
20 000
;-----------------------------------------------------------------------------
;
; PUT MAIN PROGRAM HERE...
;
; Below are sample main programs calling the various command routines
;
;-----------------------------------------------------------------------------
main:
;----------------------------------------------------------------------------
;
; The following section is required for the Cygnal processor. This could
; change for different versions of the 80C51.
;
; Disable the WDT. (IRQs not enabled at this point.)
; If interrupts were enabled, they would need to be explicitly disabled
; so that the 2nd move to WDTCN occurs no more than four clock
; cycles after the first move to WDTCN.
; Enable the Port I/O Crossbar
;-----------------------------------------------------------------------------
;
; The following are sample code segments for use in the main program...
; The potentiometer was A0-A3 pins were set to address 0Ch.
;
;-----------------------------------------------------------------------------
write_2_wcr:
read_from_wcr:
write_2_dr:
REV 1.1 11/12/02
mov
clr
mov
mov
mov
mov
mov
mov
mov
mov
call
mov
mov
mov
call
mov
mov
mov
mov
call
SP, #STACK_TOP; Initialize stack pointer
EA
WDTCN, #0DEh; Cygnal processor specific
WDTCN, #0ADh; Cygnal processor specific
XBR2, #40h
PRT1CF, #00h ; Cygnal processor specific
ADDR_BYTE, #SLAVE_ADR12; Load Slave address byte
ID, #WCR_2
COMMAND, #WRITEWCR; Write to WCR
DATA_BYTE, #43; Set wiper position to tap 43
execute
ADDR_BYTE, #SLAVE_ADR12; Load Slave address byte
ID, #WCR_2
COMMAND, #READWCR; Read WCR
execute
ADDR_BYTE, #SLAVE_ADR12; Load Slave address byte
ID, #DCP2_R1; Specify DR#1 for DCP#2
COMMAND, #WRITEDR; Write to DR
DATA_BYTE, #21; Set data value to 21
execute
; Disable interupts
; Cygnal processor specific (enable weak pull ups)
; Set no ports as push-pull (this processor
; operates from 3.3V, but the X9408 operates from
; 5V, so the 8051 outputs must be pulled up to 5V
; with external resistors.)
; Specify WCR for DCP#2
; Specify WCR for DCP#2
; WCR value is in DATA_BYTE
Application Note
www.xicor.com
AN 114
11 of 12

Related parts for AN114