Post "Blink an LED" program in your favorite langauge.
Bean
Posts: 8,129
Here is the idea:
· Post a program that blinks the LED on pin 16 of the Propeller demo board at 1Hz.
· Please post the absolute simplest program possible.
· Let's see how many languages we can post, this will let propellers user see a smidge of each language available.
· Here is spin:
· Here is PASM:
· And PropBASIC:
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
Post Edited (Bean) : 2/15/2010 7:27:49 PM GMT
· Post a program that blinks the LED on pin 16 of the Propeller demo board at 1Hz.
· Please post the absolute simplest program possible.
· Let's see how many languages we can post, this will let propellers user see a smidge of each language available.
· Here is spin:
' Spin CON _ClkMode = RCFAST ' Internal 12MHz LED = 16 ' LED pin is 16 PUB Program dira[noparse][[/noparse]LED]~~ ' Make pin an output REPEAT ' Repeat forever outa[noparse][[/noparse]LED]~~ ' Make pin high waitcnt (cnt+6_000_000) ' Wait 500mSec outa[noparse][[/noparse]LED]~ ' Make pin low waitcnt (cnt+6_000_000) ' Wait 500mSec
· Here is PASM:
' PASM CON _ClkMode = RCFAST ' Internal 12MHz PUB Program CogInit(0, @Init, 0) ' Start PASM code DAT org 0 Init mov dira,LED ' Make pin an output mov wait,cnt ' Setup for 500mSec wait add wait,_6_000_000 Again or outa,LED ' Make pin high waitcnt wait,_6_000_000 ' Wait 500mSec andn outa,LED ' Make pin low waitcnt wait,_6_000_000 ' Wait 500mSec jmp #Again ' Repeat forever LED LONG %00000000_00000001_00000000_00000000 _6_000_000 LONG 6_000_000 wait RES 1
· And PropBASIC:
' PropBASIC DEVICE P8X32A ' Defaults to internal 12MHz LED PIN 16 OUTPUT ' LED is pin 16 and make it an output PROGRAM Start ' Start execution at label Start Start: HIGH LED ' Make pin high PAUSE 500 ' Pause 500mSec LOW LED ' Make pin low PAUSE 500 ' Pause 500mSec GOTO Start ' Repeat forever
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
Post Edited (Bean) : 2/15/2010 7:27:49 PM GMT
Comments
even tighter yet ... cheers ... BBR
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
cheers ... brian riley, n1bq, underhill center, vermont
The Shoppe at Wulfden
www.wulfden.org/TheShoppe/
While not the shortest program, the cog counters are are a separately programmed entity...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Hugh - the thinking woman's Geoffrey Pyke.
· Oops, I got confused with the RCSLOW which is 20KHz.
· My bad.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
·
Not least amout of code.
This is meant for newbies to get a glimps of the different languages.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
·
Usually XOR is used for toggling a bit.
In C it's:
while(1){
outa^=LED;
delay();
}
I have been away from Propeller for a year or two. I had forgotten one of is greatest strength's ... THIS FORUM! This kind of exercise helps not just newbies ... way to go, Bean!
That said, I recently downloaded Propeller Forth and plan to boot it up. Does anyone out there know enough about PropForth to code a BlinkLED in Forth for us to see? I would love to see that.
cheers ... BBR
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
cheers ... brian riley, n1bq, underhill center, vermont
The Shoppe at Wulfden
www.wulfden.org/TheShoppe/
Here's one for Catalina:
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
SPIN
PROPASM
PropBASIC
C
but no more.
Is anyone running other languages on the Propeller chip?
There are some to choose from here:
http://forums.parallax.com/showthread.php?p=809630
humanoido
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
Context? Language? Man toggling light switch?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You only ever need two tools in life. If it moves and it shouldn't use Duct Tape. If it does not move and it should use WD40.
Andy
\ load PropForth.spin into eeprom and use teraterm 1 ms per char and 1 ms per line 38400 baud worked best for me
\ save as file and "send file" in teraterm
\ unmodified demo board
\ sorry but I didn't get the parenthesis comments to work so the
\ stack notes are at the end of each line (it looks funny to me, too)
\ I always put in too many comments, force of habit [noparse]:)[/noparse]
\
\ each unit of functionality is implemented as a single word
\ when each word is functioning correctly, string them together
variable w-delay \ ( uses w@ w! time delay in milliseconds )
: !DELAY w-delay w! ; \ ( ms - ) ( store the milliseconds to wait )
: .DELAY w-delay w@ del_ms ; \ ( - ) ( wait for milliseconds in delay )
: pin16-output 10000 dira ! ; \ ( - ) ( make pin16 output )
: pin16-hi 10000 outa ! ; \ ( - ) ( make pin16 high LED ON )
: pin16-lo 0 outa ! ; \ ( - ) ( make pin16 low LED OFF )
\ ... string them together...
: flash16 pin16-hi .DELAY pin16-lo .DELAY ; \ ( - ) ( flash LED using DELAY )
\ ... and put it in a loop
: FLASHES pin16-output 0 do flash16 loop ; \ ( number of flashes desired - )
\ After one has determined what code is needed, it is possible to
\ cram everything into a single word
\ doing everything all in one word is sometimes refered to as
\ write only code (write once - edit never again )
\ this takes slightly less space but can be confusing on larger applications
\ after the code has been left alone for a few days
: ALL-ONE-WORD \ ( flashes - )
10000 dira ! \ ( make pin16 output )
0 do \ flashes to 0 DO ...
10000 outa ! \ ( make pin16 high LED ON )
100 del_ms \ ( delay for 100 ms)
0 outa ! \ ( make pin16 low LED OFF )
100 del_ms
loop ;
10 ALL-ONE-WORD
\ next use the other method
50 !DELAY
20 FLASHES
so where do we find PROPFORTH 2.5?
cheers ... BBR
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
cheers ... brian riley, n1bq, underhill center, vermont
The Shoppe at Wulfden
www.wulfden.org/TheShoppe/
www.wulfden.org/TheShoppe/prop/ - Propeller Products
www.wulfden.org/TheShoppe/k107/ - Serial LCD Display Gear
· I see you went with "machine code" instead of the more familiar "assembly code".
· That brings back memories of my Timex Sinclair 1000 writing assembly programs and converting them to hex for input into the machine.
· Oh, yeah. Fun days...Fun days.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Are you Propeller Powered? PropellerPowered.com
Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
Been there, too. I taught myself to program with my TS-1000. Even when I "upgraded" to a Commodore 64 I still used the TS-1000 and I'm regretting not bringing it with me when I moved back home from Texas.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
(For the upcoming S2 robot.)
-Phil
Are there any releasable details on the S2 robot yet?
Would be interesting to hear about if possible. I suppose it will do more than S1 scribbler.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
A little bit of info here:
·http://forums.parallax.com/showthread.php?p=899204
Jim
Blink......Blink
http://code.google.com/p/propforth/wiki/PropForth
NOTE: propforth.spin will load onto your demo board, but the rest of the files listed may have problems.
The instructions to recreate the kernel from source, to load source, and to save a new forth image do not work as presented in the instructions. At least that is what I experienced. I am guessing that the author has some pre-conditions that are not mentioned in the instructions, otherwise the version posted might just be buggy. He seems to think it works just fine as is, but my results are pretty much the same as listed in the ISSUES page.
I'm not really an assembler guy, so its taking me a long to time to figure out what is causing the problem. But its still kind of cool.
Wow! S2 looks like it will be many times better than S1. Lots to digest about S2.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko