Shop OBEX P1 Docs P2 Docs Learn Events
stand alone Propeller wont run code — Parallax Forums

stand alone Propeller wont run code

stelath_shadow9stelath_shadow9 Posts: 23
edited 2013-08-07 13:40 in Propeller 1
Hey guys. new on here. having an issue with my prop.

issue is I can run my code (to blink an LED) just fine on my propeller activity board. However, when I try to so the same thing on my stand alone propeller (p8x32a1) the LED blinks very faintly and more rapid than it should.

I am using a prop plug to program my propeller. everything is connected correctly, as when I go to run>identify hardware the prop tool program see's the MC. So I am wondering where I am going wrong. Perhaps a piece of code to do with the clock setting?

here is the code I am using.
{Object_Title_and_Purpose}



CON
        _clkmode = xtal1 + pll16x                                               'Standard clock mode * crystal frequency = 80 MHz
        _xinfreq = 5_000_000


VAR
  long  symbol
   
OBJ
  bs2   : "bs2"
  
PUB this
 bs2.start(31,30)
    repeat
     dira[1]~~
      !outa[1]
      bs2.pause(1000)

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-08-01 15:34
    Does your bare Prop have a crystal? If not comment out the two lines under "CON".

    Still, "pause" may not work exactly right since you don't have an accurate clock anymore. A lot will depend on how "pause" defines time.
  • shimniokshimniok Posts: 177
    edited 2013-08-02 15:33
    By "standalone" you mean like inserted into a breadboard? The DIP40 version? P8X32A-D40?

    Easy enough to add a crystal I suppose (caps not required, which is nice).
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-08-02 15:48
    shimniok wrote: »
    (caps not required, which is nice)

    Them are fighting words around here. (Or so I've observed.)
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-08-02 17:39
    He means no caps for the xtal are required with the prop.

    We need to see the pause code and know what board/circuit you are using.
    Just in case, if using a breadboard circuit, all power/ground pins must be connected and bypass caps must be used - else you risk damaging your prop.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-08-02 21:50
    Cluso99 wrote: »
    He means no caps for the xtal are required with the prop


    Ah, yes. I don't use other microcontrollers much but now that I think about it, most of them require capacitors with the crystal.

    Thanks for the correction.
  • shimniokshimniok Posts: 177
    edited 2013-08-03 10:30
    Yeah, caps on xtal; It's unusual and kind of a nice change. :)

    So, instead of using this bs2 object you could replace it with just plain old spin... use waitcnt(clkfreq/n+cnt)... then we don't have to wonder about pause.
  • stelath_shadow9stelath_shadow9 Posts: 23
    edited 2013-08-07 13:40
    So I ended up using Duane's suggestion and getting rid of the top part of the code dealing with the crystal (_xinfreq and _Clkmode)

    the next part was having to modify the code to use the waitcnt+cnt. so now it looks like this and works perfectly.
    PUB this    dira[1]~~
        repeat
        
           
          !outa[1]
          waitcnt(8_000_000+cnt)
    

    Thanks for all the replies.
Sign In or Register to comment.