/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / plz find out where i have gone wrong ?

Username:     
Password:     
             

Forum

# 1   2010-02-25 12:15:23 plz find out where i have gone wrong ?

plmuthu25
New member
Registered: 2010-02-18
Posts: 7

plz find out where i have gone wrong ?

its seems interrupt is not working ... plz find ,where  i gone wrong  ...

OUTPUT : I NEED TO DISPLAY 1 , WHEN EXTERNAL INTERRUPT OCCURS ... EXTERNAL INTERRUPT IS THE JOYSTICK (UP DIRECTION)...

/************************* (C) COPYRIGHT 2007 RAISONANCE **********************
* File Name          :  Application.c
* Author             :
* Date First Issued  :
* Description        :  Circle_App CircleOS application template.
* Revision           :
*******************************************************************************/

/* Includes ------------------------------------------------------------------*/
#include "circle_api.h"




/* Private defines -----------------------------------------------------------*/

#define NEEDEDVERSION "V 1.5" // Put here the minimal CircleOS version needed by your application

/* Private variables ---------------------------------------------------------*/

/* Private functions ---------------------------------------------------------*/
enum MENU_code MsgVersion(void);
void init(void);
void change (void);
/* Public variables ----------------------------------------------------------*/

const char Application_Name[8+1] = {"My App"};  // max 8 characters for application name

/*******************************************************************************
* Function Name  : Application_Ini
* Description    : Initialization function of Circle_App. This function will
*                  be called only once by CircleOS.
* Input          : None
* Return         : MENU_CONTINUE_COMMAND
*******************************************************************************/
enum MENU_code Application_Ini ( void )
   {
   if(strcmp(UTIL_GetVersion(), NEEDEDVERSION) < 0)
      {
      return MsgVersion();
      }
     
void init(void)
{

RB0:1;
INT0:1;
GIEH:1 ;
PEIE:1;
RBIP:1;
INTEDG1:1;
}
     
      // TODO: Write your application initialization function here.

     
     
   return MENU_CONTINUE_COMMAND;
   }

/*******************************************************************************
* Function Name  : Application_Handler
* Description    : Management of the Circle_App.
*
* Input          : None
* Return         : MENU_CONTINUE
*******************************************************************************/
enum MENU_code Application_Handler ( void )
   {

   // TODO: Write your application handling here.
   //       This routine will get called repeatedly by CircleOS, until we
   //       return MENU_LEAVE

   DRAW_DisplayString(5,60,"1",17);
   
   #pragma code HIGH_INTERRUPT_VECTOR=0X8
/*void high_ISR (void)
{
goto change
}
#pragma code*/
IDLEN:1;

   return MENU_CONTINUE;   // Returning MENU_LEAVE will quit to CircleOS
   }


/*******************************************************************************
* Function Name  : MsgVersion
* Description    : Display the current CircleOS version and the version needed
*                  exit to main menu after 4 secondes
*
* Input          : None
* Return         : MENU_CONTINUE
*******************************************************************************/
enum MENU_code MsgVersion(void)
   {
   int hh,mm,ss,ss2;
   
   DRAW_DisplayString(5,60,"CircleOS",17);
   DRAW_DisplayString(80,60,UTIL_GetVersion(),3);
   DRAW_DisplayString(5,34,NEEDEDVERSION,3);
   DRAW_DisplayString(40,34," required",12);
   
   RTC_GetTime(&hh,&mm,&ss);
   ss = ss + 4;                  // 4 secondes
   ss = ss%60;
   
   do
      {
      RTC_GetTime(&hh,&mm,&ss2);
      }while (ss2 != ss);           // do while < 4 secondes
   
   return MENU_REFRESH;
   }

#pragma interrupt change
void change(void)
{
DRAW_DisplayString(5,60,"2",17);
INT0IF:0;
}

   
THANKS FOR YOUR HELP

Offline

 

# 2   2010-03-02 08:08:07 plz find out where i have gone wrong ?

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: plz find out where i have gone wrong ?

Hi,

The right way to implement interrupt with CircleOS is to use the API "UTIL_SetIrqHandler".
The function allows to implement your own interrupt handler, because interrupt vectors are relocated in RAM, by the CircleOS.
This function expects two arguments : Offs = offset of the IRQ in the vectors table (= n°IRQ x 4 bytes = 11 x 4 in your case, if SWI used) ), pHDL = pointer on your IRQ handler (high_ISR in your case).
Of course, the external interrupt shoud be previously configured and enabled.

Yves

Offline

 

Board footer