PDA

View Full Version : BS2 Output pin internal register



skylight
04-06-2007, 05:10 AM
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

Unsoundcode
04-06-2007, 05:19 AM
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.

skylight
04-06-2007, 05:26 AM
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?

Unsoundcode
04-06-2007, 06:09 AM
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.

skylight
04-06-2007, 07:10 AM
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 Bates
04-06-2007, 02:12 PM
Gents -

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

Regards,

Bruce Bates

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔