scripting problrem ?

Discussion topics related to the 32-bit version of MPLAB IDE version 6.xx and later.

scripting problrem ?

Postby alcofribas » Tue Jan 10, 2023 4:45 pm

Hi all
I'm using16F18855 because it has ADC and Timers...
My application :
Timer0 generates an IT every 100ms...
The ISR reads a potentiometer and stores the 10 bits value in a variable called A...( module Adcc.c)
So A is declared locally inside the ISR
in my main.c i declared A as extern to extend A's visibility...but, and that is my problem A is always zero, just as if A from the ISR is not A in main.c

Could someone point me to the right way to write such a small routine
thks in advance
A
alcofribas
 
Posts: 3
Joined: Sat Jan 07, 2023 3:58 pm

Re: scripting problrem ?

Postby alcofribas » Tue Jan 10, 2023 6:24 pm

Found my bug...
Wrong place for global var...
alcofribas
 
Posts: 3
Joined: Sat Jan 07, 2023 3:58 pm

Re: scripting problrem ?

Postby ric » Fri Jan 13, 2023 1:09 am

Indeed. The "declaration"(i.e. the line that ocntains the "extern" qualifier) belongs in a header file visible to both C files.
It must be a global variable (declared outside any function), not a local one.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products


Return to MPLAB 8 IDE

Who is online

Users browsing this forum: No registered users and 5 guests

cron