Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

8051 Global variable doesn't work

Status
Not open for further replies.

sts_it

Newbie level 1
Joined
Oct 20, 2009
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Portugal
Activity points
1,290
Hi.

I am currently using Keil compiler with a at89S8253. I am using a co-operative scheme present in the book: Pattern For Time-Triggered Embedded Systems.
I have encountered a major problem. I have two tasks, one task executes every second and updates the LCD. The other task reads the ADC value (SPI). The call tree is:

- Dispatcher (calls task through a function pointer) -----> Task0 --> LCD routines

- Dispatcher -----> Task1 --> SPI Routine.

The SPI routine declares a global variable UINT16 ADC_VAL and writes this variable with the current adc value.
In task0 I declare the ADC_VAL as and extern. Problem is only reads the initialization value of ADC_VAL, say, if i declares UINT16 ADC_VAL=7, then it would print "7" in the LCD.

However if i print the ADC_VAL from within task1 (outside the SPI routine) it works fine.

Does anyone have a clue what's happening?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top