Shop OBEX P1 Docs P2 Docs Learn Events
74165 Serial Input Question — Parallax Forums

74165 Serial Input Question

JomsJoms Posts: 279
edited 2008-11-15 03:13 in BASIC Stamp
At one time I was able to make this work, now I can't seem to make this circuit work correctly and I am sure I am just overlooking a small detail.· What the end goal is, I want to take a 5 position BCD digital input to a 74165 shift register and make it appear as a decimal number to the stamp.· Because I can't get this circuit to work I have started over with only this part in the program.· I have attached my current program if someone can look at it and give me an idea of what I am overlooking.· It will only display bit0 on the debug...

The wiring is:
Pin 0 - Shift/Load
Pin 1 - Clock
Pin 2 - Data to Stamp from 74165

Thanks in advance for any help...

Comments

  • JomsJoms Posts: 279
    edited 2008-11-14 17:05
    I got most of the way there... Problem is though I can not find a way to make a FOR loop work to access bits within a byte like I was attempting to do in the first program. Below is where I am at currently. Does anyone know a simple way to make a for loop for the 8 steps because they are almost the same?


    serial VAR Byte
    stored VAR Byte
    shift VAR Nib

    OUT0=1
    OUT1=1

    Main:

    PULSOUT 0, 5 ' load the inputs
    serial.BIT0 = IN2
    PULSOUT 1, 5 ' clock out the next bit
    serial.BIT1 = IN2
    PULSOUT 1, 5 ' clock out the next bit
    serial.BIT2 = IN2
    PULSOUT 1, 5 ' clock out the next bit
    serial.BIT3 = IN2
    PULSOUT 1, 5 ' load the inputs
    serial.BIT4 = IN2
    PULSOUT 1, 5 ' clock out the next bit
    serial.BIT5 = IN2
    PULSOUT 1, 5 ' clock out the next bit
    serial.BIT6 = IN2
    PULSOUT 1, 5 ' clock out the next bit
    serial.BIT7 = IN2

    IF serial = stored THEN
    GOTO Main:
    ELSE
    Stored = Serial
    ENDIF

    DEBUG CLS
    DEBUG DEC serial
    · PAUSE 100
    · GOTO Main
    · END
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-11-15 03:13
    Have you read Stampworks (V2.1)?· See PDF pages 147-150

    http://www.parallax.com/Portals/0/Downloads/docs/books/sw/Web-SW-v2.1.pdf
Sign In or Register to comment.