Shop OBEX P1 Docs P2 Docs Learn Events
newbee question, parallel out? — Parallax Forums

newbee question, parallel out?

Del OgrenDel Ogren Posts: 7
edited 2006-04-30 02:13 in BASIC Stamp
Howdy, folks,

I'm a retired embeded systems programmer.· I bought a basic stamp development system
just to have something to fool around with when I get tired of working on other things.
Now I find that I have a job...

A friend of a friend is writing a PhD thesis on elephant communications and wants me
to make a low frequency audio tone generator.· No problem in Pbasic if I stick to square
waves, but I'd like to reduce the high frequency harmonics.· So I thought about driving
an R2R resistor network D/A converter.· But then, looking through the Pbasic manual,
I couldn't find any way to shove a nibble or a byte at the I/O pins in one statement.

Can this be done by writing into RAM?· Should I consider PWM?· Or should I just go
with square waves and a big cap to suck out the higher frequencies?

BTW..· I'd kinda like the frequency to be good to within 10 Hz or so..

Any guidance would be appreciated.

tnx,
--del

·

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-04-30 01:34
    Del Ogden said...
    ·looking through the Pbasic manual,
    I couldn't find any way to shove a nibble or a byte at the I/O pins in one statement.
    BS2, et al. parallels out just fine.
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
     
    DIRS = $00ff             ' P15-P08 = INs. P7-P0 = OUTs
    OUTL = %00000000         ' all outputs to 0
    
    parallel VAR byte
     
    FOR parallel = 0 TO 255  ' this will rifle through $00-FF
    OUTL = parallel
    next
     
    parallel = %11110000     ' here's $F0
    OUTL = parallel
     
    parallel = %00001111     ' here's $0F
    OUTL = parallel
     
    END
    
    

    Post Edited (PJ Allen) : 4/30/2006 1:37:55 AM GMT
  • Del OgrenDel Ogren Posts: 7
    edited 2006-04-30 02:13
    Great! Thanks PJ,

    Now I get the syntax...

    You helped me RTFM..

    --del

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Which end do end-users use?

    ·
Sign In or Register to comment.