Wednesday, April 11, 2007

The peek command

We can use the peek command to check the status
of any input line.Using the peek command we can
read the five i/o lines of portA or the eight i/o
lines of portB at once.
syntax
peek address, var
As its name implies,the peek command allows to
view or peek at the contents of the specified
memory address.Typically the memory address
peeked at is one of the pic microcontroller's
registers.The peeked value is stored in a
variable var defined in the command.
The peek command can read an entire byte at
once as in thecase of portB ,but in the case of
portA only lower 5 bits of the peeked value are
relevant.
Bit0..Bit15
The first 2 bytes of ram memory,B0 and B1 are
special.This is because we can test the bit
values contained in each byte.
For B0,Bit0 to Bit7
B1,Bit8 to Bit15
Using these we can check the condition
of the input bits or pins at the port.

No comments: