Shop OBEX P1 Docs P2 Docs Learn Events
Can't write byte to port? — Parallax Forums

Can't write byte to port?

adelleadelle Posts: 2
edited 2020-07-12 22:15 in BASIC Stamp
NOTE: PROBLEM RESOLVED.

This doesn't make sense? (Experienced 30+yr embedded C programmer)

The following trimmed down code will not work, that is make pin 3 HIGH and just stop (hang).

' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM1}

START:
DIRL= %00001111 'first port
DIRH= %11111111 'second port
OUTA = $8
GOTO MAIN

MAIN:
GOTO MAIN

This crappy code does work but I need to send a nibble VARIABLE to the lower port: What am I doing wrong

' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM1}

START:
LOW 0
LOW 1
LOW 2
HIGH 3
GOTO MAIN

MAIN:
GOTO MAIN

Comments

  • JonnyMacJonnyMac Posts: 8,912
    edited 2020-07-12 22:06
    You can access the IO pins as nibbles using...
    -- INA, DIRA, OUTA (pins 0..3)
    -- INB, DIRB, OUTB (pins 4..7)
    -- INC, DIRC, OUTC (pins 8..11)
    -- IND, DIRD, OUTD (pins 12..15)
    
  • adelleadelle Posts: 2
    edited 2020-07-12 22:15
    Thanks JonnyMac, I found the problem. Hair line short on home made PC board shorting pin 3 to pin 14.

    What do you do in Hollywood? I work there too.
  • Buck RogersBuck Rogers Posts: 2,160
    edited 2020-07-13 10:15
    adelle wrote: »
    Thanks JonnyMac, I found the problem. Hair line short on home made PC board shorting pin 3 to pin 14.

    What do you do in Hollywood? I work there too.

    Last time I checked our intrepid commentator was the means behind movie (and TV) making.

    Jon, our correspondent, wrote a PBASIC program to do that, is what you've posted a SPIN or PASM example?

    (And what in the world is that out of a movie monster doing you watching work?)
  • What do you do in Hollywood? I work there too.
    Most of my time is spent writing embedded code; I have clients in "the business" and in other forms of entertainment (Disneyland, Legoland, laser-tag, escape rooms, etc.). I'm also a member of SAG and have done a bit of acting. I am a long-time user of Parallax products and worked at Parallax for a time. You can see a bunch of the stuff I've done here:
    -- https://www.pinterest.com/jonmcphalen/techno-art/
    I have in fact written prop control code for FX artists with the BASIC Stamp, the SX, and since about 2008 I have focused on the Propeller.
Sign In or Register to comment.