Gast
#39655
Hallo zusammen, ich beschätige mich seit einigen Tagen mit der ATMEL 90er Serie. Als Enwicklungstools habe ich mir WINAVR und das ATMEL AVR-Studio 3... und 4.. vom Internet geladen und installiert. Ausserdem habe ich mir ein Demoprogramm heruntergeladen. Das Programm bsteht aus einem c-File (Main), einem c-File mit 2 Unterprogrammen, einem .h-File und dem Makefile. Das Demo kann ich ohne Probleme mit WINAVR übersetzen. Nach dem Listing zu urteilen ist der Code auch in Ordnung. Es wird auch eine entprechende .cof - File erzeugt. Bei der Simulation auf dem AVR-Studio 3 oder 4 geschieht folgendenes: Aus dem Hauptprogramm "main" wird das 1. externe Unterprogramm aufgerufen. Dieses Unterprogramm kehrt jedoch nicht an die Stelle im Hauptprogramm zurück, sondern auf der der Adresse 0 und startet somit das Hauptprogramm erneut. Mache ich da was falsch??? Nachfolgend die Files: ####### testit.c ################ /*********************************************************************** ** ************************************************************************ * Title : Small sample project for WinAvr 3.3 Author : Kai Klenovsek <firepower@firemail.de> Known as "BAB" Company : Date : Last Change : Compiler : WINAVR 3.3 Target : any AVR device // Makefile is written for AT90S8515 Hardware : Tested on STK300 and AVR-Studio 3.5 ------------------------------------------------------------------------ - DESCRIPTION: USAGE: for more information take a look to the header file (projectx.h) CONNECTION: for more information take a look to the header file (projectx.h) CHANGE HISTORY: for more information take a look to the header file (projectx.h) ************************************************************************ *** ************************************************************************ ***/ // *************************************** // ************ Include Files ************ // *************************************** #include <avr/io.h> #include "projectx.h" // For testing sample project int main(void) { setportb_output(); writevalue_portb(5); return (0); } ######## projectx.c ############ /*********************************************************************** ** ************************************************************************ * Title : Small sample project for WinAvr 3.3 Author : Kai Klenovsek <firepower@firemail.de> Known as "BAB" http://www.elektronik-4u.de Company : Date : Last Change : Compiler : WINAVR 3.3 Target : any AVR device // Makefile is written for AT90S8515 Hardware : Tested on STK300 and AVR-Studio 3.5 ------------------------------------------------------------------------ - DESCRIPTION: USAGE: for more information take a look to the header file (projectx.h) CONNECTION: for more information take a look to the header file (projectx.h) CHANGE HISTORY: for more information take a look to the header file (projectx.h) ************************************************************************ *** ************************************************************************ ***/ // *************************************** // ************ Include Files ************ // *************************************** #include <avr/io.h> #include "projectx.h" extern void setportb_output(void) { // OUTPUT is defined in the headerfile as 0xFF ! DDRB = OUTPUT; } extern void writevalue_portb(unsigned char value) { // Write value to PORTB PORTB = value; } /*********************************************************************** ** ************************************************************************ * Title : Small sample project for WinAvr 3.3 (projectx.c) Author : Kai Klenovsek <firepower@firemail.de> Known as "BAB" http://www.elektronik-4u.de Company : Date : 23.12.03 Last Change : 23.12.03 Compiler : WINAVR 3.3 Target : any AVR device // Makefile is written for AT90S8515 Hardware : Tested on STK300 and AVR-Studio 3.5 ------------------------------------------------------------------------ - DESCRIPTION: USAGE: TO DO: CHANGE HISTORY: ************************************************************************ *** ************************************************************************ ***/ // ************************************************ // ************ Header file definition ************ // ************************************************ #ifndef PROJECTX_H #define PROJECTX_H // ******************************************* // ************ Diverse constants ************ // ******************************************* #define OUTPUT 0xFF // ************************************** // ************ Functiontyps ************ // ************************************** extern void setportb_output(void); extern void writevalue_portb(unsigned char value); ############# Headerfile Projectx.h ############ #endif //PROJECTX_H Besten Dank und schöne Osterfeiertage an Euch alle