Forum: Mikrocontroller und Digitale Elektronik CC5X Aufruf Unterprogramm Problem


von Mino (Gast)


Lesenswert?

Hallo zusammen,

ich hätte eine Frage bezgl. des Einbindens von Unterprogrammen in das 
Hauptprogramm.

Ich habe eine C-File Hauptprogramm z.B. "haupt.c" in welchem ich am 
Anfang "#inlude <timer.c>" aufrufe. "timer.c" ist einfach eine Routine 
zum Warten. Wenn ich z.b. im Programm "spause (10);" aufrufe wartet das 
Programm 10s.

Jetzt geht es ums compailieren. Beide Programme funktionieren soweit, 
jedoch bekomme ich beim buliden von "haupt.c" die Fehlermeldung:

Assembler 'C:\Program Files\Microchip\MPASM Suite\mpasmwin.exe' not 
found.

Im selben Projekt lässt sich die Datei "timer.c" aber ohne Fehler 
compailieren, also ist der Pfad bekannt.....

Im Projekt selbst ist alles eingebunden:
haupt.c
timer.c
16F627.lrk
16F627.h
RELOC.INC (wurde vom Compiler verlangt, weiß aber nicht warum....)

Beim direkten wandeln mit MPASMWIN.exe kommt ein Fehler und im LOG-File 
steht: "Directive only allowed when generating an object file"
Kann damit aber nichts anfangen, da ich nicht weiß was object-files sind 
:-(

Wo liegt das Problem ???

Mino

//________________________Programm "haupt.c"
#pragma chip PIC16F627
#pragma config = bin(11.1111.0111.0001)
#include <timer.c>

void main()
{
while (1)
  {
  PORTB.0 =1;
  spause (1);
  PORTB.0 =0;
  spause (1);
  }
}

//______________________Programm "timer.c"

#pragma chip PIC16F627
#pragma config = bin(11.1111.0111.0001)

char a,b,v,w,x,y,z;

//---------------------------------------------------------------------- 
---------

void pause(void)      // Unterprogramm zum Abwarten 1 ms
{
OPTION = 0b00000111;    // Vorteiler auf 256 einstellen, Vorteiler EIN
TMR0 = 214;          // 40 * 250us = 10ms
while (TMR0);        // Schleife, bis TMR0=0 wird
}          // Ende des Unterprogramms

//---------------------------------------------------------------------- 
----------

void mpause(int a)
{
  for (b=0;b<a;b++)
  {
  pause ();
  }
}
//---------------------------------------------------------------------- 
----------

void spause(int w)
{
  for (v=0;v<w;v++)
  {
    for (y=1;y<10;y++)
    {
      for (x=1;x<100;x++)
      {
      pause ();
  }    }
  }
}
//---------------------------------------------------------------------- 
-----------


PS: Ich weiß, ist nicht schön programmiert, aber zweckmäßig :-)

von Gerssi (Gast)


Lesenswert?

Hallo
Die Datei RELOC.INC editieren und den Eintrag
-x"C:\Program Files\Microchip\MPASM Suite\mpasmwin.exe"
ändern in
-x"C:\Programme\Microchip\MPASM Suite\mpasmwin.exe"

dann sollte alles funktionieren.

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.