Shop OBEX P1 Docs P2 Docs Learn Events
A BASIC can cycle a binary counter — Parallax Forums

A BASIC can cycle a binary counter

Hello!
Okay try this out:
' {$STAMP BS2}
serdata  VAR  Byte

again:
'*****this will wait for serial from calculator
SERIN 15,396,[serdata]

'***this will send it to the pc debug screen
'DEBUG DEC serdata, CR

'***this will send the same data plus 1 back to the calculator
PULSOUT 14,5
serdata=serdata + 1
SEROUT 15,396,[serdata]
serdata=serdata + 1
SEROUT 12,396, [DEC serdata, CR]
SEROUT 15,396,[serdata]
'serdata=serdata + 1
SEROUT 15,396,[serdata]
SEROUT 12,396, [HEX serdata, CR]
OUT13 =1
GOTO again

To run that you'll need a #27997 LCD display on P12, and a TI TI-83 Plus calculator plus the programs from his site. I'm not sure I can distribute them. Oh you'll need the TI tools to install them on the device. Usual things for programming the BS2 and of course a proper board for holding it, I used one of my BOE boards, and the counter is an SN74LS163, (but I used a second source NSC version.) And a breadboard for holding the counter, and four LEDs for the displaying the binary data, and jumper wires to connect everything together. as you can see I have
PLUSOUT 14,5
for clock. That pin goes to the clock pin on the chip. I can distribute a PDF of the data for the chip. And I have
OUT13 =1
going to either the ENT or ENP pins, which are 10, and 7, respectively.

The display connected to 12 will show 192 on top and its HEX version of C0 on the bottom, but it will continue to run. The idea comes from an article on his site: Which thankfully is still up of course Basic Stamp II to TI83+ on there are the programs for the calculator and the instructions for connecting the two together. Plus a sample program for confirming that the whole thing works. For those of you who do this, I do not recommend doing what he suggests, instead track down a patch cable of a 1/8" stereo plug cable, of the sort used to connect sound card AUX inputs to something else, and an adapter who translates 1/8" to 3/32" connectors. You'll want one that's a 3/32" plug with a 1/8" jack inside it. And a 1/8" stereo plug to attach to the Stamp. Please be careful, these things actually are expensive.

If you want you can find a 3/32" plug to connect to the cable that comes with the calculator and use that. Above all have fun. I am......

Comments

  • I should also mention that I constructed a special breakout board containing a four pin header, and a connector of the sort used by sound cables for the desktop soundcards, back when they used them. And then wired the 1/8" jack to the end of the cable I used. That cable contains a special connector at one end not normally seen on soundcard cables. The other end is a normal one also used for soundcard connections. The headers are connected to the stamp board, either a Stamp 2 in this context, or even a Stamp 1, sometimes, via a set of jumpers using Dupont connectors. (Cable colors are red and black to match the ones on the cable.)
  • And in this iteration I've simplified the code considerably.
    ' {$STAMP BS2}
    serdata  VAR  Byte
    
    again:
    '*****this will wait for serial from calculator
    SERIN 15,396,[serdata]
    
    '***this will send it to the pc debug screen
    'DEBUG DEC serdata, CR
    
    '***this will send the same data plus 1 back to the calculator
    PULSOUT 14,5
    serdata=serdata + 1
    SEROUT 15,396,[serdata]
    'DEBUG DEC serdata, CR
    SEROUT 12,396, [DEC serdata, CR]
    OUT13 =1
    GOTO again
    

    I used the code block from the 9th step in the whole idea, and pasted into it the same blocks that cause the stamp to talk to the chip. Of course this is just the beginning. And before anyone asks, the idea is to have the code and the chip run what could be called a logic puzzle. With the output being an AV02-1355EN from Broadcom. (Originally a HDSP-0762, which was one of the better displays from HP's semiconductor division. It first found itself spun off to become Avago technologie. Then Broadcom swallowed them.)

    Next steps are to figure out how to insert my favorite logic blocks. More on that later.
  • And now that's been done. I've updated the code.
    ' {$STAMP BS2}
    serdata  VAR  Byte
    
    again:
    '*****this will wait for serial from calculator
    SERIN 15,396,[serdata]
    
    '***this will send it to the pc debug screen
    'DEBUG DEC serdata, CR
    
    '***this will send the same data plus 1 back to the calculator
    PULSOUT 14,5
    serdata=serdata + 1
    SEROUT 15,396,[serdata]
    'DEBUG DEC serdata, CR
    SEROUT 12,396, [DEC serdata, CR]
    PAUSE 20
    'OUT13 =1
    SEROUT 13,396,[serdata]
    GOTO again
    
    Instead of pulling the P13 line low, it's driven out by the same serial bit stream which presents 192 to the counter as a stream of bits. The gates have both an expansion input and the regular inputs. These are the SN7423 ones. I thought I would use the expansion inputs one them, so I installed the part numbers I would use. Not this time. I am also sending the same bit stream to the G inputs on the gates, its causing a ripple effect.

    Someone must be asking, "Why is this being done?" It is the novelty of the design that's driving it.
Sign In or Register to comment.