resources for programming ucontrollers in C...any ideas?

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
thephilbot
 
Posts: 24
Joined: Sat Jan 13, 2007 8:42 pm

resources for programming ucontrollers in C...any ideas?

Post by thephilbot »

I was wondering if anyone could suggest a text that would help one start programming ucontrollers in flavors of C. Specifically at work I've been charged with the task of taking existing code for a Rabbit 2500 (Coyote) and porting it over to work on a Rabbit 2600 (Wolf; twice as many digital I/Os) and the guy who wrote the code originally is not longer here. The existing code has issues with memory addresses...the 2600 has more memory than the 2500 and it's thusly not addressing correctly...why I don't know, and pretty soon I thought heck, why not just learn this and make it work instead of blindly trying to fix code?

I've taken a course in C++, and also an Intro to Logic and Computer Design...I understand calling functions, case statements and writing HDL for a Xilinx PLD on an introductory level...The problem is that the particular flavor of C I'm using (Dynamic C from Rabbit) only really has documentation from Rabbit themselves, and though they offer lots of source code examples with the installation of the IDE the code is kind of random, it seems like there's little info on practically utilizing the ucontroller functions...it starts out super simple but then kind of abandons the idea of code examples and jumps right into assembly and pointers and memory addressing but without any basics, as though the user is using the information to simply get used to the ucontroller but already has a working knowledge of what to actually do. I'm trudging through it but I'm not even sure what I'm looking at some of the time, and wish there was a stepping stone or two. The documentation does say it assumes one has a working knowledge of C for ucontrollers, but where does one acquire such knowledge and experience? I did some searching around and found some textbooks on Amazon that look promising, but I don't want to get bogged down with volumes that aren't even useful (which has happened to me before).

What I'm doing now is reading about the Arduino, trying to get myself familiar with ucontrollers on a simpler level. I figure if I go in with my feet wet then I'll at least be able to relate with what is going on, rather than being exposed to it for the first time. For the most part it's working; after reading just a few articles (at arduino.cc and ladyada.net) and examples I already understand more about the idea of ucontrollers, and I'd love to learn more about them because they'd be interesting to play with for particular projects I have in mind.

At this point I am trying to find a sort of introductory course on the idea of ucontrollers in C and some introductory projects...analog and digital inputs, storing data, manipulating data, A/D outputs, sending data over the ethernet port on the ucontroller...it seems like I can find plenty of "make the LED blink" projects but nothing a few more steps in...all of the sudden it's very complex and beyond my grasp.

Thanks for any help you all can provide, I would be very appreciative of some suggestions.

Cheers!

User avatar
westfw
 
Posts: 2010
Joined: Fri Apr 27, 2007 1:01 pm

Re: resources for programming ucontrollers in C...any ideas?

Post by westfw »

So you have no other background in programming microcontrollers?
An introduction to writing code for microcontrollers in assembler might be helpful. A lot of people will tell you that you really need to understand a micro's assembler before you can program effectively in a high level language, even if you have a good compiler available. You can neglect some of the finicky details of assembler, but you'll need to understand things like controlling IO pin behavior by setting or clearing bits in configuration registers, and most "intro" C books won't talk about that sort of thing.
One of the things you need is documentation for the LIBRARIES that "dynamic C" provides for doing stuff to the cpu. This is similar to the Arduino documentation (pinMode, digitalWrite, etc) but would cover the rabbit cpu capabilities specifically. Unfortunately, I can't FIND info on the the rabbit libraries. The Dynamic C manual just says something like 'Dynamic C comes with many libraries.' Swell. Thanks, guys! (for a counter-example, Luminary Micro has an easy-to-find http://www.luminarymicro.com/products/p ... brary.html exhausting 300+ page document...)

thephilbot
 
Posts: 24
Joined: Sat Jan 13, 2007 8:42 pm

Re: resources for programming ucontrollers in C...any ideas?

Post by thephilbot »

westfw wrote:So you have no other background in programming microcontrollers?
No, no other background experience.
An introduction to writing code for microcontrollers in assembler might be helpful. A lot of people will tell you that you really need to understand a micro's assembler before you can program effectively in a high level language, even if you have a good compiler available. You can neglect some of the finicky details of assembler, but you'll need to understand things like controlling IO pin behavior by setting or clearing bits in configuration registers, and most "intro" C books won't talk about that sort of thing.
Interesting that the Assembly is mostly vital...I'm taking a class in the Fall but need to learn this much more quickly than that...any chance you have an Assembly text you could suggest, or any other learning tool? I am going to grab the textbook for my class and the labs from a guy who has already taken it, but I'm of course open to any other suggestions.
One of the things you need is documentation for the LIBRARIES that "dynamic C" provides for doing stuff to the cpu. This is similar to the Arduino documentation (pinMode, digitalWrite, etc) but would cover the rabbit cpu capabilities specifically. Unfortunately, I can't FIND info on the the rabbit libraries. The Dynamic C manual just says something like 'Dynamic C comes with many libraries.' Swell. Thanks, guys! (for a counter-example, Luminary Micro has an easy-to-find http://www.luminarymicro.com/products/p ... brary.html exhausting 300+ page document...)
I see what you mean about the libraries, and thanks for taking on the initiative of looking. I'll contact the company and see if they'll point me in the right direction.

Thanks again, your info is very helpful. I'm looking forward to being proficient with controllers because I can think of several very cool projects I'd like to work on (besides work) and it's high time I took this on.

thephilbot
 
Posts: 24
Joined: Sat Jan 13, 2007 8:42 pm

found library info

Post by thephilbot »

Ok, so apparently the library info is different for each Rabbit controller and the information is contained in the user manuals of each controller. This would make sense because on the 2500 there four LEDs you can control, but the 2600 doesn't have LEDs that are controllable. I'll start reading through the functions and that should help get my feet wet.

Here's the 2500:
http://www.rabbit.com/documentation/doc ... 2500UM.pdf

and the 2600:
http://www.rabbit.com/documentation/doc ... 2600UM.pdf

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”