PDA

View Full Version : question on Propeller Demo board



Brian1179
10-12-2011, 03:38 AM
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

Mike G
10-12-2011, 03:44 AM
Welcome to the forum.

Please post the code.

What is the code supposed to do?
How are you powering the Demo Board?

Brian1179
10-12-2011, 03:52 AM
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

ElectricAye
10-12-2011, 04:14 AM
...

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.


http://forums.parallax.com/attachment.php?attachmentid=78421&d=1297987572 (http://forums.parallax.com/showthread.php?129690&p=978076&viewfull=1#post9780 76)

Mike Green
10-12-2011, 04:20 AM
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 Jakacki
10-12-2011, 05:22 AM
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.

Brian1179
10-12-2011, 06:20 AM
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 Wood
10-12-2011, 06:29 AM
> 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.

ElectricAye
10-12-2011, 06:33 AM
...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. :-)




...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.

Cluso99
10-12-2011, 11:49 PM
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 :)