Potreba> kodo za vmesnik z lcd Hitachi

V

vinodjprakash

Guest
živjoDodano po 1 minutah:rabim izvorno kodo vmesnik 8515 ATMEL z lcd Hitachi

 
lahko preverite to stran!

http://www4.tpg.com.au/users/talking/5x7% 20Display% 20Index.html

http://www.geocities.com/dinceraydin/lcd/gfxhowto.htm

 
Da človek Klug rabim tako montažo in c
mail mi vinodjprakash (at) yahoo.co.inDodano po 24 minutah:hello, naredite nekaj od logike vem upravljavcu štiri žice Stepper motor

 
Živjo,

Za 4 bit LCD vmesnik s AVRGCC prosim, poglej na moji spletni strani.

http://dlmkerode.tripod.com

 
Živjo,
po mojem mnenju, je treba napisati u yoursefl v C, uporaba CodevisionAVR prevajalnik (compiler alots pomoč u).je lažje in u lahko dobite veliko experiencies.če u dont želiš, da naslednjič, ko bom post LCD izvorno kodo.
In če u ni imel prevajalnik, zato je tu
http://www.edaboard.com/viewtopic.php?p=620100 # 620100Dodano po 17 minutah:Tukaj je koda za textLCD,
//**************************************
/ / LCD funkcije
/ / Version 1.0 september 2000
/ / Sylvain Bissonnette
/ /
//**************************************

//**************************************
/ / INCLUDE
//**************************************
# include <io2313.h>

//**************************************
/ / Define
//**************************************
/ / User odvisne BEGIN
# define D7 0x01
# define D6 0x02
# define D5 0x04
# define D4 0x08
# define E 0x10
# define RW 0x20
# define RS 0x40

# define LCDPIN (* (hlapljive unsigned char *) 0x36) / / PIN register
# define LCDDDR (* (hlapljive unsigned char *) 0x37) / / Data Direction Register
# define LCDPORT (* (hlapljive unsigned char *) 0x38) / / PORT
/ / User odvisne END

//**************************************
/ / PROTOTYPE
//**************************************
void InitLCD (void);
void ClrLCD ();
void GotoXY (unsigned char, unsigned char);
WriteStrLCD void (char *);
void WriteStrLCDConst (const char *);
WriteByteLCD void (char);
void WriteLCD (unsigned char, unsigned char);
void Delay_50us (int Delay);

//**************************************
/ / MAIN
//**************************************
void main (void)
(
InitLCD ();
ClrLCD ();
GotoXY (5,1);
WriteStrLCD ( "Test \ 0");
while (1);
)

//************************************************ *********
/ / LCD Code
//************************************************ *********
/************************************************* *********

Ime: void ClrLCD (void)

Opis: Clear LCD

Input: none

Output: none

Razno:

************************************************** ********/
void ClrLCD ()
(
WriteLCD (0,0 x01); / / Clear prikaz
Delay_50us (50);
)

/************************************************* *********

Ime: GotoXY (unsigned char x, unsigned char y)

Opis: Položaj kurzorja na LCD na lokaciji X & Y

Input: X -> X položaj na LCD
Y -> Y položaj na LCD

Output: none

Razno:

************************************************** ********/
void GotoXY (unsigned char x, unsigned char y)
(
unsigned char naslov;

x -;
if (y> 1) naslov = 64 x;
else x = naslov;
WriteLCD (0, naslov | 0x80);
)

/************************************************* *********

Ime: WtireByteLCD (char byte)

Opis: Pisanje bajt na LCD na položaj kurzorja

Input: byte

Output: none

Razno:

************************************************** ********/
WriteByteLCD void (char byte)
(
char tmp;

tmp = byte & 0xf0;
tmp = tmp>> 4;
tmp = 0x30;
if (tmp> 0x39) tmp = 0x07;
WriteLCD (1, tmp);

tmp = byte & 0x0f;
tmp = 0x30;
if (tmp> 0x39) tmp = 0x07;
WriteLCD (1, tmp);
)

/************************************************* *********

Ime: WriteStrLCD void (char * ptr)

Opis: Pisanje string od RAM-a na LCD

Input: string pointer

Output: none

Razno:

************************************************** ********/
WriteStrLCD void (char * ptr)
(
unsigned char i;

for (i = 1, i <41; i )
(
if (* ptr == 0x00) break;
WriteLCD (1, * ptr);
* ptr = 0x00;
)
)

/************************************************* *********

Ime: void WriteStrLCDConst (const char * ptr)

Opis: Pisanje konstanta niz na LCD

Input: string pointer

Output: none

Razno:

************************************************** ********/
void WriteStrLCDConst (const char * ptr)
(
unsigned char i;

for (i = 1, i <41; i )
(
if (* ptr == 0x00) break;
WriteLCD (1, * ptr );
)
)

/************************************************* *********

Ime: void WriteLCD (unsigned char RS, unsigned char ch)

Opis: Pisanje bajt v RS za LCD

Input: rs -> Register izberite
ch -> byte pisati

Output: none

Razno:

************************************************** ********/
void WriteLCD (unsigned char RS, unsigned char ch)
(
unsigned char Stat;

Stat = LCDPIN & 0x01;

PORTB = Stat;
if ((ch & 0x80) == 0x80) PORTB | = D7;
if ((ch & 0x40) == 0x40) PORTB | = D6;
if ((ch & 0x20) == 0x20) PORTB | = D5;
if ((ch & 0x10) == 0x10) PORTB | = D4;
if (rs == 1) PORTB | = RS;

PORTB | = E;
PORTB & = ~ E;

PORTB = Stat;
if ((ch & 0x08) == 0x08) PORTB | = D7;
if ((ch & 0x04) == 0x04) PORTB | = D6;
if ((ch & 0x02) == 0x02) PORTB | = D5;
if ((ch & 0x01) == 0x01) PORTB | = D4;
if (rs == 1) PORTB | = RS;

PORTB | = E;
PORTB & = ~ E;

Delay_50us (1);
)

/************************************************* *********

Ime: void Delay_50us (int Delay)

Opis: Zamuda pri nas za 50 4MHz resonator

Input: Zamuda X x 50us

Output: none

Razno:

************************************************** ********/
void Delay_50us (int Delay)
(
int i, j;

for (i = 0; i <Delay; i )
(
for (j = 1; j <20; j );
asm ( "WDR");
)
)

/************************************************* *********

Ime: void InitLCD (void)

Opis: Initialize LCD v načinu 4bit

Input: none

Output: none

Razno:

************************************************** ********/
void InitLCD (void)
(
LCDDDR = D7 D5 D6 D4 E RS RW;
LCDPORT =! (D7 D5 D6 D4 E RS RW);
Delay_50us (340);

LCDPORT = (D5 D4) / / Funkcija Set 8 bit 3 časLCDPORT |= E; LCDPORT & = ~ E;
Delay_50us (100);
LCDPORT | = E;
LCDPORT & = ~ E;
Delay_50us (100);
LCDPORT | = E;
LCDPORT & = ~ E;
Delay_50us (100);

LCDPORT = D5; / / Funkcija Set 4 bit
LCDPORT | = E;
LCDPORT & = ~ E;
Delay_50us (100);

WriteLCD (0,0 x28) / / 2 line
WriteLCD (0,0 x0c); / / Display O Cursor Blink OFF OFF
WriteLCD (0,0 x01); / / Clear prikaz
Delay_50us (50);
WriteLCD (0,0 x06), / / Cursor INC Shift OFF
)
Oprostite, toda morate prijavo na ogled te priloge

 

Welcome to EDABoard.com

Sponsor

Back
Top