Is zero(0) a true zero?

alhoop

Member
If i write:
Code:
symbol gnd = b7
b7 = 0
What value does b7 hold?
Is it 0.0v or is it the same as a low
which can be considered low if it is
less than 0.2 *Vcc?

Al
 

inglewoodpete

Senior Member
b7 is a 1 byte (8-bit) memory location, so it can hold values 0 to 255. Nothing to do with a voltage, unless you have loaded a 1-byte value representing a voltage. What the value means is up to you, the programmer. Since the code you posted makes no reference to voltage, '0' just means a byte with all 8 bits set to 0.
 
Last edited:

premelec

Senior Member
It holds 0 - LOW and HIGH will set a pin low or high which in various circumstances may actually have a voltage on that pin [e.g. because of current sinked or sourced]. Math numbers are different than physical properties...
 

SAborn

Senior Member
In "YOUR" code B7 will hold the value of "0"

If you code read a ADC pin (readadc X, B7) and the pin was connected to Gnd then the value would be 0 and if the pin was connected to supply voltage (5v) then the value would be 255, and any voltage in between would be a fraction between 0 and 255.
 

oracacle

Senior Member
Yes in your case it would have an integer value of zero unless you said b7 = "0"which wild insert an ascii value for character of zero.

Of you were to look into representing negative number then depending on how you worked the maths it may represent some other value, but that's a little complex for this situation
 

BeanieBots

Moderator
Perhaps if you say why it might in any way matter, people might be able offer more insight.
As already stated by others, it's just a number. If you write zero down on a piece of paper that has no relation to any voltage either!
 
Top