beautypg.com

Atmega169v/l – Rainbow Electronics Atmega169L User Manual

Page 216

background image

216

ATmega169V/L

2514A–AVR–08/02

Note:

1. The example code assumes that the part specific header file is included.

Assembly Code Example

(1)

LCD_Init:

; Use 32 kHz crystal oscillator

; 1/3 Bias and 1/3 duty, SEG21:SEG24 is used as port pins

ldi

r16, (1<

sts

LCDCRB, r16

; Using 16 as prescaler selection and 7 as LCD Clock Divide

; gives a frame rate of 49 Hz

ldi

r16, (1<

sts

LCDFRR, r16

; Set output voltage to 3.3 V

ldi

r16, (1<

sts

LCDCCR, r16

; Enable LCD, default waveform and no interrupt enabled

ldi

r16, (1<

sts

LCDCRA, r16

ret

C Code Example

(1)

Void LCD_Init(void);

{

/* Use 32 kHz crystal oscillator */

/* 1/3 Bias and 1/3 duty, SEG21:SEG24 is used as port pins */

LCDCRB = (1<

/* Using 16 as prescaler selection and 7 as LCD Clock Divide */

/* gives a frame rate of 49 Hz */

LCDFRR = (1<

/* Set output voltage to 3.3 V */

LCDCCR = (1<

/* Enable LCD, default waveform and no interrupt enabled */

LCDCRA = (1<

}