Globals vs. Locals for ADC.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Globals vs. Locals for ADC.

1,265 Views
FWFan
Contributor III
Hi All,
 
I tried to use global (before main) to hold my ADC capture but it does not work.
But if I use local, the ADC result would be stored sucessfully.
Do you guys have any thoughts?
The reason I need to store my ADC globally is because I will need
to transfer it when I do my IIC isr.
I'm including my code for reference.
 
Thank you,
FWFan
Labels (1)
0 Kudos
2 Replies

227 Views
eckhard
Contributor V
Hello,

maybe it helps to declare your global variable as volatile


Eckhard
0 Kudos

227 Views
FWFan
Contributor III
Thank you Eckhard.
I will try that tonight.
 
FWFan
0 Kudos