SLP Posted July 19, 2007 Report Share Posted July 19, 2007 Hi,I'm thinking about starting to learn C.Are there any books (german preferred, english is also ok) you can recommend me?I know that there's a lot of stuff on the web, but it's free and I don't know if I learn it right.I'd prefer paying some bucks as I can be sure to learn it right.matthias Quote Link to comment Share on other sites More sharing options...
audiocommander Posted July 19, 2007 Report Share Posted July 19, 2007 yup, I recommend this book (german) :you can test the first chapters and if you're okay with it, order the printed version.C von A bis Z (German)von Jürgen Wolf' date=' Galileo ComputingISBN 3-89842-643-2OpenBook (!) oder gebundene Ausgabe: 39,90 €Ein sehr gutes, plattformübergreifendes (!) und übersichtlich aufgebautes OpenBook. Kann man online ansehen, als zip herunterladen (html) oder gebunden bestellen, was will man mehr? :)http://www.galileocomputing.de/openbook/c_von_a_bis_z/[/quote']Best,Michael Quote Link to comment Share on other sites More sharing options...
SLP Posted July 19, 2007 Author Report Share Posted July 19, 2007 Theres a book review page in the wiki? :oi didn't know that...Whats the main difference between C on the PC and on a PIC?(as the proposed book seems to be about C on a PC) Quote Link to comment Share on other sites More sharing options...
audiocommander Posted July 19, 2007 Report Share Posted July 19, 2007 On a PC you have all kinds of standard libraries, for example <stdio.h> for in- and outputs, eg. reading the console-input with scanf() and using printf() to print chars to the console-output.Of course these libraries are not available on the PIC, so you have only to learn the C-basics like: Syntax, Grammar, Data-Tyes, Functions, etc...These topics are all handled quite well in this book. I found it's one of the least confusing books regarding this issue compared to others ;)Regards,Michael Quote Link to comment Share on other sites More sharing options...
SLP Posted July 19, 2007 Author Report Share Posted July 19, 2007 and what's with those things like defining the PIC-type , switching In and Outs or the ADCs ? Quote Link to comment Share on other sites More sharing options...
audiocommander Posted July 19, 2007 Report Share Posted July 19, 2007 You can only use standard C that works without having to include any libraries at all -and the MIOS functions:http://www.ucapps.de/cmios_fun.htmlAn exception to this roule is the SDCC-lib which was adapted for MIOS (required for multiplications and divisions), but it costs very much application space.Regards,Michael Quote Link to comment Share on other sites More sharing options...
SLP Posted July 20, 2007 Author Report Share Posted July 20, 2007 I don't know If you understood my question (or If I just didn't understand your answer ;))This book is mainly about C at the PC, is it?A PC usualy doesn't have any I/Os and ADCs in the way a PIC has.Are those PIC-specific actions also described in that book? Quote Link to comment Share on other sites More sharing options...
stryd_one Posted July 20, 2007 Report Share Posted July 20, 2007 Well, if you are writing a MIOS app, then you use the MIOS functions to handle such things as ADC. If not, you would use the SDCC libraries or whatever libraries are available. The libraries or the OS will take care of the low level functions, so you just handle the variables. Quote Link to comment Share on other sites More sharing options...
DrBunsen Posted July 21, 2007 Report Share Posted July 21, 2007 I just scored a book called "Crash Course In C". It's a few years old, and I haven't got into it yet. I'll provide some feedback when I do. Quote Link to comment Share on other sites More sharing options...
SLP Posted July 21, 2007 Author Report Share Posted July 21, 2007 OK. Thanks!I think I'll learn the basic things first instead of worrying about libraries ;D Quote Link to comment Share on other sites More sharing options...
audiocommander Posted July 21, 2007 Report Share Posted July 21, 2007 yeh, see it like this:The basic C ist just the main grammar, like - variables- operators- loops & conditions- functions That's it. Basically. Every language has these basic syntax and grammar items; for objective oriented languages, there are some more things to learn, but with similar simple languages like C, PHP, JavaScript, Java, Perl... that's it.Once you got that, you can either:- write your own low level functions (that would be to re-invent the wheel)- or use existing low level functions (either in seperate files or bundled into libraries)In theory it's the same if you get your variable 'i' either from the console (with the stdin library):[tt]sscanf(stdio, "%i", i); // read input number from console[/tt]or from a MIOS function:[tt]i = MIOS_DIN_PinGet(pin); // read state of pin number[/tt]see, it's just a matter of reading the function reference, once you know where the "i", the "=" and the ";" belongs.So, to sum it up: Learning a language consists of three steps:1. you have to learn and get the syntax!2. you have to program by yourself. Don't start with a huge IDE, just take a notepad (with the ability to compile the textfile, so you can learn on simple "one-filers"). 3. you have to know how to look up: if you can manage the syntax, you just have to learn how and where to look up function and library references. Nobody can ever remember a thousand functions, it's normal to look these things up, so you don't have to "learn" all this complicated stuff. The main syntax is enough, for the rest you can search your preferred documentation.Regards,Michael Quote Link to comment Share on other sites More sharing options...
fluke Posted July 27, 2007 Report Share Posted July 27, 2007 In theory it's the same if you get your variable 'i' either from the console (with the stdin library):[tt]sscanf(stdio, "%i", i); // read input number from console[/tt]or from a MIOS function:[tt]i = MIOS_DIN_PinGet(pin); // read state of pin number[/tt]Except that the first one is passing an int instead of a pointer to an int and will stop your program with a segmentation fault if you're lucky and overwrite random parts of memory if you're not.I definately agree with the idea of learning C on a PC first. There you have memory protection to stop errors like this (especially if you use a library like dmalloc) and much better debuggers. On the PIC you will just get your program behaving strangely and probably not even in the place that is causing the error. I once allocated an array 1 element too short and didn't notice. Then program started crashing when i added more code, regardless of what the code was or where i added it. Quote Link to comment Share on other sites More sharing options...
audiocommander Posted July 28, 2007 Report Share Posted July 28, 2007 I just stumbled over a book I bought last week, that does seem like a good one for a very reasonable price:"C Programmieren von Anfang an" von Helmut Erlenkötter, rororo, 9.90 €, ISBN: 3-499-60074-9http://www.erlenkoetter.de/html/c.htmWhat I like about it (besides the price) is that it's very clear structured and contains line-by-line explained examples for every entry; that makes it a valueable book not only to learn but also to look up things later.Regards,Michael Quote Link to comment Share on other sites More sharing options...
SLP Posted July 29, 2007 Author Report Share Posted July 29, 2007 :DThat's exactly what I've been looking for! :-* Quote Link to comment Share on other sites More sharing options...
MTE Posted July 29, 2007 Report Share Posted July 29, 2007 Yeh, great :)Ill buy 1 at Amazon....thnx for the hint :DP.S.: Got 1 at ebay...I love Paypal ;D Quote Link to comment Share on other sites More sharing options...
SLP Posted August 1, 2007 Author Report Share Posted August 1, 2007 Schönhuber ;D Quote Link to comment Share on other sites More sharing options...
MTE Posted August 1, 2007 Report Share Posted August 1, 2007 ??? Quote Link to comment Share on other sites More sharing options...
SLP Posted August 2, 2007 Author Report Share Posted August 2, 2007 http://www.schoenhuber.de/shop/action/?aUrl=90000903...ich dachte den gäbs in ganz Deutschland... Quote Link to comment Share on other sites More sharing options...
MTE Posted August 2, 2007 Report Share Posted August 2, 2007 Achso, ne ich schau zuerst immer auf ebay, da dort die Dinge ja meist 10-20% unter Laden/Shoppreis verscherbelt werden.Auf Amazon gabs das Buch für 9,99.- + Versand....auf Ebay 9,99.- ohne Versand ;)was mich sehr überaschte bei dem Preis :) Quote Link to comment Share on other sites More sharing options...
SLP Posted August 2, 2007 Author Report Share Posted August 2, 2007 9,90€ Quote Link to comment Share on other sites More sharing options...
MTE Posted August 2, 2007 Report Share Posted August 2, 2007 ok, tschuuuuldigung ;D :P Quote Link to comment Share on other sites More sharing options...
cimo Posted August 5, 2007 Report Share Posted August 5, 2007 hey therewhat about something in English? any idea.... something realllly basic maybe a web site offering practical examples...txxsimone Quote Link to comment Share on other sites More sharing options...
stryd_one Posted August 5, 2007 Report Share Posted August 5, 2007 I really liked "The C Book" which is online and in english Quote Link to comment Share on other sites More sharing options...
DrBunsen Posted August 5, 2007 Report Share Posted August 5, 2007 People keep recommending "Thinking In C" to me - it's available online or in book form Quote Link to comment Share on other sites More sharing options...
Rio Posted September 4, 2007 Report Share Posted September 4, 2007 I don't know If you understood my question (or If I just didn't understand your answer Wink)This book is mainly about C at the PC, is it?native C Code is on all plattforms the same... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.