News:

Let's find out together what makes a PIC Tick!

Main Menu

Variable question

Started by joesaliba, Sep 16, 2023, 11:11 AM

Previous topic - Next topic

joesaliba

PIC: - 18F14K22

Internal oscillator 16MHz

I have a project, sending telemetry to a device, which include 7 include files. Each include file represents something, i.e.: - altitude or analog readings or decoding data from an RS232.

I have a Dword in one of the include files and everything is working ok. I have an altimeter include file, and thought to move a vertical speed variable to this include file as it made code more understandable.

However, although it compiled as it should, data to this vertical speed stopped working.

I did add the Declare Auto_Variable_Bank_Cross = On perhaps things change but this part did not work.

Although I redid the Dword variable where it was before, and everything started to work again, I would like to perhaps know what is causing this issue as I am going to add something else to this code and I am afraid that something would stop working and begin barking to the wrong tree.

Variable used till now: - 264 out of 512.

What will be a pin to pin compatible PIC better than the 18F14K22?

Thanks

Joe



 

joesaliba

Further to my finding, there should be definitely something odd going on with variables in other includes.

Same project, I have a Float in another include, global one. I give it a value, add some maths for calibrate it to the host, and nothing, it stays the same value whatever I do.

I moved this variable to the main .bas file and everything works OK.

What should I do, move every variable to the main .bas file?

Joe

normnet

Could the order in which the variables are declared be the issue?  As you probably know the compiler reads starting at the top of the bas file which should list the includes near the top before the "do something" code is compiled.

joesaliba

Thanks Norm,

In fact, all I have in the main code is the Device, Crystal, some declares and then all the includes.

I think that should be OK. Shame is I cannot post the code as one need a specific hardware for it to work.

Joe

normnet

#4
Perhaps take a look at FineLineIDE's "FindAll.." button in the find dialog and check "include open include files.." for a concise picture of just the Float lines with their file names, line number, and procedure names if within one.  Hopefully it will help identify the issue with the Float.