Shop OBEX P1 Docs P2 Docs Learn Events
any good propeller tutorials for the c programmer? — Parallax Forums

any good propeller tutorials for the c programmer?

rwgast_logicdesignrwgast_logicdesign Posts: 1,464
edited 2012-06-19 04:59 in Propeller 1
im sorry if this has been asked 100xs but for some reason i just found this board. i usually view the forums on my phome and it never shows up, was just on my pc and noticed it.

is there a resource to help people who already know c but dont know anything about programming a prop or a micro in general. ive been slow goimg to acually writing prop code becuase i havent put the effort in to learn spin. there is something about spin i jist dont like. im getting some sram and am eager to start writing drivers for it. the whole reason i wanted to get into micros was to help me get a grip on hardware programming without the bloat of the pc to interfere. i really wanted to force myself to learn spin but i just feel its so useless even on the prop its slow. if someome has done some kind of c tutorials for micro/hardware/electronics newbs that would be awesome.

Comments

  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-06-05 01:39
    I forgot to mention I've seen the toggle tutorials, wondering if there's anything else.
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-06-05 02:47
    Hi,

    I wrote the Toggle Tutorials, did they help?

    I'm currently working on more programs and tutorials to explain more of the concepts unique to using the Propeller with PropGCC. Is there anything in particular you were looking for? Some of it can be found in demos or in examples provided in the threads of this section of the forum.

    If there is something in particular you would like to do, please ask. Your question will get answered and it will provide real world feedback of what kinds of information we need to include in additional tutorials.
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-06-05 02:51
    You actually fit well into one of our target groups picking up PropGCC. The "I know C but don't know Propellers." people. You probably want to start Cogs, use the memory efficiently, interface to devices, use OBEX objects with C...what else?
  • jazzedjazzed Posts: 11,803
    edited 2012-06-05 10:21
    The best we have to offer besides "The Toggle Tutorials" today is the demo package.

    @mindrobots is extending the toggle tutorials to include some common multi-cog features as well as more advanced offerings.

    We are working on a PropellerGCC Beta web site at propellergcc.parallax.com it is very preliminary.
    The propgcc.googlecode.com has a wiki with more programming info - parts of that is slowly going away.
  • pedwardpedward Posts: 1,642
    edited 2012-06-05 11:55
    To elaborate on Steve's "demo package", the SimpleIDE package comes with a bunch of demo code to peruse. It's in the demo directory, which I think is installed in your Documents directory.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-06-05 14:56
    Ok heres the deal i just found the tovgle tutorials last night and read a few pages into it so im not sure what it goes over and doesnt yet. im looking at this as someone new to programming micros not just the propeller. For example i would like to see stuff about pwms how to code them what there uzes are. id like to see some really in depth tutorial about working with timers whi h i guess fits with pwms too. im curious a out how to code the built in adc/dac. as u stated above implementing obex objects is very important.

    I recently ordered some avr chips and a cheap programmer. i did this for two reasons #1 two be proficent with a smaller micro and #2 which is important to this thread. ive spent the last few months building boards making add ons to my prop like an rtc some ram sd vga lcds etc etc. i now want to know how to use that hardware without downloading a spin obex object. unfourtantely like i said ive just been having a hard time buckling down and learning spin somewhat due to me just not liking the language. i figured with all the avr info out there it would help me understand how this stuff works at the code level with c. dont get me wrong spin is great for people getting there feet wet with programming, but to alot of people who come from a coding background its just plain silly, i hate inforced white spaces. i do give it credit it is powerfull and flexible its just not for everyone. i came to the propeller to learn about hardware and electronics not learn a new language based on basic and fight with its ackwardness.

    so far the toggle tutorial is great! its very clear (the problem is i know c x86asm and a tad bit of spin, im not sure a non asm coder knows about registers and a non spinner knows what dira is) the only issue ive had with what ive read is how to interface the memmory models to tangable hardware. for example i have a 32KB eeprom and two 64KB eeproms on the i2c bus, then i have
    sd on spi, and some spi sram chips on the way. so essentially i have all this hardware but how do i dictate where the code and or data goes when using xmm/xmmc? can i even dictate that and if so could i do something like store the c code in eeprom and the asm and data in sram?

    like i said for me the toggle tutorials is great, im sorry if i mentioned something already in it as i havent read it all yet im only assuming its scope since its 11 pages.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-06-05 14:58
    i also havent looked at the demo code yet havent been home, but code is still no substitute for a great pdf ;)
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-06-05 15:29
    Thank you for your feedback. There's a lot of information in there.

    The Toggle Tutorials are intended for new C programmers that may or may not have Propeller experience. They go line by line through a simple program and pretty much explain what each line does. A C programmer doesn't need that and that's part of the problem with writing tutorials. There are at least 3 distinct audiences (more a continum between these three points): minimal C knowledge (or really an programming knowledge)/minimal Propeller knowledge; Spin knowledge and Propeller knowledge; C knowledge and some other micro controller knowledge. Three very different skill sets wanting different information.

    If you look at the C code in tutorial and it makes no sense, start at the beginning. If you can read the C code and it makes some sense, it should be documented enough to get you started doing what you want and go to the tutorial sections that explain the unfamiliar Propeller parts, if you know a Propeller has multiple Cogs and you want to put code in one, go to that section and read the tutorials and the documented C code. If you understand C and the Propeller but want in depth details on the various memory models, go to that section.

    Lots of different info for a lot of different people with different needs and backgrounds.

    The toggle demos are interesting because in a small set of programs, each changing just a bit, you can teach a bunch of different concepts to different audiences. It's currently evolving into something different but headed down the same basic path.

    If you have specif questions, I'm sure examples and help can be found.
  • jazzedjazzed Posts: 11,803
    edited 2012-06-05 15:48
    I've started documenting our libraries for beta, but they are only about 40% done. I'll attach a .pdf here just for a start and give her a thread all her own later. Most propeller specific information is in the cog.h and propeller.h sections.

    One of the very first things to do when looking at a new device is to look at the datasheet. Propeller-GCC follows the naming conventions of cog registers and other details from the Propeller datasheet. Beyond that everything is a library call.

    Attached is an incomplete draft. There is much more to do with it - entire sections are missing.

    For the missing suggestions, I recommend using www.manpagez.com hits on google search for library calls. For example "strtol site:www.manpagez.com" in google.com search.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-06-05 16:58
    well thanks for listening to my feedback guys. i know data sheets and example code are always a good starting place and should be enough for most functional c coders but these tutorials are always apperciated. i would also like to say as a c programmer that i like the way toggle tutorial is written i dont mind skipping over syntax explanations but when you do something like bit shift and im wondering why its nice to look at and see you were just using it for division. like i said things like coumters pwms adcs and dac coverage would be nice. especially when you have alot of hardware newbs like me who dont really know what a pwm is even used for.

    the one question i directly have is when you compile in xmmc how does the compiler where does the compiler store the data? and how do u specify i want to use my sd card as opposed to eeprom or whatever
  • jazzedjazzed Posts: 11,803
    edited 2012-06-05 19:50
    well thanks for listening to my feedback guys.
    Your feedback is very valuable. Thank you.

    the one question i directly have is when you compile in xmmc how does the compiler where does the compiler store the data? and how do u specify i want to use my sd card as opposed to eeprom or whatever

    Question1: "in xmmc how does the compiler where does the compiler store the data?"


    The compiler/linker stores text and data according to the addresses in the linker script.
    Those scripts are in /opt/parallax/propeller-elf/libldscripts for linux or c:\propgcc\propeller-elf\lib\ldscripts for windows.

    There are built-in linker scripts for xmmc, xmm-single, xmm-split, lmm, and cog modes. We can create our own linker scripts if necessary.

    All .data sections go into HUB memory for xmmc.


    Question2: "how do u specify i want to use my sd card as opposed to eeprom or whatever"

    In SimpleIDE board types let us specify where to run the program.

    The propeller-load utility also has parameters for controlling it. Basically the board.cfg file has a cache driver. We chose the xmm type from the memory model, and use the propeller-load options to choose sdcard - SimpleIDE automates this.

    Hope that helps,
    --Steve
  • colllectivacolllectiva Posts: 1
    edited 2012-06-19 04:59
    Please visit the Site collectiva To learn Fundamentals of C Programming in Tamil. It is very useful for the Beginners.
Sign In or Register to comment.