PDA

View Full Version : Arduino to Propellor



skydve76
04-10-2012, 12:23 AM
Hello, i recently used an arduino nano to build my own gear/door sequencer for an rc jet. It used PWM output, and I read in PWM input from the Reciever from teh radio. It was a fun project and I had it done in a few hours. I have never used a PIC before but I have done a lot of low level programming on the PC so it was quite easy.

I recently got the Propellor Ed board at radio shack. I installed the C compiler. It looks like I am missing a few things compared to the arduino so can someone help me out?

I want to do PWM output, I did find the servo driver , are there any ways to do PWM in the hardware level instead of using the CPU?
I also would liek to use the sensors I have, they are all analog and either vary voltage or send pulses. I assume the pulse version can be used easily but what about the analog ones like my accelerometer? I did some reading on an ADC chip but wondered if there is a board that I cane get that allows me to use the sensors like the arduino. I guess what I am wanting to do is make the prop easy to use liek the arduino in terms of senors. ANy suggesions? Also any C cod eyou can give me for reading pins and analog sensors would be great! i will not be learning the spin language at this time. Got a pulsein function I can use?

Thanks!

JonnyMac
04-10-2012, 12:35 AM
are there any ways to do PWM in the hardware level instead of using the CPU?

Not for servo control. The counters can do PWM which works well for other processes, but need a code assist for servos.

Bear in mind the Arduino has been around seven or so years so it has a rich set of libraries. If you'll program the Propeller in Spin (similar enough to C to be easy) you'll have a large library of code at your disposal, including my servo driver. ;)
-- http://obex.parallax.com/objects/445/

Kye
04-10-2012, 02:07 PM
Parallax is still building up their C library for the propeller chip.

Please post about what you need in the Alpha testing sub forum. Or maybe one of the GCC builders will respond to this thread.

SPIN is like C without types... there's really not that much work to learn it. If you're good at C it will take you only a day or two to learn what to do in SPIN.

Thanks,

skydve76
04-13-2012, 07:32 AM
I've been reading up on the sin language. I've done a done of C, C++ and C#, all of which are similar languages, though there are some major differences. I have to disagree and say that SPIN is nothing like C at all. If anything, it is very similar to Pascal, crossed with BASIC. Its much closer to pascal, but the reason I say BASIC is the very high level stuff like

OBJ

led: "E555_LEDEngine.spin" 'Include LED methods object


And the fact there are no line terminators. I realized I need to get an ADC to use all the analog sensors out there, I wonder if the P8X32A I have has and ADC on some of the pins? I really love the prop chip but it seems the boards are missing quite a bit given the number of sensors out there. PWM I understand no hardware but no ADC is crazy. I'll have to have a 2nd board bigger than the prop board just to do ADC, would of been nice to have it built into the existing boards given its so common to use.

I'll probably mess around with SPIN. I downloaded Catalina but it looks like GCC is the way to go perhaps?

Kye
04-13-2012, 02:31 PM
I've been reading up on the sin language. I've done a done of C, C++ and C#, all of which are similar languages, though there are some major differences. I have to disagree and say that SPIN is nothing like C at all. If anything, it is very similar to Pascal, crossed with BASIC.

Okay, that's true, I agree.


And the fact there are no line terminators. I realized I need to get an ADC to use all the analog sensors out there, I wonder if the P8X32A I have has and ADC on some of the pins? I really love the prop chip but it seems the boards are missing quite a bit given the number of sensors out there. PWM I understand no hardware but no ADC is crazy. I'll have to have a 2nd board bigger than the prop board just to do ADC, would of been nice to have it built into the existing boards given its so common to use.

Yes, I dislike the lack of an ADC on boards also. However, I just add one if I need it. http://www.parallax.com/Store/Microcontrollers/PropellerComponents/tabid/785/CategoryID/87/List/0/SortField/0/Level/a/ProductID/573/Default.aspx. There's a SPIN driver for it. I think the lack of ADCs on many propeller boards reflects the fact that many people do not use their propeller chip to do anything needing an ADC. I have no facts to back up this statement. But, I've seen a lot of projects go by during my tenure here that do not use them.

You can also make a simple ADC... http://learn.parallax.com/node/263. I've used this in place of an ADC for simple circuits. It works very nicely and provides you with a very high resolution by using the counter modules to measure "on" and "off" times down to 12.5ns. Of course, nosie will be an issue.So, you'll want to filter returned values.

Have you looked through the OBEX: http://obex.parallax.com/. I suggest you browse it for code. There's a lot of good stuff there.

I would try out GCC. Its in beta phase or about to be in beta phase.

Good luck,

JonnyMac
04-13-2012, 08:53 PM
I understand no hardware but no ADC is crazy.

I will politely disagree with you. Most of my apps do not require an ADC, so why burden the chip with them. When I need an ADC for a design, I select a part that works within the requirements of the project (channels and resolution). The Propeller is really a more pure processor in that regard. If you're stuck on trying to compare the Propeller to the Atmel chip you'll just be stuck.


GCC is the way to go perhaps?

I'm not much of a C guy but installing the SimpleIDE setup from Steve is as easy as installing the Arduino IDE and it's a really nice little tool that seems give full access to PropGCC features.