Shop OBEX P1 Docs P2 Docs Learn Events
C to Spin — Parallax Forums

C to Spin

ASAS Posts: 149
edited 2013-04-10 16:55 in Propeller 1
Hello everyone!

I have a very simple question:

It´s possible creat Spin code from C, instead of compile directly to the Propeller?

Thanks!
AS

Comments

  • LeonLeon Posts: 7,620
    edited 2013-04-09 10:34
  • dgatelydgately Posts: 1,630
    edited 2013-04-09 10:44
    AS wrote: »
    Hello everyone!

    I have a very simple question:

    It´s possible creat Spin code from C, instead of compile directly to the Propeller?

    Thanks!
    AS

    You can take a look at: http://forums.parallax.com/showthread.php/119342-CSPIN-A-C-to-Spin-Converter
  • RaymanRayman Posts: 14,665
    edited 2013-04-09 10:53
    I think rockiki posted a perl script once that did this too, at least for his "fsrw" program...
  • ASAS Posts: 149
    edited 2013-04-09 11:34
    Thanks you all very much!

    Leon: Very interesting, but is for compile from Spin to C. I will experiment it.

    Dgately: I think is this what i´m looking for. I will try it for sure.

    Rayman: How Rockiki do that with Dgately sugestion? I will try to find it.

    Just for you know what i´m trying to do: Use the Fuzzy logic write in C to Spin.
    See: http://www.zerokol.com/2012/09/arduinofuzzy-fuzzy-library-for-arduino.html

    Because I don´t see Fuzzy logic in OBEX.

    Thanks!!
  • SRLMSRLM Posts: 5,045
    edited 2013-04-09 11:51
    Rayman wrote: »
    I think rockiki posted a perl script once that did this too, at least for his "fsrw" program...

    I believe that script is the same one bundled with FSRW here: http://sourceforge.net/projects/fsrw/
  • Dave HeinDave Hein Posts: 6,347
    edited 2013-04-09 12:42
    You could also try CSPIN, which is a C-to-Spin converter that I wrote a while ago. It runs in a command-prompt window under Windows. It has some limitations, but it supports more of the C language than the FSRW converter does. The thread on CSPIN is at http://forums.parallax.com/showthread.php/119342-CSPIN-A-C-to-Spin-Converter?highlight=cspin . Get the latest zipfile that is posted at the end of the thread.
  • ASAS Posts: 149
    edited 2013-04-09 17:29
    Hello!

    Thanks for the help!

    SRLM: Thanks for the link.

    Dave Hein: Thanks a lot for your great work! I will try. What kind of limitations? Can you give me an idea?
  • ASAS Posts: 149
    edited 2013-04-09 18:13
    Sorry my ignorance!

    The files from Arduino are .ino How I should do with CSpin? I need .C

    Any sugestion?
  • Dave HeinDave Hein Posts: 6,347
    edited 2013-04-09 19:18
    I think it will be difficult to convert the Arduino code to Spin. Looking at the example code, it uses C++ statements that are beyond the capability of the FSRW and CSPIN converters. It also relies on the Arduino libraries, so you would have to convert some portion of the libraries as well. Instead of converting the code to Spin it would be easier to port the Arduino code to PropGCC C++ code. There has been some work done on porting the Arduino libraries to PropGCC, but I don't how much has been done on that.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-04-10 15:16
    Dave Hein wrote: »
    I think it will be difficult to convert the Arduino code to Spin. Looking at the example code, it uses C++ statements that are beyond the capability of the FSRW and CSPIN converters. It also relies on the Arduino libraries, so you would have to convert some portion of the libraries as well. Instead of converting the code to Spin it would be easier to port the Arduino code to PropGCC C++ code. There has been some work done on porting the Arduino libraries to PropGCC, but I don't how much has been done on that.
    Why would you want to convert Arduino code to Spin? You could just port it to the Propeller using PropGCC which supports C++ directly.
  • ASAS Posts: 149
    edited 2013-04-10 16:55
    Thanks a lot for the answers.

    There a lot god work done to arduino!

    with my ignorance, i´m trying understand, if some how it was possible: arduino-C to spin. I can use propeller with the arduino code instead have to do that objets in spin.

    At this moment I´m learning Fuzzy Logic, and i´m thinking, for machines i want a propeller because the 8 cogs, 1 cog for the fuzzy, at this point, 1 cog for serial conection to the PC and the others for other tasks.

    If i could do that, with some time, i can use the arduino code for 3D printer RepRap, for example!

    Sincerely i´m not a good programer in SPIN, but i prefer SPIN and the propeller of course (because the 8 cogs for machines).

    Dave Hein: Thanks! but with my knowledge i prefer do a simple aplication to the Fuzzy, i´m not sure if i can do it! because there aren´t a good object for Fuzzy, in SPIN.

    David Betz: Thanks! I try already to answer your question! At this point i understand better SPIN to propeller and now i need learn C++ to propeeler, I don´t think it is very dificult but where i can learn? like i learn in the books for the spin?
    My idea is remake the code from the arduino to the propeller!
    With propeller GCC I need learn about the cogs in C++ to propeller. (for example)

    any sugestions!

    thanks you all
Sign In or Register to comment.