Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

clearing a variable declared in INC file

Status
Not open for further replies.

danuke

New Member
I was wondering if there is a way to clear a variable declared within an .inc file in MPLab IDE. I'm wanting to use the Z variable to represent the zero bit in the status register and it appears that it is set as something else. The reason I think it may be another value is because when I use movfw Z, it loads 0x0E into the W register.

I want to leave the other declarations in the .inc file as they are, but just want to change that one declaration. I would rather it be in code so that I can use it in the code no matter the PIC that I use...

Thanks,
Joe
 
I think you will find that Z is equal to 2 which is the Zero bit in the status register. You did movfw Z and got 0E (the content of PCL). If you had done movlw Z you would have got 2.

Mike.
 
danuke said:
Thanks guys. Will adjust accordingly.

You shouldn't go changing values in the .INC files, certainly not something as important as Z - they aren't variables, they are simply text substitutions - if you feel you have a need to change them you're doing something SERIOUSLY wrong.
 
Nigel Goodwin said:
You shouldn't go changing values in the .INC files, certainly not something as important as Z - they aren't variables, they are simply text substitutions - if you feel you have a need to change them you're doing something SERIOUSLY wrong.


To be honest the only reason I was actually wanting to change it is because I'm a computer/electronics engineer student in college. Working with Microsoft Assembler, it refers to the zero bit as a Z flag. It's really not a huge deal for me to have to use something other than Z to refer to it. I also realize Z isn't a variable, but really was lacking a term to describe it accurately when I was trying to phrase my original question.

I wasn't referring to I'll adjust the inc file accordingly, but rather my program code. I can see where messing around in things like that can become a problem waiting to happen.
 
Status
Not open for further replies.

Latest threads

Back
Top