Otp rom – ELAN Home Systems EM78P458 User Manual

Page 35

Advertising
background image

EM78P458/459

OTP ROM

(1) Write to the three bits (IMS2:IMS0) on the AD-CMP-CON1 register to define the characteristics

of R6: Digital I/O, analog channels, and voltage reference pin;

(2) Write to the ADCON register to configure AD module:

(a) Select A/D input channel ( ADAS2:ADAS0 );

(b) Select the proper gains by writing to the GCON register ( optional );

(c) Define A/D conversion clock rate ( CKR1:CKR0 );

(d) Set the ADPD bit to 1 to begin sampling.

(3) Put “ENI” instruction, if the interrupt function is employed.

(4) Set the ADRUN bit to 1.

(5) Wait for either the interrupt flag to be set or the ADC interrupt to occur.

(6) Read ADDATA, the conversion data register.

(7) Clear the interrupt flag bit (ADIF).

(8) For next conversion, go to Step 1 or Step 2 as required. At least 2 Tct is required before next

acquisition starts.

<Note>: To obtain an accurate value, it is necessary to avoid any data transition on I/O pins during

AD conversion.

2. The Demonstration Programs

; To define the general registers

R_0 == 0

; Indirect addressing register

PSW == 3

; Status register

PORT5 == 5

PORT6 == 6

R_F== 0XF

; Interrupt status register

; To define the control register

IOC50 == 0X5

; Control Register of Port 5

IOC60 == 0X6

; Control Register of Port 6

C_INT== 0XF

; Interrupt Control Register

This specification is subject to change without prior notice. 07.01.2003 (V1.3)

35

Advertising
This manual is related to the following products: