Autor Tema: Ayuda con PIC18f452 y el compilador Hitech  (Leído 1500 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado pitorro1976

  • PIC10
  • *
  • Mensajes: 1
Ayuda con PIC18f452 y el compilador Hitech
« en: 07 de Abril de 2007, 11:27:59 »
Hola a todos

Es la primer vez que uso el foro y espero haber elegido el sitio correcto.

Estoy trabajando en un proyecto que simula un pequeño sistema operativo en tiempo real, basicamente se trate de tres task que se van intercambiando por medio de una interrupcion, estoy ahora mismo cerca pero con consigo guardar el contador del programa y cargar un nuevo valor aqui esta el codigo


//*****************************
//* Program to flash leds with interrput
//*****************************/
// include files

#include <pic18.h>
#include "delay.h"
#include "lcd.h"

// define variables

#define TASK0 0 // task0 main()
#define TASK1 1 // task1 main()
#define TASK2 2 // task2 main()
#define TASK0_COUNTER_MAX 1 //high frequency task – every 1ms
#define TASK1_COUNTER_MAX 100 //low frequency task – every 100ms
#define TASK2_COUNTER_MAX 200 //low frequency and low priority task, every 200ms
#define TRUE 1
#define FALSE 0
volatile unsigned int re_timer; //flash led operation
volatile unsigned int co_timer; //flash led operation
volatile unsigned char task0_enable=TRUE;
volatile unsigned char task1_enable=TRUE;
volatile unsigned char task2_enable=TRUE;
volatile unsigned int task0_counter;
volatile unsigned int task1_counter;
volatile unsigned int task2_counter;
volatile unsigned int i,y;
volatile unsigned char countask,count;
asm(" GLOBAL _STKPTR;");
asm(" GLOBAL _TOSL;");
asm(" GLOBAL _TOSH;");
asm(" GLOBAL _TOSU;");
//declare prototype

void dummyloop();
void printLCD();
void flashled();

//declare the function task in main
int func_task0();
int func_task1();
int func_task2();
//declare structure for task

void interrupt ISR(void)
//interrupt action in the system
{

asm(" GLOBAL _STKPTR;");
asm(" GLOBAL _TOSL;");
asm(" GLOBAL _TOSH;");
asm(" GLOBAL _TOSU;");
asm(" incf _STKPTR, f;");
asm(" movlw low f ; Load the TOS to point to task");
asm(" movwf _TOSL 2h");
asm(" movlw high 1h ");
asm(" movwf _TOSH");
asm(" movlw upper 0h");
asm(" movwf _TOSU");
asm(" retfie ");

//user isr code
if(TMR1IF)//if timer overflow flag
{

TMR1ON=0; //disv timer 1
TMR1IF=0;//clear timer overflow interrupt
TMR1H=0x00;//reload timer with number calcualted
TMR1L=0x00;//reload timer with number calcualted
TMR1ON=1;//restart timer
PEIE=1;
GIE=1;//restart interrupt
}
}

void init()
//initially the embedded system
{
//interrupt to overflow using internal clock
co_timer=0;
re_timer=0;
//set up the board
ADCON1=0x8E;
lcd_init(FOURBIT_MODE);
LATA2 = OUTPUT_DATA;
LATA3 = OUTPUT_DATA;
TRISB = 0x2F;//setting to 2F
RA2=1;//led off
RA3=1;//led off
//enable interrup
TMR1CS = 0;//increment every instruction timer
TMR1ON=1; //enable timer 1
TMR1IE=1;//enable TMR1 overflow interrupt
PEIE=1;
GIE=1;//global interrupt enable bit
IPEN=1;//low priority interruput
GIEL=1;
RBPU=0;//pull up enable
countask=0;
}



void main(void)
{

init(); // initialize periphe
}
func_task0()
{
while(1)
{
printLCD();
}
}
func_task1()
{
while(1)
{
flashled();
}
}
func_task2()
{
while(1)
{
dummyloop();
}
}

de momento solo trato de cargar el contador del programa con la direccion del task1 pero me da el siguiente error de compilacion.

Error[000] C:\Finalyearprogram\3 part_smallownRTOS\nuevo1.c 69 : syntax error
Error[000] C:\Finalyearprogram\3 part_smallownRTOS\nuevo1.c 72 : syntax error
Error[000] C:\Finalyearprogram\3 part_smallownRTOS\nuevo1.c 81 : syntax error

El problema es que esas lineas de error no tienen nada que ver, cualquier sugerencia es muy agradecida

victor


 

anything