Shop OBEX P1 Docs P2 Docs Learn Events
BS2px parallel I/O? — Parallax Forums

BS2px parallel I/O?

brucehbruceh Posts: 5
edited 2012-08-17 15:36 in BASIC Stamp
Does the BS2 family have parallel I/O capability?
What I mean is can I output a variable to a group of I/O pins?
My design uses a quadrature rotary encoder that is decoded by a LS7366 chip and input to the the BS2px serially (SPI) using SHIFTIN / SHIFTOUT.
Synchronizing with a POLLIN from a sensor I am grabbing parts of the binary stream and wish to output a count to a 74154 one of sixteen chip to light 1 of 16 leds. I don't see an instruction that will allow the ability to, for instance, directly output a nibble to a group of 4 pins.
What have I missed?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-17 12:04
    Read the Basic Stamp Syntax and Reference Manual starting at page 81. This discusses how memory is arranged and accessed. The I/O registers (INS, OUTS, DIRS) are all provided as 16-bit words which can be accessed directly as individual bits, groups of 4 bits (like OUTA, OUTB, OUTC, and OUTD), groups of 8 bits (like OUTH and OUTL), and as a single group of 16 bits. You can also use the shift and bit logical operators to access arbitrary groups of I/O bits within the 16-bit registers.
  • brucehbruceh Posts: 5
    edited 2012-08-17 14:05
    Thanks for the promt reply.
    Have looked at the manual again, but I still am not clear on the mechanics of moving the contents of my variable (deltacount var nib) to 4 output pins for display on the 1 of 16 leds.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-17 15:00
    If you use named pin groups, like P8-12 which is OUTC, you can just assign any 4 bit value to OUTC (OUTC = deltacount) and it will appear on the I/O pins. Remember that you have to initialize the direction bits (DIRC) to outputs like: DIRC = 15
  • brucehbruceh Posts: 5
    edited 2012-08-17 15:36
    Thanks Mike
Sign In or Register to comment.