This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Read and Write

Hi

Since I want to set three input and one output so

my code would be like that:

//Configurations
sbit READ_1=P1^0;
sbit READ_2=P1^1;
sbit READ_3=P1^2;
sbit SEND=P1^3;

READ_1=1; //INPUT
READ_2=1; //INPUT
READ_3=1; //INPUT
SEND=0; //OUTPUT

//Main program

bit x1,x2,x3;


x1=READ_1;
x2=READ_2;
x3=READ_3;

SEND=x1;

Is it correct?

Arron

Parents
  • Is it correct?
    somewhat
    1) you need an infernal loop, there is no "exit from program"
    2) setting a pin to 0 does NOT "make it output" it is that even if set to 1. Read about quasi-bidirectional in "the bible"
    3) setting a pin to 1 does NOT "make it input" it it just enables it to be pulled down externally. Read about quasi-bidirectional in "the bible"


    Erik

Reply
  • Is it correct?
    somewhat
    1) you need an infernal loop, there is no "exit from program"
    2) setting a pin to 0 does NOT "make it output" it is that even if set to 1. Read about quasi-bidirectional in "the bible"
    3) setting a pin to 1 does NOT "make it input" it it just enables it to be pulled down externally. Read about quasi-bidirectional in "the bible"


    Erik

Children