Shop OBEX P1 Docs P2 Docs Learn Events
question on Propeller Demo board — Parallax Forums

question on Propeller Demo board

Brian1179Brian1179 Posts: 3
edited 2011-10-12 15:49 in Propeller 1
i just received my Propeller Demo board Rev G, when i program it and reset it does nothing. one of the LEDs on the board (not the power LED), its by the chip itself, lights and does nothing. is this normal

Comments

  • Mike GMike G Posts: 2,702
    edited 2011-10-11 19:44
    Welcome to the forum.

    Please post the code.

    What is the code supposed to do?
    How are you powering the Demo Board?
  • Brian1179Brian1179 Posts: 3
    edited 2011-10-11 19:52
    this is the code:
    VAR
      long  StackA[32]                       'Stack workspace for cogs
      long  StackB[32]
      long  StackC[32]
     
    PUB Main
      cognew(LED_Flash(16, 30, 5), @StackA)  'Launch cog to flash led
      cognew(LED_Flash(19, 15, 15), @StackB) 'And another for different led
      cognew(LED_Flash(23, 7, 26), @StackC)  'And a third, all at same time
     
    PUB LED_Flash(Pin, Duration, Count)
    {Flash led on PIN for Duration a total of Count times.
     Duration is in 1/100th second units.}
      Duration := clkfreq / 100 * Duration   'Calculate cycle duration
      dira[16..23]~~                         'Set pins to output
      repeat Count * 2                       'Loop Count * 2 times...
        !outa[Pin]                           '  Toggle I/O pin
        waitcnt(Duration + cnt)              '  Delay for some time
    

    this program does not run when i reset or turn off the board, i have a wall wort power adapter that i received with the board
  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-10-11 20:14
    Brian1179 wrote: »
    ...

    this program does not run when i reset or turn off the board, i have a wall wort power adapter that i received with the board

    Are you storing the program in the EEPROM so it will boot up when power is turned on?

    You can load your program into EEPROM by using the F11 key.


    attachment.php?attachmentid=78421&d=1297987572
  • Mike GreenMike Green Posts: 23,101
    edited 2011-10-11 20:20
    When you cut and paste program text in these forums, the formatting is lost, so we can't tell if the indenting is correct. Assuming that it is, your program should work although the timing will be off because your program is running off the (default) RCFAST clock and the actual clock speed can vary quite a bit although CLKFREQ is fixed. You won't see much because the durations and counts are pretty small. 30 * 5 * 1/100 = 3 seconds of cycles. 15 * 15 * 1/100 = 5+ seconds of cycles. 7 * 26 * 1/100 = 3+ seconds of cycles. If the actual clock is 20MHz instead of the (assumed) 12MHz, those times are proportionately shorter.

    Next time, surround your code with [ code ] and [ /code ] tags (without the extra spaces).

    Does the Propeller Tool successfully download the program?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-10-11 21:22
    Remember too that each cog has it's own DIRA and OUTA registers and so you should avoid this kind of thing:
    dira[16..23]~~ 'Set pins to output

    Whereas you should instead just say:
    dira[pin]~~

    I think all of us have made this mistake when we were still getting used to the Prop. As Mike noted the delays you have are way way too short. I prefer to code a millisecond routine and then I know how long it is when I say " ms(100)" for instance.
  • Brian1179Brian1179 Posts: 3
    edited 2011-10-11 22:20
    thanks all, pressing the F11 key worked

    i am used to the BS2 code, sorry about the stupid question

    this is my first time on this forum

    thanks again
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2011-10-11 22:29
    > i am used to the BS2 code, sorry about the stupid question

    I wouldn't say that it's a stupid question. The Propeller will run a program from RAM or EEPROM. Sometimes it's handy to just run from RAM, when your still debugging a program. I usually run from RAM if I'm trying out new code, provided the program continues to loop.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-10-11 22:33
    Brian1179 wrote: »
    ...sorry about the stupid question

    this is my first time on this forum...

    Hey, welcome to the forum!
    Don't hesitate to post your questions here.
    It's a friendly bunch. Mostly. :-)


    Kevin Wood wrote: »
    ...The Propeller will run a program from RAM or EEPROM. Sometimes it's handy to just run from RAM, when your still debugging a program. I usually run from RAM if I'm trying out new code....

    Yes, Kevin brings up a good point. Just remember that if you load a program into EEPROM, it will stay there until you load something else or "flush it out" by loading a Do-nothing program. In the past, I've made the mistake of loading one version of a program into EEPROM, then went on debugging by loading fixes into only the RAM, only to come back the next day, power up the Propeller, and find my machine doing all sorts of weird things because it's automatically booting up that old program I had loaded into the EEPROM and never flushed out. So just keep track of what you've got stored in EEPROM.
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-10-12 15:49
    Yes, Welcome to the fabulous world of the propeller and this great forum.
    Remember, we have all been there and done that. Just post you questions if you cannot work it out. We can set you on your way :)
Sign In or Register to comment.