Pic, c programing

T

Tuurbo46

Guest
Hi

Im currently trying to become more conversent with pic, whilst using c
programming. Does anybody recommned any good books, or links to help me on
this journey?

Cheers Turbo
 
You should ask the same question over on the PicList -
http://groups.yahoo.com/group/piclist/
(Or search previous posts there)

The only drawback is signing up to Yahoo.
I bet you'll get 10 responses within 24 hours asking the same question
there. (Very active group)

BTW I too would like to see the answer to that question. If you are looking
to free PIC C compilers a few were mentioned here -
http://dingoaus.proboards34.com/index.cgi?board=genelectronics&action=displa
y&num=1092878126

And I'm sure there are others.

Cheers


"Tuurbo46" <alex@beale55.fsnet.co.uk> wrote in message
news:chi89l$md$1@newsg4.svr.pol.co.uk...
Hi

Im currently trying to become more conversent with pic, whilst using c
programming. Does anybody recommned any good books, or links to help me
on
this journey?

Cheers Turbo
 
"Dingo" <nsjunkstuff@hotmail.com> writes:
BTW I too would like to see the answer to that question. If you are looking
to free PIC C compilers a few were mentioned here -
http://dingoaus.proboards34.com/index.cgi?board=genelectronics&action=displa
y&num=1092878126
And I'm sure there are others.

"Tuurbo46" <alex@beale55.fsnet.co.uk> wrote in message
Im currently trying to become more conversent with pic, whilst using c
programming. Does anybody recommned any good books, or links to help me
on this journey?
"Programming Robot Controllers" by Predko describes using the free
PICC Lite C compiler with the 16F627 (I think, it has been a few
months) and the Microchip IDE simulator/debugger/etc.

The only down side is that not too long after the book came out
Microchip completely revised their IDE user interface, and may have
done so again, and that makes small parts of the book that are
trying to tell you how to get started and interface the output of
the C compiler with the IDE, and using the IDE, much harder for a
beginner. Somebody could write a small revision that would make
this lots easier for the novice.
 
"Dingo" <nsjunkstuff@hotmail.com> writes:
You should ask the same question over on the PicList -
http://groups.yahoo.com/group/piclist/
(Or search previous posts there)
The only drawback is signing up to Yahoo.
BTW I too would like to see the answer to that question. If you are looking
to free PIC C compilers a few were mentioned here -

"Tuurbo46" <alex@beale55.fsnet.co.uk> wrote in message
Im currently trying to become more conversent with pic, whilst using c
programming. Does anybody recommned any good books, or links to help me
on this journey?
There tends to be one other drawback to C Compiler & PicList, since
many/most of those folks got started writing code in raw assembly
language, it seems that many folks who have a problem with something
written in C and who ask the group often don't get wildly helpful
answers other than "it is probably your compiler and why don't you
learn assembly language for this like you are supposed to."

When I had a problem I went WAY overboard checking everything that
I could imagine, providing documentation, etc, etc, etc, and put
all this into my first question for the list. The responses were
mostly "wow, well written question, now, we still don't trust that
you are using a compiler so why aren't you doing this in assembly?"

Your mileage may vary, I hope it works out for you.
And you can always toss me questions via email.
I may give disclaimers but I really try to not tell
you something when I actually don't know the answer.
(email address is valid)
 
There tends to be one other drawback to C Compiler & PicList, since
many/most of those folks got started writing code in raw assembly
language, it seems that many folks who have a problem with something
written in C and who ask the group often don't get wildly helpful
answers other than "it is probably your compiler and why don't you
learn assembly language for this like you are supposed to."
hi, the reason is that the pics are particularly bad at running C programs. If
you must use C switch to another chip.
 
"CBarn24050" <cbarn24050@aol.com> wrote in message
news:20040909002946.24357.00000240@mb-m16.aol.com...
There tends to be one other drawback to C Compiler & PicList, since
many/most of those folks got started writing code in raw assembly
language, it seems that many folks who have a problem with something
written in C and who ask the group often don't get wildly helpful
answers other than "it is probably your compiler and why don't you
learn assembly language for this like you are supposed to."

hi, the reason is that the pics are particularly bad at running C
programs. If
you must use C switch to another chip.
Yes, the PIC has a *strange* instruction set. It does not correspond very
well to any conventional programming language.
 
Which chips are more 'C' friendly?

"CBarn24050" <cbarn24050@aol.com> wrote in message
news:20040909002946.24357.00000240@mb-m16.aol.com...
There tends to be one other drawback to C Compiler & PicList, since
many/most of those folks got started writing code in raw assembly
language, it seems that many folks who have a problem with something
written in C and who ask the group often don't get wildly helpful
answers other than "it is probably your compiler and why don't you
learn assembly language for this like you are supposed to."

hi, the reason is that the pics are particularly bad at running C
programs. If
you must use C switch to another chip.
 
cbarn24050@aol.com (CBarn24050) writes:
I wrote:
There tends to be one other drawback to C Compiler & PicList, since
many/most of those folks got started writing code in raw assembly
language, it seems that many folks who have a problem with something
written in C and who ask the group often don't get wildly helpful
answers other than "it is probably your compiler and why don't you
learn assembly language for this like you are supposed to."

hi, the reason is that the pics are particularly bad at running C programs.
If you must use C switch to another chip.
I respectfully tend to disagree. I think "culture" is usually the
major reason that most people do and say what they do.

I don't know about anyone else but the rather simplistic C code that
I write when using the PIC seems to compile surprisingly well and it
keeps me from making most of the little silly mistakes I'd otherwise
make if I were writing assembly with my old and decaying brain cells.

I served my time writing assembly code 30+ years ago and switched to
writing compilers 20 years ago.
 
In article <20040909002946.24357.00000240@mb-m16.aol.com>, cbarn24050
@aol.com says...
There tends to be one other drawback to C Compiler & PicList, since
many/most of those folks got started writing code in raw assembly
language, it seems that many folks who have a problem with something
written in C and who ask the group often don't get wildly helpful
answers other than "it is probably your compiler and why don't you
learn assembly language for this like you are supposed to."

hi, the reason is that the pics are particularly bad at running C programs. If
you must use C switch to another chip.

Now, that's about as dopey a statement as I've seen here in a while.

I guess I had better tell all of my customers to throw away all of our
products, they obviously don't work well, NOT......
PICs don't have any problem running 'C'. Some of them (the 18 series)
do a better job of it, but I have even done a quick and dirty servo
pulse to camera interface in 'C' on a PIC12C509A in less than 5 minutes.
I have done more than my fair share of BIG assembly projects to know I
REALLY like 'C' and only resort to assembly where it is needed. It is
also nice to have a common library of routines like CRC's, ADPCM, and so
on that you can drag between MCU's/CPU's with out recoding. Do that in
assembler. Besides good 'C' compilers do some pretty good optimizations
these days. You should take a look at one.
 
"Dingo" <nsjunkstuff@hotmail.com> wrote in message
news:41400000$1@duster.adelaide.on.net...
Which chips are more 'C' friendly?
Almost anything else :) Atmel AVR particularly.
 
"Michael A. Covington" <look@ai.uga.edu.for.address> wrote in message
news:41410d82$1@mustang.speedfactory.net...
"Dingo" <nsjunkstuff@hotmail.com> wrote in message
news:41400000$1@duster.adelaide.on.net...
Which chips are more 'C' friendly?

Almost anything else :) Atmel AVR particularly.
Had a feeling that would be your response.....think I'll struggle with C on
PICs for now all the same
 
hi, the reason is that the pics are particularly bad at running C programs.
If
you must use C switch to another chip.

Now, that's about as dopey a statement as I've seen here in a while.
Well if you look around you will find much worse, like this one.> but I have
even done a quick and dirty servo
pulse to camera interface in 'C' on a PIC12C509A in less than 5 minutes.
Just compare you c program running on a pic then run it on an avr. It is true
that the 18 series make a much better job. If you can put up with using 5 times
as much memory and a speed penalty of 10 to100 times slower then c is ok on
these chips.
 
cbarn24050@aol.com (CBarn24050) writes:
hi, the reason is that the pics are particularly bad at running C programs.
If you must use C switch to another chip.

Now, that's about as dopey a statement as I've seen here in a while.

Well if you look around you will find much worse, like this one.

but I have even done a quick and dirty servo pulse to camera
interface in 'C' on a PIC12C509A in less than 5 minutes.

Just compare you c program running on a pic then run it on an avr.
It is true that the 18 series make a much better job. If you can
put up with using 5 times as much memory and a speed penalty of 10
to100 times slower then c is ok on these chips.
I dunno what kind of C code you guys are writing but when I look
at the generated assembly listing, with the PICC Lite compiler
optimizations turned on, I don't see that I would write assembly
code any smaller than that in most cases. Subscripting into an
array of constants that will never be modified looks to me like it
could be better thought out by the guys that wrote the code
generator but I understand they had to deal with the general case.
Other than that I haven't found anything that takes 5x the code or
10x-100x the time. I'm building state machines, reading inputs,
deciding on transitions, driving outputs.

Have you got an example where the code size is 5x larger than what
PICC Lite with optimizations generates?
 
I dunno what kind of C code you guys are writing but when I look
at the generated assembly listing, with the PICC Lite compiler
optimizations turned on, I don't see that I would write assembly
code any smaller than that in most cases. Subscripting into an
array of constants that will never be modified looks to me like it
could be better thought out by the guys that wrote the code
generator but I understand they had to deal with the general case.
Other than that I haven't found anything that takes 5x the code or
10x-100x the time. I'm building state machines, reading inputs,
deciding on transitions, driving outputs.

Have you got an example where the code size is 5x larger than what
PICC Lite with optimizations generates?
It very hard to comment about the code your using if you quote some.I've never
used picc lite so I can't comment on it, however since it has the word lite in
it's title that usually means its not a real C compiler.
 
What rubbish.
Yes, the PIC 16x architecture is not optimised for high level
so why not use a chip whos archtecture is opimised for C as they are the same
price?

There are very good and efficient professional C compilers available
for the PIC,
I am not aware of any fully complient C compilers for the pic, I could be out
of date of course.


Using a good C compiler you shouldn't really notice the difference
between using a PIC or another micro more optimised for higher level
languages.
No you won't notice anything untill it really maters.

All micros will vary in speed and memory usage of
compiler code to be sure, but there are so many other factors involved
in chossing the right micro that compiler efficiency is usually way
down on the list.
Yes quite so, the problem is not the compiler but the missing hardware resorces
on the pic.
 
Your statements that a C compiler for the PIC takes 5x the code or
10-100x the time of an AVR one is just plain silly and ill-informed.
That isn't what I said.

. The CodeVision compiler I
used took more code space for floating point than my Hitech PICC
compiler on the PIC 16 series. I was not that impressed.
Thats very suprising, I too would not be impressed.
 
cbarn24050@aol.com (CBarn24050) writes:
Your statements that a C compiler for the PIC takes 5x the code or
10-100x the time of an AVR one is just plain silly and ill-informed.

That isn't what I said.
Someone, several messages earlier in this thread made the comment that
using a C compiler would result in the 5x and 10-100x over assembly.
No particular processor family was mentioned. I believe that was where
this statement originated.

I was skeptical asked for plausible examples of this. No such examples
showed up but I did get email from one person suggesting that I try
to completely re-implement a project of his with my using C and see what
the comparison was. I haven't decided whether to try that or not.

. The CodeVision compiler I
used took more code space for floating point than my Hitech PICC
compiler on the PIC 16 series. I was not that impressed.

Thats very suprising, I too would not be impressed.
Maybe I'm just using PIC and C for smaller projects, but I wouldn't
think of using floating point math on one of these to begin with :)
 
Yes you did!, and I quote:
"Just compare you c program running on a pic then run it on an avr. It is
true
that the 18 series make a much better job. If you can put up with using 5
times
as much memory and a speed penalty of 10 to100 times slower then c is ok on
these chips."

Pretty hard to misinterpret that!

Dave :)
sorry dave but you missed the earlier bit, it's a comparison with C and asm on
the pic.
 
Even so, your figures are still *way* off the mark.
In fact, C code is often faster and smaller than poorly written
assembler. High end PIC C compilers are really that good.
Obviously you have never used a proper high end C compiler on the PIC.

Dave :)
Well Dave I have a pic project I did 10 years ago, if you want to rewrite it in
C email me. Then we will know for sure.
 

Welcome to EDABoard.com

Sponsor

Back
Top