Output - Input
Mike only
Posts: 15
Halo,
I'm new in PBasic programming and tried to make a program with BOE (BS2). This time, I'm using· INPUT and OUTPUT commads, but I've different result, when I put the INPUT command in front of OUTPUT command:
OUTPUT 8
OUTPUT 9
INPUT 10
Main:
···· OUT8=IN10
····· OUT9=IN10
GOTO Main
Is different result when I make a program as below:
OUTPUT 8
OUTPUT 9
INPUT 10
Main:
···· IN10=OUT8
···· ·IN10=OUT9
GOTO Main
Is it correct that I may not freely put the commands as I will, even though it's logically·the same
Sorry for my poor english.
Thank you
Mike only
I'm new in PBasic programming and tried to make a program with BOE (BS2). This time, I'm using· INPUT and OUTPUT commads, but I've different result, when I put the INPUT command in front of OUTPUT command:
OUTPUT 8
OUTPUT 9
INPUT 10
Main:
···· OUT8=IN10
····· OUT9=IN10
GOTO Main
Is different result when I make a program as below:
OUTPUT 8
OUTPUT 9
INPUT 10
Main:
···· IN10=OUT8
···· ·IN10=OUT9
GOTO Main
Is it correct that I may not freely put the commands as I will, even though it's logically·the same
Sorry for my poor english.
Thank you
Mike only
Comments
It is a little confusing since the same character is used to test for equality in the IF statement (but only in the IF statement
or the WHILE or UNTIL portions of the DO statement).
When you say "OUT8=IN10", you are saying "make the output pin 8 the same as the present value of input pin 10".
When you say "OUT9=IN10", you are saying "make the output pin 9 the same as the present value of input pin 10".
When you say "IN10=OUT8", you are actually doing something unusual since you are trying to set an input register bit
to the value of an output register bit. The PBasic interpreter promptly ignores what you have tried to do and sets IN10
to the actual value of the input pin. You can use OUT8 as a value since the output register contains the last value that
you set for the output pin even if the direction of the pin is set to input.
I hope this helps.
Best Regards,
Mike only