Re: [PIC] Learning C

Chris Roper <[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.pic
Message-ID <CA+GzkeV9BBZvTTGGoCXbCK=56gHV9bKCbu1wpKV+SSAHYbVPRA@mail.gmail.com>
I was in a situation a few years ago where we had extensive code written in
PIC Assembler.
The Client produced a new version of his board and asked us to port the
code across.
He had assured us that he had made sure that the new design was still based
on a PIC Processor so we agreed on.
What he had not told us was that he had been advised to use a PIC32 without
realising it was a totally different instruction set and architecture.
After a couple of weeks trying, in a frenzied panic, to learn C programming
in order to then re-write the code, a Friend with extensive C experience
gave me the best piece of advice I have ever received in a programming
project.
Stop thinking of C as a high Level Language, think of it as a High Level
Assembler.
You still have direct access to the bare metal, but the added
convenience of Functions and Subroutine calls  and easy to define
structures.
With that Mind set we had the Asm code converted to PIC32 in a few days and
even added some new features to use some of the PIC32 advances features.

Good Luck with the Project

On Sun, Nov 10, 2024 at 9:57 PM CDB <[email protected]> wrote:

> My suggestions for what they are worth, is, assuming coding for a
> microcontroller, rather than a PC
> is to first possibly decide which C compiler (and microcontroller
> manufacturer) you want to use and then find the online or perhaps one of
> the following books if they are still available.
>
> As a very basic book then PIC C by Nigel Gardner ISBN 1-899013-04-0 -
> this uses HiTech C for Ic but as they made the Microchip C compiler
> (originally I believe) it'll work with the modern day  Xc8 etc.  It
> demonstrates pointers very well in my view.
>
> FORED (Forest Electronics) produce an online downloadable learn C for
> their compiler. I think the above one is better thought for non C users.
>
> As he is no longer with us this might require some searching but Peter H
> Anderson did a whole series of tutorials for Pic C using the CCS
> compiler taken from his university lectures.
>
> There is also Embedded Design with the PIC18F452 Microcontroller by John
> B. Peatman ISBN 0-13-046213-6. Whilst this is not a 'learn C' book
> exactly, it does have code in assembler which is also written as a C
> program. So if you are the type of person that learns by code examples
> then this could be helpful. Note the C programs take up about 10 pages
> and the rest of the book uses assembler. He has code for Microchip C and
> CCS.
>
> General C programming, if you can find the Microsoft C book from the
> 1980s which they included when purchasing their C compiler is very well
> written and quite clear.
>
> Their is also Learning to Program in C from good old Babani Publishing
> by N. Kantaris Babani # BP258 ISBN 0-85934-203-4.
>
> If you want C for the 8052 processor and it's derivatives then their is
> a book by Sencer Yeralan and Helen Emery. The 8051 Cookbook for Assembly
> and C  and Programming and interfacing the 8051 Microcontroller in C and
> Assembly,  ISBN 0-9633257-0-1 and0-9633257-1-X.   When I purchased these
> books I had to sign a US export declaration that any code I wrote based
> on these books mustn't be exported to the then list of band countries -
> which seemed to me to be overkill.
>
> Colin
> --
>
> [email protected]  11 November 2024
>
> Hosted by:  www.superdomains.com.au
>
> This email is to be considered private if addressed to a named
> individual or Personnel Department, and public if addressed to a blog,
> forum or news article.
>
>
>
> __________________________________
> Sent from eM Client | www.emclient.com <https://www.emclient.com/get>
>
>
> On 11/11/2024 04:29:38, "David C Brown" <[email protected]> wrote:
>
> >Although I enjoy programming in Assembler, the fact that so many libraries
> >abd code examples are in C I think that the time has come for me to learn
> >that language.
> >
> >Any advice on how to do that would be welcomed, be it a book or online
> >resources.
> >I am a competent programmer having programmed in  with Forth, Fortran.
> >\Pascal, Visual basic
> >__________________________________________
> >David C Brown
> >43 Bings Road
> >Whaley Bridge
> >High Peak                           Phone: 01663 733236
> >Derbyshire                eMail: [email protected]
> >SK23 7ND          web: www.bings-knowle.co.uk/dcb
> ><http://www.jb.man.ac.uk/~dcb>
> >
> >
> >
> >*Sent from my etch-a-sketch*
> >--
> >http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
> >View/change your membership options at
> >https://mailman.mit.edu/mailman/listinfo/piclist
> --
> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
> View/change your membership options at
> https://mailman.mit.edu/mailman/listinfo/piclist
>
-- 
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
https://mailman.mit.edu/mailman/listinfo/piclist
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.