When would you use INA = 1 Nibble Names instead of IN0 Bit Name Please
sam_sam_sam
Posts: 2,286
When would you use·OUTA = 1· Nibble Names·· instead of·OUT1·· Bit Name···· Please Give an Example
what different if you used this··HIGH 1·or LOW 1···instead of the···OUT1··or OUTA = 1
I have read·PBasic Syntax·a few time on this ·But·I not clear on when to use what
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 5/21/2009 3:49:02 AM GMT
what different if you used this··HIGH 1·or LOW 1···instead of the···OUT1··or OUTA = 1
I have read·PBasic Syntax·a few time on this ·But·I not clear on when to use what
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 5/21/2009 3:49:02 AM GMT
Comments
I was a bit confused as your subject referred to the INA statement, but your message refers to OUTA. In any event, OUTA can set 4 outputs at a time rather than just one set by a single HIGH/LOW statement, however, unless the DIRA register was set to output, the value set to OUTA will never be seen on the pins, since OUTA does not automatically make the pins an output as the HIGH/LOW commands do.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
that will detect a tie better than doing,
because in the former case the test of all the inputs happens at essentially the same time, whereas in the second case the tests of the individual bits are done about 0.15 milliseconds apart. Sometimes that matters. The first example also runs through the DO:LOOP much faster and has better time resolution. Any time you want to input or output multiple pins and go through a sequence FAST, the option of INS and OUTS will win over dealing with individual pins.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
A typical application might be the control of a stepper motor, if you search I am sure you will find an example.
Chris brought up a good point that is not immediately obvious·"unless the DIRA register was set to output, the value set to OUTA will never be seen on the pins" , the order in which you write the instructions in code has an effect on the way OUTA operates. What I am saying is that DIR does not neccessarily have to come before the OUT instruction , DIR can be used to "switch" a preset value of OUT.
Example
OUTA=%1111 'here P0,P1,P2 and P3 have been set high but until we issue the DIR instruction the result will not be seen at the output
DIRA=%1111 ' here OUTA has been set to output in effect switching P0,P1,P2 and P3 to logic 1
DIRA=%0000 ' here OUTA has been set to input in effect switching P0,P1,P2 and P3 to logic 0
That is not the be all and end all of DIR and OUT but just an aspect I find interesting and useful at times
Jeff T.
·Thank You for explaining this to me and your examples this has help me a lot
Chris
Thank You for your reply and explanation
I was a bit confused as your subject referred to the INA statement, but your message refers to OUTA. In any event,
I did not mean to confuse you or anyone· but the subject line was not long enough to put all of what I want to ask about
SRLM
Thank you for your·very simple explanation
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
Also see some of the line-following code examples for the Boe-bot which grab all the line sensors at once using IN<x>, etc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Thank you for your reply
I will try this when I have some time
'·hookup·8·leds·to·pins·0-7
OUTL·=·%00000001·'·when·outputs,·first·led·on
DIRL·=·%11111111·'·make·'em·outputs
DO
··PAUSE·250
··IF·OUTL·=·%10000000·THEN
·····OUTL·=·%00000001
··ELSE
·····OUTL·=·OUTL·<<·1
··ENDIF
LOOP
END
Also see some of the line-following code examples for the Boe-bot which grab all the line sensors at once using IN<x>, etc.
Could you post the link to this with the pages #
·I would like to read up on this IN<x> and line-following code examples for the Boe-bot
Thanks for·sharing this···
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Thanks for the Link
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam