Quantcast
Channel:
Viewing all articles
Browse latest Browse all 59170

Forum Post: Externs - just when I thought I had it

$
0
0
Using HEW4 with my new e8a emulator on a M30260F8A board of my design.  I need to use a few globgloble variables that will be modified by a timer ISR.  I realize that FrankL and Clavin Grier and I had a conversation about this in October 2009, but I am back again. I set up an "include.h" file that has the following statements: #ifdef VARIABLE_DEFINITION #define EXTERN #else #define EXTERN extern #endif #ifndef _include_h #define _include_h #include "sfr26a.h" #include "rearlite_bsp.h" #endif At the beginning of all my c files I have the statement #include "include.h" and in only the main.c file I have #define VARIABLE_DEFINITION #include "include.h" in the rearlite_bsp.h file are a bunch of #defines and several EXTERN statements ie. EXTERN unsigned char JTF; EXTERN unsigned char Left_Turn_Flag; //0 if no turn, 1 if turn EXTERN char Right_Turn_Flag; //0 if no turn, 1 if turn EXTERN int ta1_cnt; //counter for PWM 1 in the main.c I wrote JTF = 1; but when I stop the program and look at the value of JTF, it is anything but 1. In my timer.c file is the tmrA_ISR that has the line if(JTF == 1) { do a few things } and of course since JTF is anything but the 1 I tried to set it to, then the ISR skips over the if code. The variables are not declared anywhere else . . . . .. ? So the question is, what am I doing wrong with my EXTERN variables that they don't change values when I write to them.  Thanks, David PS love the e8a - don't know why i waited so long!

Viewing all articles
Browse latest Browse all 59170

Latest Images

Trending Articles



Latest Images