Log in

View Full Version : What does CLEAR actually clear?



BrianT
- 9th June 2010, 02:07
Assume I have
A VAR BYTE
B VAR BYTE
PortD = %11111111
[some code here]
CLEAR
[rest of code]

Help for CLEAR says "Set all RAM registers to zero. CLEAR zeroes all the RAM registers in each bank. This will set all variables, including the internal system variables to zero....

A and B will be cleared to 0 but what happens to PortD? Will it also be cleared to %00000000 or will it remain at %11111111?

I can't get to a PIC right now to try this unfortunately so I'm hoping someone knows the answer.

Cheers
Brian

Bruce
- 9th June 2010, 14:00
CLEAR just clears all variables in RAM to 0. It doesn't affect ports. And when you declare something like MyVar VAR PORTD, this doesn't create a variable in RAM. It just creates an alias you can use VS using PORTD.

student
- 27th August 2014, 12:57
it just clears variables for example it doesnt clear t1con

richard
- 27th August 2014, 13:40
are you actually asking a question or are you trying to answer threads that have been dormant for several years