Ra0 to Ra4

Ra0 to Ra4
Is a bi-directional port where it can be configure as an input or an output that depend on program declaration.

Example.
Bsf STATUS, RPO
Movlw 00h
Movwf TRISA
Bcf STATUS, RPO

Which means that I am declaring the port Ra0 to Ra4 to be an output so the direction of the current in port Ra0 to Ra4 will be like this



Figure. 2

but the question is, how I declare that the Ra0 to Ra4 will become an output; from the example I write the

Movlw 00h
Movwf TRISA

Where 00h is an hexa number that arrange into

Ra4 Ra3 Ra2 Ra1 Ra0
0 0 0 0 0

The 00h is equal 00000 in binary, so if I declare 0 (zero) binary signal to each port which means the port will become an output and if I declare 1 (one) binary signal to the port then it will become an input

Example

Bsf STATUS, RPO
Movlw 05h
Movwf TRISA
Bcf STATUS, RPO

And the direction of the current will become like this



Figure. 3

Where 05h is an hexa number that arrange into

Ra4 Ra3 Ra2 Ra1 Ra0
0 0 1 0 1

The 00h is equal 00101 in binary

No comments: