Shop OBEX P1 Docs P2 Docs Learn Events
changing output pin question on BS2 — Parallax Forums

changing output pin question on BS2

cdmarioncdmarion Posts: 2
edited 2011-12-05 05:58 in BASIC Stamp
Hello,

I'm trying to change the output pins 4,5,6 and 7 to 9,10,11 and 12 in the program below, I cant seem to translate the DIRB = %1111 binary number to assign the new pins. I've not seen any stepper programs for the BS2 use any pins except 4 thru 7. Any help would be greatly appreciated.
I'm using;[FONT=Tahoma,Bold][FONT=Tahoma,Bold]Program: SW21-EX27-Stepper_Control.BS2
[/FONT][/FONT]
[FONT=Tahoma,Bold][FONT=Tahoma,Bold][/FONT][/FONT]
This is out of the Stampworks manual.
Setup:
DIRB = %1111 ' make P4..P7 outputs
stpDelay = 5 ' set step delay

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-12-04 10:45
    DIRB = %1111 makes P4-P7 outputs.
    To change the output states, use OUTB = %____

    9, 10, 11, 12 are in C and D (C is 8-11, D is 12-15)
    DIRS = %000111100000000 makes 9 through 12 outs (the 0's = inputs). DIRH = %00011110 effects bits 15-8
    You should use outputs in a nibble, don't straddle (viz 9-12)
    Go with 8-11 or 12-15 and life will be less complicated.
  • cdmarioncdmarion Posts: 2
    edited 2011-12-05 05:58
    Thanks!! Just what I was looking for!!
Sign In or Register to comment.