Vishesh Varma
Vishesh Varma

Reputation: 38

How do I access data variables between autogenerated Interrupts.c file?

I have recently started working with Simplicity Studio to develop a program for a 8051 based development board. Via the configurator, I enabled Interrupts, which creates a Interrupts.c file. This file isn't being explicitly included in the main file, yet the interrupts defined there work as they should. Now, my concern is that I want to toggle a few flag variables from the interrupts, and use them in the main file. And since it is not explicitly included, the linker does not find the global variables of Interrupts.c and throws an error.

  1. I tried including the file explicitly, but I get the error L104: Multiple Function Definitions for all ISR functions as well as global variables.
  2. Tried making a function in the Interrupt file that only returns the global variables. That worked, but I cannot do that for every single variable, plus I won't be able to make changes in the main file and see it reflected in the Interrupts file.
  3. Tried using extern and defining in the main file, and I'm greeted with L127: Unresolved External Symbol as well as L128: Reference made to Unresolved External

Upvotes: 0

Views: 110

Answers (2)

essassi
essassi

Reputation: 1

in the main file:

volatile uint87_t your_var=123;

in Interrupts.c:

extern volatile uint87_t your_var;

Upvotes: 0

Jens
Jens

Reputation: 6329

In the Peripherals tab look for interrrupts. There usually is a setting "Generate Interrupt Functions". Disable this and include your own IRQ module to the sources.

Upvotes: 0

Related Questions