Подскажите начинаюшему по компиляции кода для dv40200 под stk200
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено транзистор 05 декабря 2004 г. 12:57

Пытаюсь разобраться в написании программ для AVR установил winavrgcc3.3.1 и оболочку vmlab при компилиции возникает ошибка
* C:\avr/main.c, line 47: undefined reference to `lcd_init'
main.o(.text+0xd4):C:\avr/main.c:51: undefined reference to `lcd_home'
main.o(.text+0xda):C:\avr/main.c:52: undefined reference to `lcd_puts'
main.o(.text+0xe0):C:\avr/main.c:53: undefined reference to `lcd_puts'
main.o(.text+0xf0):C:\avr/main.c:54: undefined reference to `lcd_puts'

использую след. исходник :

/*
Title: AVR-GCC test program for the STK200 eva board
Author: Volker Oth
Date: 5/1999
Purpose: Printing text on a text lcd display.
needed
Software: AVR-GCC to compile, AVA to assemble and link
needed
Hardware: ATS90S8515/4414/Mega on STK200/STK300 board
LCD text display with 8bit microcontroller connection.
Note: To contact me, mail to
volkeroth@gmx.de
You might find more AVR related stuff at my homepage:
http://members.xoom.com/volkeroth
*/

#include
#include "global.h"
#include "timer.h"
#include "lcd.h"


char* int2str(u16 i, char *s)
/* connverts 16 bit unsigned integer to string */
{
register u16 divisor = 10000;
register u16 n=0;
register char c;

do {
c = (char)(i/divisor);
s[n++] = c + '0';
i -= c*divisor;
divisor /= 10;
} while (divisor);
s[n] = 0;

return s;
}


int main(void)
{
register u16 i;
char num_str[6];

lcd_init((1< for (;;) /* loop forever */
for (i=0; i lcd_home();
lcd_puts("AVR-GCC LCD demo\n");
lcd_puts("loop: ");
lcd_puts(int2str(i, num_str));
}
}

библиотека /*

*********************************************************************
Title: LCD library
Author: Volker Oth
Date: 5/1999
Purpose: print text on an lcd text display
needed
Software: AVR-GCC to compile, AVA to assemble and link
needed
Hardware: ATS90S8515/4414/Mega on STK200/STK300 board
LCD text display with 8bit microcontroller connection.
Note: To contact me, mail to
volkeroth@gmx.de
You might find more AVR related stuff at my homepage:
http://members.xoom.com/volkeroth

When using the io mode, you can't use the LCD-connection on
STK200/300 board because the "Enable" pin is not directly connected.
On the other hand, you can't use the memory mapped mode on devices
which don't have support for external SRAM. AFAIK only the 4414, 8515
and Megas support memory mapped mode.

Memory mapped mode uses the following pins:

DATA = PORTA
R S = PORTC BIT 6
R/W = PORTD BIT 6
(E = PORTC BIT 7)

IO mode can use any pins.
4bit mode is not (yet) supported.
*/

#ifndef LCD_H
#define LCD_H


/* change these definitions to adapt setting */

#define LCD_LINES 2 /* visible lines */
#define LCD_LINE_LENGTH 0x40 /* internal line length */

#define LCD_8BIT_MODE 1 /* 0: 4bit, 1: 8bit */
#define LCD_IO_MODE 0 /* 0: memory mapped mode, 1: IO port mode */
#define LCD_HW_ENABLE 0 /* 0: normal IO, 1: IO mode on STK200/300 */

#if LCD_IO_MODE /* only necessary in IO mode */
#define LCD_DATA_PORT PORTA /* port for lines D0-7 (8bit), D4-7 (4bit) */
#define LCD_E_PORT PORTC /* port for Enable line */
#define LCD_E_PIN 7
#define LCD_RS_PORT PORTC /* port for RS line */
#define LCD_RS_PIN 6
#define LCD_RW_PORT PORTD /* port for RW line */
#define LCD_RW_PIN 6
#endif


/* you shouldn't need to change anything below this line */

#define LCD_CLR 0 /* DB0: clear display */
#define LCD_HOME 1 /* DB1: return to home position */
#define LCD_ENTRY_MODE 2 /* DB2: set entry mode */
#define LCD_ENTRY_INC 1 /* DB1: increment ? */
#define LCD_ENTRY_SHIFT 0 /* DB2: shift ? */
#define LCD_ON 3 /* DB3: turn lcd/cursor on */
#define LCD_ON_DISPLAY 2 /* DB2: turn display on */
#define LCD_ON_CURSOR 1 /* DB1: turn cursor on */
#define LCD_ON_BLINK 0 /* DB0: blinking cursor ? */
#define LCD_MOVE 4 /* DB4: move cursor/display */
#define LCD_MOVE_DISP 3 /* DB3: move display (0-> cursor) ? */
#define LCD_MOVE_RIGHT 2 /* DB2: move right (0-> left) ? */
#define LCD_FUNCTION 5 /* DB5: function set */
#define LCD_FUNCTION_8BIT 4 /* DB4: set 8BIT mode (0->4BIT mode) */
#define LCD_FUNCTION_2LINES 3 /* DB3: two lines (0->one line) */
#define LCD_FUNCTION_10DOTS 2 /* DB2: 5x10 font (0->5x7 font) */
#define LCD_CGRAM 6 /* DB6: set CG RAM address */
#define LCD_DDRAM 7 /* DB7: set DD RAM address */

#define LCD_BUSY 7 /* DB7: LCD is busy */


#if LCD_IO_MODE==0 /* only necessary in memory mapped mode */
#define LCD_IO_DATA 0xc000
#define LCD_IO_FUNCTION 0x8000
#endif


#if LCD_8BIT_MODE
#define LCD_PORT_MASK 0xff
#define LCD_FDEF_1 (1<#else
#define LCD_PORT_MASK 0xf0
#define LCD_FDEF_1 0
#endif


#if LCD_LINES==2
#define LCD_FDEF_2 (1<#else
#define LCD_FDEF_2 0
#endif


#define LCD_FUNCTION_DEFAULT ((1<#define LCD_MODE_DEFAULT ((1<#define lcd_e_high() sbi(LCD_E_PORT, LCD_E_PIN); asm volatile ("nop" ::)
#define lcd_e_low() cbi(LCD_E_PORT, LCD_E_PIN)


/* prototypes */

void lcd_command(u08 cmd);
void lcd_gotoxy(u08 x, u08 y);
void lcd_clrscr(void);
void lcd_home(void);
void lcd_putchar(u08 data);
void lcd_init(u08 cursor, u08 fnc);
void lcd_puts(char s[]);


#endif

Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru