Forum: Mikrocontroller und Digitale Elektronik outp, sbi, cbi undeclared


von Al3ko -. (al3ko)


Lesenswert?

Hi Leute,

ich versuche gerade das LCD zum Laufen zu bringen. Dabei verwende ich 
den Code von dieser Seite:
http://www.jennaron.com.au/avr/lcd.html

Hier der Code im Main:
1
/******************************************************************************
2
3
    Test program for the lcd16.c module. Displays a floating point number
4
    on line one along with a fixed string. Displays a long integer (32-bits)
5
    and an integer (16-bits) on the second line. Increments the numbers by one
6
    forever.
7
  
8
  Ron Kreymborg
9
  
10
******************************************************************************/
11
12
#include <avr/io.h>
13
#include <stdlib.h>
14
#include <interrupt.h>
15
#include <string.h>
16
#include <math.h>
17
#include "lcd.h"
18
19
20
#define BYTE            unsigned char
21
#define WORD            unsigned int
22
23
int main(void);
24
25
int main(void)
26
{    
27
    float fnum;
28
    long lnum;
29
    int inum;
30
    
31
   // PORTB
32
    outp(0xff, PORTB);              // all high
33
    outp(0xff, DDRB);               // all output
34
    // PORTA
35
    outp(0x00, PORTA);              // all low
36
    outp(0xff, DDRA);               // all output
37
38
    InitLCD();
39
    fnum = 0.0;
40
    lnum = 0L;
41
    inum = 0;
42
    
43
    while (1)
44
    {
45
        SendFloat(fnum, 1, 0);          // floating point number
46
        fnum = fnum + 1.0;
47
48
        SendString("value", 1, 11);     // plain string
49
        
50
        SendLong(lnum, 2, 0);           // long
51
        lnum++;
52
        
53
        SendString("      ", 2, 10);    // ensure background cleared
54
        SendInt(inum, 2, 10);           // int
55
        inum++;
56
    }    
57
    
58
    return 0;
59
}

Ich verwende AVRStudio4 und WinAVR und erhalte die Fehlermeldung, dass 
interrupt.h nicht gefunden werden kann. Okay, dachte ich mir, kommt ein 
avr/ davor, weil diese Datei im selben Ordner wie die io.h ist, also:
1
#include <avr/interrupt.h>

Jetzt erhalte ich ziemlich viele Fehlermeldungen:
1
Build started 14.4.2012 at 22:26:22
2
avr-gcc  -mmcu=atmega128 -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT main.o -MF dep/main.o.d  -c  ../main.c
3
../main.c: In function 'main':
4
../main.c:32: warning: implicit declaration of function 'outp'
5
avr-gcc -mmcu=atmega128 -Wl,-Map=LCD1.map main.o lcd16.o     -o LCD1.elf
6
main.o: In function `main':
7
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../main.c:32: undefined reference to `outp'
8
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../main.c:33: undefined reference to `outp'
9
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../main.c:35: undefined reference to `outp'
10
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../main.c:36: undefined reference to `outp'
11
lcd16.o: In function `SendByte':
12
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:190: undefined reference to `outp'
13
lcd16.o: In function `Clock':
14
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:199: undefined reference to `sbi'
15
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:201: undefined reference to `cbi'
16
lcd16.o: In function `Send':
17
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:154: undefined reference to `outp'
18
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:155: undefined reference to `outp'
19
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:159: undefined reference to `sbi'
20
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:160: undefined reference to `sbi'
21
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:162: undefined reference to `inp'
22
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:163: undefined reference to `cbi'
23
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:164: undefined reference to `cbi'
24
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:166: undefined reference to `sbi'
25
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:167: undefined reference to `sbi'
26
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:169: undefined reference to `cbi'
27
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:170: undefined reference to `cbi'
28
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:174: undefined reference to `outp'
29
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:175: undefined reference to `outp'
30
lcd16.o: In function `InitLCD':
31
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:110: undefined reference to `outp'
32
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:111: undefined reference to `outp'
33
D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:113: undefined reference to `outp'
34
lcd16.o:D:\Libraries\Documents\Workspace\MCU\AVR\LCD1\default/../lcd16.c:115: more undefined references to `outp' follow
35
make: *** [LCD1.elf] Error 1
36
Build failed with 24 errors and 1 warnings...

Ich gebe zu, dass ich sowohl in C als auch in uC neu bin. Aber cbi, sbi 
und outp sind doch Standardfunktionen, jedenfalls meine ich es so im 
Internet gelesen zu haben.

Danke und Gruß

von Oliver J. (skriptkiddy)


Lesenswert?

Versuchs mal damit:
1
#include <compat/deprecated.h>

Gruß Oliver

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.