Shop OBEX P1 Docs P2 Docs Learn Events
First program Propeller/Spin Stamp/Pulsout — Parallax Forums

First program Propeller/Spin Stamp/Pulsout

Rob v.d. bergRob v.d. berg Posts: 81
edited 2007-11-28 19:14 in Propeller 1
Hello,

I will start with the propeller software (Spin) and have the Spin Stamp this week received. The first small program·i have made is this:

CON
··· _clkmode = xtal1 + pll16x
··· _xinfreq = 5_000_000
····················
OBJ
··· BS2 : "BS2_Functions"··· ' Create BS2 Object

PUB Start
··· BS2.start (31,30)······· ' Initialize BS2 Object timing, Rx and Tx pins for DEBUG
··· repeat
····· BS2.PULSOUT(4,500) ' should give 500*2usec ~ 1000usec

This program give no pulsout, only when I remove the two line
'· _clkmode = xtal1 + pll16x
'· _xinfreq = 5_000_000

Without the two lines i get a puls about 880usec!, is this related to the clockcycle? The Spin has 10MHz as external clock?. I have two questions
- what is the correct syntacs for this program
- why is the pulstime not as·expected (~1000usec)

thanks in advance.

Regards,
Rob.






·

Comments

  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-11-28 15:32
    Without a pause in there, the pulses are so close you may not be seeing them.

    Repeat

    ·· BS2.Pulsout(4,500)

    ·· BS2.Pause(20)





    -Martin



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    SelmaWare Solutions - StampPlot GUI for controllers, XBee and Propeller Application Boards

    Southern Illinois University Carbondale, Electronic Systems Technologies
  • MinimumWageMinimumWage Posts: 72
    edited 2007-11-28 17:45
    For a spin stamp running at 80MHz your timing statements should be:

    _clkmode = xtal1 + pll8x
    _xinfreq = 10_000_000

    Most of the examples of spin code floating around are set up for the 5MHz crystal, so make sure to check the CON block anytime you run sample or demo code on a spin stamp. It's easy to forget - I still do it all the time myself!

    Mike
  • Rob v.d. bergRob v.d. berg Posts: 81
    edited 2007-11-28 19:14
    Thanks Mike and Martin,

    The Trick was the·CON block, now·the timing·is OK. The pauze time is about 57usec, cyclus·freq of 17,5KHz

    Rob.

    CON
    · _clkmode = xtal1 + pll8x
    · _xinfreq = 10_000_000

    ····················
    OBJ
    ··· BS2 : "BS2_Functions"··· ' Create BS2 Object

    PUB Start
    ····· BS2.start (31,30)······· ' Initialize BS2 Object timing, Rx and Tx pins for DEBUG

    ··· repeat
    ····· BS2.PULSOUT(4,500)·· ' 1 msec
Sign In or Register to comment.