REKLAMA

lcd.zip

Jak zmienić podłączenie LCD w Codevisionavr bez przelutowywania?

Tu masz przykładowe biblioteki z takimi zmianami: Lcd_4b gdzie linie sterujące są na innym porcie niż linie DATA, Lcd_8b gdzie wyświetlcz jest sterowany w trybie 8 bitów i Lcd_m gdzie są pozamieniane bity.


Pobierz plik - link do postu
  • lcd.zip
    • Lcd_4b.h
    • lcd_m.lib
    • LCD_8B.H
    • LCD_8B.LIB
    • Lcd_4b.lib
    • Lcd_m.h


lcd.zip > Lcd_4b.h

/* LCD driver routines

CodeVisionAVR C Compiler
(C) 1998-2003 Pavel Haiduc, HP InfoTech S.R.L.
2005 Zbigniew Korpak - dodane sterowanie na osobnym porcie niz data

BEFORE #include -ING THIS FILE YOU
MUST DECLARE THE I/O ADDRESS OF THE
DATA REGISTER OF THE PORT AT WHICH
THE LCD IS CONNECTED!

EXAMPLE FOR PORTB:

#asm
.equ __lcd_rs=1
.equ __lcd_rd=2
.equ __lcd_enable=3
.equ __lcd_port=0x1B ; PORTC
.equ __lcd_ster=0x18 ; PORTD
#endasm
#include & lt; lcd_4b.h & gt;

*/

#ifndef _LCD_INCLUDED_
#define _LCD_INCLUDED_

#pragma used+

void _lcd_ready(void);
void _lcd_write_data(unsigned char data);
// write a byte to the LCD character generator or display RAM
void lcd_write_byte(unsigned char addr, unsigned char data);
// read a byte from the LCD character generator or display RAM
unsigned char lcd_read_byte(unsigned char addr);
// set the LCD display position x=0..39 y=0..3
void lcd_gotoxy(unsigned char x, unsigned char y);
// clear the LCD
void lcd_clear(void);
void lcd_putchar(char c);
// write the string str located in SRAM to the LCD
void lcd_puts(char *str);
// write the string str located in FLASH to the LCD
void lcd_putsf(char flash *str);
// initialize the LCD controller
unsigned char lcd_init(unsigned char lcd_columns);

#pragma used-
#pragma library lcd_4b.lib

#endif


lcd.zip > LCD_8B.H

/* LCD driver routines

CodeVisionAVR C Compiler
Zbigniew Korpak

BEFORE #include -ING THIS FILE YOU
MUST DECLARE THE I/O ADDRESS OF THE
DATA REGISTER OF THE PORT AT WHICH
THE LCD IS CONNECTED!

EXAMPLE FOR PORTB:

#asm
.equ __lcd_rs=0
.equ __lcd_rd=1
.equ __lcd_enable=2
.equ __lcd_port=0x1B PORTA
.equ __lcd_ster=0x18 PORTB
#endasm
#include & lt; lcd_8B.h & gt;

*/

#ifndef _LCD_8B_INCLUDED_
#define _LCD_8B_INCLUDED_

#pragma used+

void _lcd_ready(void);
void _lcd_write_data(unsigned char data);
// write a byte to the LCD character generator or display RAM
void lcd_write_byte(unsigned char addr, unsigned char data);
// read a byte from the LCD character generator or display RAM
unsigned char lcd_read_byte(unsigned char addr);
// set the LCD display position x=0..39 y=0..3
void lcd_gotoxy(unsigned char x, unsigned char y);
// clear the LCD
void lcd_clear(void);
void lcd_putchar(char c);
// write the string str located in SRAM to the LCD
void lcd_puts(char *str);
// write the string str located in FLASH to the LCD
void lcd_putsf(char flash *str);
// initialize the LCD controller
void lcd_init(unsigned char lcd_columns);

#pragma used-
#pragma library lcd_8b.lib

#endif


lcd.zip > Lcd_m.h

/* LCD driver routines

CodeVisionAVR C Compiler
(C) 1998-2003 Pavel Haiduc, HP InfoTech S.R.L.

BEFORE #include -ING THIS FILE YOU
MUST DECLARE THE I/O ADDRESS OF THE
DATA REGISTER OF THE PORT AT WHICH
THE LCD IS CONNECTED!

EXAMPLE FOR PORTB:

#asm
.equ __lcd_port=0x18
#endasm
#include & lt; lcd.h & gt;

*/

#ifndef _LCD_M_INCLUDED_
#define _LCD_M_INCLUDED_

#pragma used+

void _lcd_ready(void);
void _lcd_write_data(unsigned char data);
// write a byte to the LCD character generator or display RAM
void lcd_write_byte(unsigned char addr, unsigned char data);
// read a byte from the LCD character generator or display RAM
unsigned char lcd_read_byte(unsigned char addr);
// set the LCD display position x=0..39 y=0..3
void lcd_gotoxy(unsigned char x, unsigned char y);
// clear the LCD
void lcd_clear(void);
void lcd_putchar(char c);
// write the string str located in SRAM to the LCD
void lcd_puts(char *str);
// write the string str located in FLASH to the LCD
void lcd_putsf(char flash *str);
// initialize the LCD controller
void lcd_init(unsigned char lcd_columns);

#pragma used-
#pragma library lcd_m.lib

#endif