Go Down

Topic: Writing Code in the Arduino IDE, need help porting to C (Read 2102 times) previous topic - next topic

funkyguy4000

so say I wanted to include tlc_fades.h from the TLC5940 Library from the arduino platform, I could just boom boom copy paste?
Accelerate to 88 miles per hour.

dxw00d

You could try, but I doubt it would work. The line ...

Code: [Select]
#include <avr/interrupt.h>


certainly wouldn't work.

I don't understand why you are asking Arduino users how to port a library to another architecture. You should be asking other MSP430 users if they have a library that does what you want.

funkyguy4000

Well the code is written for the arduino.  Was thinking that maybe i could get something out of asking people here because they would understand how the library is written and why its written that so that i could decipher the arduino library and maybe be able to piece together what i need for the other platform b/c i don't know what the library for the arduino consists of right now.
Accelerate to 88 miles per hour.

AWOL

Quote
i don't know what the library for the arduino consists of right now.

But you have the source
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

funkyguy4000

I have it but I don't understand it.

I don't get what all the #'s are for
What does #endif mean?

Is there a webpage that explains it all?
Accelerate to 88 miles per hour.

AWOL

If you don't understand basic preprocessor constructs, there is very little chance of you translating or porting these libraries.
Get hold of a copy of K&R.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

mromani

Quote
Is there a webpage that explains it all?


The title would be "C language in a web page". Not likely...

Nick Gammon

Google "TLC5940 MSP430". There are about 4000 matches. Follow them.

Quote
OOOOhhhkay so they have already done the conversion work it just doesn't seem to be in as nice a package as the library for the arduino.


I'm not sure what your motivation here is, apart from boredom maybe.

The MSP430 isn't a lot cheaper than the Atmega, for the simple reason that the Atmega itself only costs around $5 (and that is in single units of one of their more powerful processors). So the most you could save is $5.

The Atmega can run with very low power consumption, less than a battery loses a day anyway due to self-discharge.

And you admit that the Arduino has a "nice" package.

Quote
What does #endif mean?


You don't seem to be all that familiar with C programming.

So why do you want to do this? Is this a school project? Has the teacher told you to do it?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

mmcp42

is there the distinct whiff of troll around these parts?

been following the thread and it do seem so to me!
there are only 10 types of people
them that understands binary
and them that doesn't

Nick Gammon

Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

funkyguy4000

No i'm not trolling at all.

I'm a beginner to standalone microcontrollers and the launchpad was very friendly to beginners like me to microcontrollers.
I am not familiar with C, you are right.  My motivation is to make something sweet just like everybody else, but that shouldn't matter. I'm here cause i need help.
Accelerate to 88 miles per hour.

Nick Gammon

OK, great. We are all trying to help here.

But what I don't get is, you have a MSP430 launchpad, and you want to interface it to TLC5940, right?

Well why ask on the Arduino forum? That's like asking on an Apple web site how to get Windows to work.

We don't know the answer, and the people on the MSP430 forum probably will.

As for "how do I convert the Arduino libraries?", well I wouldn't personally want to convert them all to another platform. You would need very in-depth knowledge of how the Atmega works (at the hardware level) to understand a lot of what the libraries are doing, and also in-depth knowledge of how the MSP430 works as well.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

westfw

#27
Feb 01, 2012, 02:07 am Last Edit: Feb 01, 2012, 05:45 am by westfw Reason: 1
A couple of people (including myself) have done "some" work in porting the Arduino libraries to MSP430, back when there was so much excitement about the $5 LaunchPad that you could get (eventually.)  It turns out to be pretty difficult to get very far, because you run into serious limitations very quickly (The original Launchpad has 1/16th the memory of an Uno and is only capable of one hardware PWM output.)

Still, I created a deeply philosophical and wildly entertaining set of blog posts on the subject that I'm sure you'll find fascinating:  http://www.element14.com/community/people/WestfW/blog  :-;

funkyguy4000

Well it isnt that complicated of a program, All i need is the microcontroller to send the data the to TLC5940 PWM Driver.
Accelerate to 88 miles per hour.

mromani

According to this page

http://www.arduino.cc/playground/Learning/TLC5940

it's not exactly a trivial task to drive a tlc5940...

Go Up