Shop OBEX P1 Docs P2 Docs Learn Events
Can SX be program in C? — Parallax Forums

Can SX be program in C?

robotoroboto Posts: 7
edited 2007-02-11 17:04 in General Discussion
I recently purchase an SX48 protoboard+blitz, can it be programmed in C?

Also, are there any good tutorials in programming with Basic? So far I've downloaded some PDFs from Parallax's website, but they focus heavily on assembly.

Thanks

Comments

  • CPUMANCPUMAN Posts: 55
    edited 2006-06-09 04:47
    Yes it can but not right now.· There are some C compilers for the SX out there but they are generaly not that good.·But there is hope Parallax is working with another company on developing a high quality C compiler that will cost about $99. It's release shouldn't be to far off although they, as far as I know, haven't set an offical date for it's release yet.

    Check this thread http://forums.parallax.com/showthread.php?p=582345·it's sort of been the unoffical status thread.

    Post Edited (CPUMAN) : 6/9/2006 4:50:53 AM GMT
  • BeanBean Posts: 8,129
    edited 2006-06-09 10:16
    For BASIC programming look under HELP->SX/B HELP
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
  • robotoroboto Posts: 7
    edited 2006-06-10 21:27
    The "HELP" menu isn't very helpful. Is there anything better than that?
    Thanks
  • RsadeikaRsadeika Posts: 3,824
    edited 2006-06-10 21:31
    Nope, you will have to fend for yourself.
  • BeanBean Posts: 8,129
    edited 2006-06-11 00:04
    This forum is your best source for SX/B information.

    I can't speak for Parallax, but with a new version of SX/B coming out. Any print documentation that they would have produced would now be obsolete.
    It has been a while since the last update, so it seems that the compiler is matureing. I've heard of a book or two "in the works", maybe this next release will spur them on.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-06-12 22:37
    The SX/B help file not only has an explination of each of the instructions, but it also contains schematics and examples of application as well....

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • John R.John R. Posts: 1,376
    edited 2006-06-23 22:14
    Hey Ryan and the team;

    I see on the new intro pages "C" is shown as an option for the SX series, but I couldn't find the C compiler. Do I assume that marketing jumped the gun on the intro pages, or is release imminent?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
  • Ken GraceyKen Gracey Posts: 7,386
    edited 2006-06-26 03:32
    Hi John R.:

    Yes, something like that. We recently updated our "Getting Started" page which included the forthcoming mention of the SX/C compiler from CCS. At the moment, Peter is working on yet another integration detail which CCS just assisted to resolve.

    Ken Gracey
    Parallax, Inc.
  • John R.John R. Posts: 1,376
    edited 2006-06-26 21:48
    Thanks for the update, just wanted to make sure I didn't miss something.

    Are we all having fun yet???

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
  • Rob v.d. bergRob v.d. berg Posts: 81
    edited 2007-01-24 20:03
    Hello Ken,

    Is there·any progress·in the realisation of the sx/c compiler? Can you give some information about·actual·actions/staps.

    regards Rob.
  • Ken GraceyKen Gracey Posts: 7,386
    edited 2007-01-25 04:03
    Hi Rob,

    It's still in an alpha test. The integration with the SX-Key IDE is mostly functional, but the users have pointed out several significant issues that CCS will need to fix before it can come near our customers. This could be a while and the schedule is up to CCS at this point.

    I can admit you to the beta test forum for the SX/C compiler if you are interested in seeing the actual discussion.

    Sincerely,

    Ken Gracey
    Parallax, Inc.
  • Rob v.d. bergRob v.d. berg Posts: 81
    edited 2007-01-25 14:21
    Hi Ken,

    Thanks for your reply. Please add me to the discussion list.

    regards,

    Rob.
  • thoseythosey Posts: 7
    edited 2007-02-07 23:03
    I have used the picant or now sourceboost compiler called c2c for a few years.
    http://www.sourceboost.com/Products/C2C-plus/Overview.html
    It has support for the sxblitz built in and works with all the sx chips.
    Cost $70
    I upgraded to the BoostC wich is an ANSI compiler for C and will be looking to see if I can get it to work with the SX chips.
    I don't see why not since the SX is Pic chip compatible drop in replacement. Plus they have a great forum and plenty of example code. Also works with the PIC chips so you don't need two diffrent compilers.
    Better than CCS, and HI-Tech in my opinion.
  • Mr_NukeMr_Nuke Posts: 47
    edited 2007-02-08 03:19
    You could try SourceBoost C2C++. It is no longer supported, and you need to copy the generated assembly code in the SX-Key editor to run it (you need to use the old assembler), but it comes in pretty handy sometimes. Also, it allows you to mix C and assembly code. I'm not sure if it supports bit fields, but you could easily get around that with inline·assembly code.

    http://www.sourceboost.com/Products/C2C-pp/Overview.html

    Hope this helps,
    Alex.

    EDIT: Sorry thosey, I didn't see your post. Didn't mean to repeat the same info.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fear not that your project does not work, for it will,

    Fear not if you see·a long dark path ahead, but follow it,
    Fear not if what worked now refuses to,
    For the only thing that's perfect is imperfection.
  • Bill HenningBill Henning Posts: 6,445
    edited 2007-02-08 05:53
    If I were you... I'd use SX/B

    And this comes from someone who has been programming in C for over 25 years.

    Why?

    Because the SX's architecture is NOT condusive to C, and the ram is far too limited for the C compiler to do anything interesting.

    To get the most out of SX's you have to learn their bizzare architecture - now all you SX defenders, before you jump on me, I just bought a pile of SX gear because even with the "interesting" architecture it MOST definitely has its uses due to its speed!

    I mean for some projects... why would I use a Propeller ($12.95) when an SX28 ($2.79) will do the job???

    A couple of the projects I am (slowly) working on use both an SX and a Propeller!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.mikronauts.com - a new blog about microcontrollers
  • Mr_NukeMr_Nuke Posts: 47
    edited 2007-02-08 20:24
    Bill,

    Although most C compilers will generate obscenely inefficient code for the sake of simplicity and reusability, C2C -plus or C2C++ are two excellent compilers for the·SX chip (I prefer the latter). Of course, these compilers have their limitations because of the program memory·and·RAM constraints of the SX. For eaxample, a class (in C2C++) cannot hold more than 16 bytes, which is the size of a memory bank in the SX.

    To unleash the real power of SX with C2C, it is helpful to use inline assembly code in time critical tasks, but one advantage prevails: you can take the compiled assembly code, and further optimize it.
    The results would definitely be better than using SX/B, and·more efficient code can be generated faster.

    Sincerely,
    Alex.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fear not that your project does not work, for it will,

    Fear not if you see·a long dark path ahead, but follow it,
    Fear not if what worked now refuses to,
    For the only thing that's perfect is imperfection.
  • BeanBean Posts: 8,129
    edited 2007-02-08 21:54
    Of course this is also true:

    To unleash the real power of SX with SX/B, it is helpful to use inline assembly code in time critical tasks, but one advantage prevails: you can take the compiled assembly code, and further optimize it.
    The results would definitely be better than using C2C, and more efficient code can be generated faster.

    [noparse];)[/noparse]

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
  • JonnyMacJonnyMac Posts: 8,942
    edited 2007-02-08 23:01
    See my Servo VP thread in this forum for an example of what Bean is talking about: I wrote the original VP in straight SX/B, then took the assembly output and optimized it for the final version.
  • dkemppaidkemppai Posts: 315
    edited 2007-02-09 00:40
    Bean (Hitt Consulting) said...
    Of course this is also true:

    To unleash the real power of SX with SX/B, it is helpful to use inline assembly code in time critical tasks, but one advantage prevails: you can take the compiled assembly code, and further optimize it.
    The results would definitely be better than using C2C, and more efficient code can be generated faster.

    [noparse];)[/noparse]

    Bean

    Of course if you write the time critical tasks in assembly to start with you probably won't have to optimize it at all...· ...this is my personal favorite.· [noparse]:)[/noparse]

    That being said I really don't like doing multi-byte math in assembly, and there's where the C would be nicer than SX/B and assembly...·· ...slow but nicer.

    -Dan· (currently moving 4mbit/S data manchester encoded from on SX to another through·thin air...· ...the SX is a powerful little critter)


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    "A saint-like quantity of patience is a help, if this is unavailable, a salty vocabulary works nearly as well." - A. S. Weaver
  • Bill HenningBill Henning Posts: 6,445
    edited 2007-02-09 06:29
    Hi Alex,

    I'll check out those compilers, but frankly my interest in the SX is limited to using it as a VERY high speed I/O coprocessor for propellers (and possibly other architectures) - I would not even attempt to write anything significant for it, it is too resource constrained, and all the BANK / PAGE / MODE hacks make me cringe.

    On the other hand, I LOVE the speed of it, even though I have to watch out for pipelining effects on read/modify/write instructions.

    So far, other than a bit of experimenting with SX/B, everything I've written for the SX has been very tight assembly code, counting every cycle [noparse]:)[/noparse]

    The prop on the other hand... I can't stop thinking of neat projects for it! VERY unique architecture.
    Mr_Nuke said...
    Bill,

    Although most C compilers will generate obscenely inefficient code for the sake of simplicity and reusability, C2C -plus or C2C++ are two excellent compilers for the·SX chip (I prefer the latter). Of course, these compilers have their limitations because of the program memory·and·RAM constraints of the SX. For eaxample, a class (in C2C++) cannot hold more than 16 bytes, which is the size of a memory bank in the SX.

    To unleash the real power of SX with C2C, it is helpful to use inline assembly code in time critical tasks, but one advantage prevails: you can take the compiled assembly code, and further optimize it.
    The results would definitely be better than using SX/B, and·more efficient code can be generated faster.

    Sincerely,
    Alex.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.mikronauts.com - a new blog about microcontrollers
  • Mr_NukeMr_Nuke Posts: 47
    edited 2007-02-09 20:43
    Bean (Hitt Consulting) said...

    The results would definitely be better than using C2C, and more efficient code can be generated faster.

    Bean

    Definitely not true. I will not start a sensless debate on something obvious.
    Bill Henning said...


    I'll check out those compilers,
    Great, I'm sure you will find the solution that best suits your needs without much trouble.
    C2C has a 30-day trial period, so you can go start by downloading Source Boost (C2C, and C2C++ are included).

    Sincerely,
    Alex

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fear not that your project does not work, for it will,

    Fear not if you see·a long dark path ahead, but follow it,
    Fear not if what worked now refuses to,
    For the only thing that's perfect is imperfection.
  • James NewtonJames Newton Posts: 329
    edited 2007-02-09 21:21
    I would dearly love to see a thread exclusively set up as a competition / comparison between SX/A (sasm), SX/B, and some SX/C (C2C or BKND C1b or whatever) where some common programming problem is presented (perhaps in pseudo code) and the best solutions in each language are presented along with the resulting code size and variable useage.

    Would anyone else be interested?

    If I were to start a new thread with such a challenge, would someone with each of the languages do the code and present the findings?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    James Newton, Host of SXList.com
    james at sxlist,com 1-619-652-0593 fax:1-208-279-8767
    SX FAQ / Code / Tutorials / Documentation:
    http://www.sxlist.com Pick faster!



  • JonnyMacJonnyMac Posts: 8,942
    edited 2007-02-09 21:32
    James,

    I'd love to contribute SX/B code for that comparison if one is setup. Not so that I can say SX/B is better or worse than anything else (a tool is a tool), but so that newbies to SX/B can see an approach to a problem, and compare it to solutions offered by other tools.
  • BeanBean Posts: 8,129
    edited 2007-02-09 21:38
    Mr_Nuke said...
    Bean (Hitt Consulting) said...

    The results would definitely be better than using C2C, and more efficient code can be generated faster.

    Bean

    Definitely not true. I will not start a sensless debate on something obvious.
    I was simply trying to make the point that if you tweak the assembly output from ANY compiler it's going to be more effecient than the output of ANY other compiler.


    James, sounds interesting. I'd like to contribute assembly and/or SX/B.

    Bean.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman

    Post Edited (Bean (Hitt Consulting)) : 2/9/2007 9:43:14 PM GMT
  • pjvpjv Posts: 1,903
    edited 2007-02-10 00:06
    Hi James;

    As assembly is all that I know, I'd love to have a go at that.

    Cheers,

    Peter (pjv)
  • Mr_NukeMr_Nuke Posts: 47
    edited 2007-02-11 17:04
    Great James,

    Assembly and C sounds great. Most microcontrollers in this world are programmed in C.

    Alex.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fear not that your project does not work, for it will,

    Fear not if you see·a long dark path ahead, but follow it,
    Fear not if what worked now refuses to,
    For the only thing that's perfect is imperfection.
Sign In or Register to comment.