Shop OBEX P1 Docs P2 Docs Learn Events
BS2 Output pin internal register — Parallax Forums

BS2 Output pin internal register

skylightskylight Posts: 1,915
edited 2007-04-06 06:12 in BASIC Stamp
Does the Basic Stamp control the output pins using internal registers the same way·like PLC's do? Reason i ask is that i'd like to do integer maths up to 8 bit and have the result entered into the output register so that it shows up as binary on pins P0 to P7 for example, without the need to have lookup tables or DATA statements holding the bits for each binary number up to 255 (too much typing) I have successfully achieved this with PLC's using simple instructions such as load binary result into memory address of output pin0's register and all the other binary bits set the corresponding output pins high/low,so wondered if the same was possible with a BS2 and how it would be achieved ie what is the memory address for Pin0?
Thanks in advance


Post Edited (skylight) : 4/5/2007 9:15:17 PM GMT

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-04-05 21:19
    Hi skylight, look at the OUTS command in "Memory and Variables" in the IDE Pbasic help. OUTL = %11111111 or OUTL = $FF for example would hold pins 0 to 7 high.

    Jeff T.
  • skylightskylight Posts: 1,915
    edited 2007-04-05 21:26
    Hi Jeff thanks for the quick reply, so i gather that i should be able to dump a variable into the OUTL% statement such as OUTL%X?
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-04-05 22:09
    Yes , OUTS is a word (P0 to P16) OUTL low byte OUTH high byte OUTA low nib etc. Assign a variable in whatever format you want OUTL=%11111111 as binary ,OUTH =$FF as hex ,OUTS=myvariable. You can read inputs in a similar way with the INS statement. Its a useful feature well documented in the help files.

    Jeff T.
  • skylightskylight Posts: 1,915
    edited 2007-04-05 23:10
    Thanks Jeff, I did read the help files but took so much information in one sitting that some parts like the OUTS statement got flushed out the brain cells, so thanks for the reminder jolt, i'll make sure i read that section again thoroughly.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-04-06 06:12
    Gents -

    Just a small correction. OUTS = P0-P15 (16 Ports).

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sign In or Register to comment.