Hi I'm new to the MC world. I have programmed in C, ObjC, Java, BASIC(+VB/REAL) and some php. Its been about 7 yrs since I last coded.(It was a hobby but I took a few university level classes...) At any rate I've been wanting to play with Arduino but money has been very very tight lately. I do plan to get a Uno R3 soon from eBay but today I picked up two Parallax Propellers on clearance from RadioShack @ $9.95ea. The 'SPIN' Language seems interesting and propeller chip seems very cool but the amount of begginer code seems thin compared to arduino... Especially if I want to do something like temp/moisture/humidity reading and water cntrl for a garden. Should I sell these or give'em a shot..... it is the dev brd w/ 8 rstv tch btns and 8 LEDS.....
Sorry for the brief post and inadequate example, I was busy doing Dad stuff at the time. I'd like to play with analog sensor I/O, especially with electronics recycled from old electronics, toys, computers and computer parts. I'm sure most of you here are Arduino fans and that's what I'd like to start with but should I keep one of the propellers considering the $9.95 price?
Boards (which one?), or chips?
Propellers are interesting chips, but pretty weird. Probably not for beginners, given the general difficulty of multi-core processing.
(I may have to visit my radioshack...)
Hey =) - I can't say anything about propellers since they are unknown to me but as an arduino beginner I must say that the ammount of help you can get on this platform is pretty amazing ... Take any module or component and there's a dozen tutorials for it, that's priceless..
I find the learning curve with electronics to be a complete bi**h since I'm starting from absolutely nothing (I keep on frying arduinos and transistors like there's no tomorrow - code is pretty easy and fun on the other hand) but at least with an arduino even though my budget is tight too (i'm a psychology student, miles away from electronics) I can afford my numerous mistakes - because if I fry a cheap "pro mini" It's only going to cost me around 1.5€ (to be fair I also fried a UNO that costed me 25€ to replace - it took a lot of abuse and survived before dying tho ... they are really well made lil' things, I just suck at electronics) and they are extremely good at what they do. Not sure if you can have the same level of "forgiveness" from propellers?
My fav cheapies so far:
http://www.aliexpress.com/item/10Pcs-Lot-Pro-Mini-Module-Atmega328-5V-16M-For-Arduino-Compatible-With-Nano/1432639609.html
Well all I can say is that I highly recommend buying an arduino UNO :3 (or even the starter kit if you can afford)
I do plan to get a Uno R3 soon from eBay but today I picked up two Parallax Propellers on clearance from RadioShack @ $9.95ea. The 'SPIN' Language seems interesting and propeller chip seems very cool but the amount of begginer code seems thin compared to arduino... Especially if I want to do something like temp/moisture/humidity reading and water cntrl for a garden. Should I sell these or give'em a shot..... it is the dev brd w/ 8 rstv tch btns and 8 LEDS.....
Seriously, SPIN is very powerful, but writing code for the multiple cores involves some serious understanding of program threading. Now, Parallax has done a fair job at managing the complexities. But, it is certainly not Arduino!
''*****************************************************
''* MCP3202 12-bit/2-channel ADC Driver v1.0 *
''* also provides up to two 32-bit sigma-delta DACs *
''* Author: Chip Gracey *
''* Copyright (c) 2009 Parallax, Inc. *
''* See end of file for terms of use. *
''*****************************************************
'' Revised by John Abshier (jabshier on Fourm) 23 Aug 2012
'' Added 5th parameter DACpins and moved dacmode into DACpins instead of count
'' Kuroneko added code to prevent startx from returning until initialization is complete
VAR
long cog
long ins '5 contiguous longs (2 words + 1 long + 2 longs + 1 long)
long count
long dacx, dacy
long DACpins
PUB start(dpin, cpin, spin, mode) : okay
'' Start driver - starts a cog
'' returns false if no cog available
'' may be called again to change settings
''
'' dpin = pin connected to both DIN and DOUT on MCP3202
'' cpin = pin connected to CLK on MCP3202
'' spin = pin connected to CS on MCP3202
'' mode = channel enables in bits 0..1, diff mode enables in bits 2..3
return startx(@dpin, 1)
PUB start1(dpin, cpin, spin, mode, xpin) : okay
'' Like start, but sets up 1 extra pin as a 32-bit sigma-delta DAC
''
'' xpin = pin connected to RC filter for 'x' DAC
''
'' R and C values can be 1K and .1uF
return startx(@dpin, xpin & $1F | $80)
PUB start2(dpin, cpin, spin, mode, xpin, ypin) : okay
'' Like start, but sets up 2 extra pins as 32-bit sigma-delta DACs
''
'' xpin = pin connected to RC filter for 'x' DAC
'' ypin = pin connected to RC filter for 'y' DAC
''
'' R and C values can be 1K and .1uF
return startx(@dpin, (ypin & $1F | $80) << 8 + xpin & $1F | $80)
PRI startx(ptr, dacmode) : okay
stop
longmove(@ins, ptr, 4)
DACpins := dacmode
if cog := cognew(@entry, @ins) + 1
repeat while DACpins ' wait for cog to run initialization code
return cog
PUB stop
'' Stop driver - frees a cog
if cog
cogstop(cog~ - 1)
PUB in(channel) : sample
'' Read the current sample from an ADC channel (0..1)
return ins.word[channel]
PUB average(channel, n) : sample | c
'' Average n samples from an ADC channel (0..1)
c := count
repeat n
repeat while c == count
sample += ins.word[channel]
c++
sample /= n
PUB out(x, y)
'' Update DACs with 32-bit values
dacx := x
dacy := y
PUB outPercent(x, y)
'' Update DACs with 32-bit values
'' Inputs are percent high time 0 to 100
x := 0 #> x <# 100 ' limit to 0 to 100 percent
y := 0 #> y <# 100
dacx := x * 42_949_672
dacy := y * 42_949_672
DAT
'************************************
'* Assembly language MCP3202 driver *
'************************************
org
'
'
' Entry
'
entry mov t1,par 'read parameters
call #param 'setup DIN/DOUT pin
mov dmask,t2
call #param 'setup CLK pin
mov cmask,t2
call #param 'setup CS pin
mov smask,t2
call #param 'set mode
mov enables,t3
call #param 'setup DAC configuration
if_c or dira,t2
if_c movs ctra,t3
if_c movi ctra,#%00110_000
shr t3,#8
call #param2
if_c or dira,t2
if_c movs ctrb,t3
if_c movi ctrb,#%00110_000
'
'
' Perform conversions continuously
'
or dira,cmask 'output CLK
or dira,smask 'output CS
main_loop mov command,#%1001 'init command (start + msbf)
mov t1,par 'reset sample pointer
mov t2,enables 'get enables
mov t3,#2 'ready 2 channels
cloop shr t2,#1 wc 'if channel disabled, skip
if_nc jmp #skip
test t2,#2 wc 'channel enabled, get single/diff mode
muxnc command,#%0100
mov stream,command
or outa,smask 'CS high
or dira,dmask 'make DIN/DOUT output
mov bits,#18 'ready 18 bits (cs+1+diff+ch+1+0+data[12])
bloop test stream,#%10000 wc 'update DIN/DOUT
muxc outa,dmask
cmp bits,#13 wz 'if command done, input DIN/DOUT
if_z andn dira,dmask
andn outa,cmask 'CLK low
mov t4,par 'update DACs between clock transitions
add t4,#8
rdlong frqa,t4
add t4,#4
rdlong frqb,t4
or outa,cmask 'CLK high
test dmask,ina wc 'sample DIN/DOUT
rcl stream,#1
andn outa,smask 'CS low
djnz bits,#bloop 'next data bit
and stream,mask12 'trim and write sample
wrword stream,t1
skip add t1,#2 'advance sample pointer
or command,#%0010 'advance command
djnz t3,#cloop 'more channels?
wrlong counter,t1 'channels done, update counter
add counter,#1
jmp #main_loop 'perform conversions again
'
'
' Get parameter
'
param rdlong t3,t1 'get parameter into t3
wrlong par,t1 'acknowledge parameter
add t1,#4 'point to next parameter
param2 mov t2,#1 'make pin mask in t2
shl t2,t3
test t3,#$80 wc 'get DAC flag into c
param2_ret
param_ret ret
'
'
' Initialized data
'
mask12 long $FFF
'
'
' Uninitialized data
'
t1 res 1
t2 res 1
t3 res 1
t4 res 1
dmask res 1
cmask res 1
smask res 1
enables res 1
command res 1
stream res 1
bits res 1
counter res 1
westfw:
Boards (which one?), or chips?
Propellers are interesting chips, but pretty weird. Probably not for beginners, given the general difficulty of multi-core processing.
(I may have to visit my radioshack...)
The P8X32A QuickStart board... Their weirdness is what drew me to them(the low price did help though!) I like the idea of multiple simultaneous threads but there doesn't appear to be anywhere as much sample code by comparison...
mrburnette:
I do plan to get a Uno R3 soon from eBay but today I picked up two Parallax Propellers on clearance from RadioShack @ $9.95ea. The 'SPIN' Language seems interesting and propeller chip seems very cool but the amount of begginer code seems thin compared to arduino... Especially if I want to do something like temp/moisture/humidity reading and water cntrl for a garden. Should I sell these or give'em a shot..... it is the dev brd w/ 8 rstv tch btns and 8 LEDS.....
Seriously, SPIN is very powerful, but writing code for the multiple cores involves some serious understanding of program threading. Now, Parallax has done a fair job at managing the complexities. But, it is certainly not Arduino!
''*****************************************************
''* MCP3202 12-bit/2-channel ADC Driver v1.0 *
''* also provides up to two 32-bit sigma-delta DACs *
''* Author: Chip Gracey *
''* Copyright (c) 2009 Parallax, Inc. *
''* See end of file for terms of use. *
''*****************************************************
'' Revised by John Abshier (jabshier on Fourm) 23 Aug 2012
'' Added 5th parameter DACpins and moved dacmode into DACpins instead of count
'' Kuroneko added code to prevent startx from returning until initialization is complete
VAR
long cog
long ins '5 contiguous longs (2 words + 1 long + 2 longs + 1 long)
long count
long dacx, dacy
long DACpins
PUB start(dpin, cpin, spin, mode) : okay
'' Start driver - starts a cog
'' returns false if no cog available
'' may be called again to change settings
''
'' dpin = pin connected to both DIN and DOUT on MCP3202
'' cpin = pin connected to CLK on MCP3202
'' spin = pin connected to CS on MCP3202
'' mode = channel enables in bits 0..1, diff mode enables in bits 2..3
return startx(@dpin, 1)
PUB start1(dpin, cpin, spin, mode, xpin) : okay
'' Like start, but sets up 1 extra pin as a 32-bit sigma-delta DAC
''
'' xpin = pin connected to RC filter for 'x' DAC
''
'' R and C values can be 1K and .1uF
return startx(@dpin, xpin & $1F | $80)
PUB start2(dpin, cpin, spin, mode, xpin, ypin) : okay
'' Like start, but sets up 2 extra pins as 32-bit sigma-delta DACs
''
'' xpin = pin connected to RC filter for 'x' DAC
'' ypin = pin connected to RC filter for 'y' DAC
''
'' R and C values can be 1K and .1uF
return startx(@dpin, (ypin & $1F | $80) << 8 + xpin & $1F | $80)
PRI startx(ptr, dacmode) : okay
stop
longmove(@ins, ptr, 4)
DACpins := dacmode
if cog := cognew(@entry, @ins) + 1
repeat while DACpins ' wait for cog to run initialization code
return cog
PUB stop
'' Stop driver - frees a cog
if cog
cogstop(cog~ - 1)
PUB in(channel) : sample
'' Read the current sample from an ADC channel (0..1)
return ins.word[channel]
PUB average(channel, n) : sample | c
'' Average n samples from an ADC channel (0..1)
c := count
repeat n
repeat while c == count
sample += ins.word[channel]
c++
sample /= n
PUB out(x, y)
'' Update DACs with 32-bit values
dacx := x
dacy := y
PUB outPercent(x, y)
'' Update DACs with 32-bit values
'' Inputs are percent high time 0 to 100
x := 0 #> x <# 100 ' limit to 0 to 100 percent
y := 0 #> y <# 100
dacx := x * 42_949_672
dacy := y * 42_949_672
DAT
'************************************
'* Assembly language MCP3202 driver *
'************************************
org
'
'
' Entry
'
entry mov t1,par 'read parameters
call #param 'setup DIN/DOUT pin
mov dmask,t2
call #param 'setup CLK pin
mov cmask,t2
call #param 'setup CS pin
mov smask,t2
call #param 'set mode
mov enables,t3
call #param 'setup DAC configuration
if_c or dira,t2
if_c movs ctra,t3
if_c movi ctra,#%00110_000
shr t3,#8
call #param2
if_c or dira,t2
if_c movs ctrb,t3
if_c movi ctrb,#%00110_000
'
'
' Perform conversions continuously
'
or dira,cmask 'output CLK
or dira,smask 'output CS
main_loop mov command,#%1001 'init command (start + msbf)
mov t1,par 'reset sample pointer
mov t2,enables 'get enables
mov t3,#2 'ready 2 channels
cloop shr t2,#1 wc 'if channel disabled, skip
if_nc jmp #skip
test t2,#2 wc 'channel enabled, get single/diff mode
muxnc command,#%0100
mov stream,command
or outa,smask 'CS high
or dira,dmask 'make DIN/DOUT output
mov bits,#18 'ready 18 bits (cs+1+diff+ch+1+0+data[12])
bloop test stream,#%10000 wc 'update DIN/DOUT
muxc outa,dmask
cmp bits,#13 wz 'if command done, input DIN/DOUT
if_z andn dira,dmask
andn outa,cmask 'CLK low
mov t4,par 'update DACs between clock transitions
add t4,#8
rdlong frqa,t4
add t4,#4
rdlong frqb,t4
or outa,cmask 'CLK high
test dmask,ina wc 'sample DIN/DOUT
rcl stream,#1
andn outa,smask 'CS low
djnz bits,#bloop 'next data bit
and stream,mask12 'trim and write sample
wrword stream,t1
skip add t1,#2 'advance sample pointer
or command,#%0010 'advance command
djnz t3,#cloop 'more channels?
wrlong counter,t1 'channels done, update counter
add counter,#1
jmp #main_loop 'perform conversions again
'
'
' Get parameter
'
param rdlong t3,t1 'get parameter into t3
wrlong par,t1 'acknowledge parameter
add t1,#4 'point to next parameter
param2 mov t2,#1 'make pin mask in t2
shl t2,t3
test t3,#$80 wc 'get DAC flag into c
param2_ret
param_ret ret
'
'
' Initialized data
'
mask12 long $FFF
'
'
' Uninitialized data
'
t1 res 1
t2 res 1
t3 res 1
t4 res 1
dmask res 1
cmask res 1
smask res 1
enables res 1
command res 1
stream res 1
bits res 1
counter res 1
That's what I figured... maybe I'll hang onto one for the future. SPIN doesn't seem too difficult once I get back into the groove of things, but as I said its been a while. On another note I've read that 12Block is a really easy beginners tool. Also I've read a little bit about Catalina and a GCC tool chain for the prop...
pixelsafoison:
Hey =) - I can't say anything about propellers since they are unknown to me but as an arduino beginner I must say that the ammount of help you can get on this platform is pretty amazing ... Take any module or component and there's a dozen tutorials for it, that's priceless..I find the learning curve with electronics to be a complete bi**h since I'm starting from absolutely nothing (I keep on frying arduinos and transistors like there's no tomorrow - code is pretty easy and fun on the other hand) but at least with an arduino even though my budget is tight too (i'm a psychology student, miles away from electronics) I can afford my numerous mistakes - because if I fry a cheap "pro mini" It's only going to cost me around 1.5€ (to be fair I also fried a UNO that costed me 25€ to replace - it took a lot of abuse and survived before dying tho ... they are really well made lil' things, I just suck at electronics) and they are extremely good at what they do. Not sure if you can have the same level of "forgiveness" from propellers?
My fav cheapies so far:
http://www.aliexpress.com/item/10Pcs-Lot-Pro-Mini-Module-Atmega328-5V-16M-For-Arduino-Compatible-With-Nano/1432639609.htmlWell all I can say is that I highly recommend buying an arduino UNO :3 (or even the starter kit if you can afford)
Thanks for the reply. I'll probably be getting one of the starter kits on eBay so I have some sensors and input devices to play with. Also, thanks for the link. I'll check it out. Good luck not killing your electronics BTW!
In short, you do not want only one of whatever device you have (and for that matter, not just two), so unless you can sell both to someone who seriously needs them, keep them but they are seriously high-performance devices suited to more complex tasks. For simple experimentation with sensors and such, the Arduino (Pro Mini/ Micro/ UNO) is more suitable.
The Propellers are useful for things such as Web servers - which you could do with a UNO - "sort of". And the important thing is of course, that you have them on a board, as the chip on its own is not very easy to use.
Paul - thanks for the reply. As I've been doing some more research I've been able to find some very interesting projects on DangerousPrototypes(.com). One of which is a light implementation of the Arduino SDK(From what I gather an Object for the Propeller IDE that allows for Arduino-like syntax for basic I/O tasks) as well as a number of other interesting projects and references. I [should] probably start with Arduino, as I had planned to but I don't have an Arduino. I have 2 Propellers. I've also seen some interesting stuff about interfacing Arduino with Propeller. The cool thing about the QuickStart board is that their are 8 resistive buttons and 8 LEDs but also access to all 32 pins. I guess I'll give the propeller a shot, if it proves too complicated I can always get an Arduino and hang onto it for later.