Hey

Started by goldengraham_h October 12, 2003
I just started a class at uni where we I'm going to be programming a
PIC 16f877 micorcontroller. I have no idea where to being and we
were'nt given much information on the matter... I'm wondering if
anyone could point me towards a site with some tutorials or
something of the like.

Thanks



I would recommend going to http://www.piclist.com and plunder through this site. It is a wealth of valuable information that many have contributed to. I sure wish I had the opportunity to study pics in college when I went. We were still using slide rules and never saw an electronic calculator. ;-)
Rick C.

goldengraham_h wrote:

 I just started a class at uni where we I'm going to be programming a
PIC 16f877 micorcontroller. I have no idea where to being and we
were'nt given much information on the matter... I'm wondering if
anyone could point me towards a site with some tutorials or
something of the like.

Thanks





> > I just started a class at uni where we I'm going to be
programming a
> > PIC 16f877 micorcontroller. I have no idea where to being and we
> > were'nt given much information on the matter... I'm wondering if
> > anyone could point me towards a site with some tutorials or
> > something of the like.
> >
> > Thanks


google pg offline and get the program. about $30.00 or so.

you can download the whole list of posts in a few hours and then have
them on your hard drive and search very easily.

the wealth of info on these lists is overwhelming !

on another note, what software do you plan to use and do you know
that software ?

the ones that come to mind quickly are
C
Basic in a couple varieties.
and assembly

pick the one you know and start there. learning software and
hardware is a double hill to climb.

Dave
Dave



--- In , "Dave Mucha" <davemucha@j...> wrote:
>
> > > I just started a class at uni where we I'm going to be
> programming a
> > > PIC 16f877 micorcontroller. I have no idea where to being and
we
> > > were'nt given much information on the matter... I'm wondering
if
> > > anyone could point me towards a site with some tutorials or
> > > something of the like.
> > >
> > > Thanks > google pg offline and get the program. about $30.00 or so.
>
> you can download the whole list of posts in a few hours and then
have
> them on your hard drive and search very easily.
>
> the wealth of info on these lists is overwhelming !
>
> on another note, what software do you plan to use and do you know
> that software ?
>
> the ones that come to mind quickly are
> C
> Basic in a couple varieties.
> and assembly
>
> pick the one you know and start there. learning software and
> hardware is a double hill to climb.
>
> Dave >
> Dave


First off thanks for the idea... And I think I'll be doing it in
assemble]y... I want to keep my code as efficient as possible... I
know C and basic but I figure the converting I would need to do to
download them onto the pic wouldn't make them the best choice... not
sure though

Graham



--- In , "Rick C." <rixy@V...> wrote:
> I would recommend going to http://www.piclist.com and plunder
through
> this site. It is a wealth of valuable information that many have
> contributed to. I sure wish I had the opportunity to study pics in
> college when I went. We were still using slide rules and never saw
an
> electronic calculator. ;-)
> Rick C.
>
> goldengraham_h wrote:
>
> > I just started a class at uni where we I'm going to be
programming a
> > PIC 16f877 micorcontroller. I have no idea where to being and we
> > were'nt given much information on the matter... I'm wondering if
> > anyone could point me towards a site with some tutorials or
> > something of the like.
> >
> > Thanks

Thanks for the advice... It's an engineering design course I'm
taking... we have a pretty simple first assignment with the PIC but
the eventual goal of this class is to design a robot between a group
of 3 (having said that the projects this year are sort of boring
compared to past years)... one person does electro mech another on
circuits and another doing the programming for the PIC... I'm doing
the programming, it should be pretty cool to learn I think. There's
a lot to cover... I have to make an LCD and keypad interface and be
able to get the data I need from the circuits (having done nothing
of the sort before makes the task seem somewhat daunting at this
point in time)... Like i said in another post I've done some basic
and C before but I think I'll probably use assembly to do this just
because we have some information on it and I'd like my code to be as
efficient as possible.

Graham



If you want an example of a 16F877 controlling a robot, look at the
MiniSumo Mark III group here on yahoo or start at www.junun.org.
Sensors and servos are shown in the schematic - search the site -
under Datasheets I think. PIC C Lite would probably be my choice - it is free from
www.htsoft.com. There is also a free version of cc5x.

You will still need to understand assembly code since much of the bit
twiddling in C looks a lot like assembly. --- In , "goldengraham_h"
<goldengraham_h@y...> wrote:
> --- In , "Dave Mucha" <davemucha@j...> wrote:
> >
> > > > I just started a class at uni where we I'm going to be
> > programming a
> > > > PIC 16f877 micorcontroller. I have no idea where to being and
> we
> > > > were'nt given much information on the matter... I'm wondering
> if
> > > > anyone could point me towards a site with some tutorials or
> > > > something of the like.
> > > >
> > > > Thanks
> >
> >
> > google pg offline and get the program. about $30.00 or so.
> >
> > you can download the whole list of posts in a few hours and then
> have
> > them on your hard drive and search very easily.
> >
> > the wealth of info on these lists is overwhelming !
> >
> > on another note, what software do you plan to use and do you know
> > that software ?
> >
> > the ones that come to mind quickly are
> > C
> > Basic in a couple varieties.
> > and assembly
> >
> > pick the one you know and start there. learning software and
> > hardware is a double hill to climb.
> >
> > Dave
> >
> >
> >
> > Dave > First off thanks for the idea... And I think I'll be doing it in
> assemble]y... I want to keep my code as efficient as possible... I
> know C and basic but I figure the converting I would need to do to
> download them onto the pic wouldn't make them the best choice...
not
> sure though
>
> Graham




goldengraham_h wrote:
> First off thanks for the idea... And I think I'll be doing it in
> assemble]y... I want to keep my code as efficient as possible... I
> know C and basic but I figure the converting I would need to do to
> download them onto the pic wouldn't make them the best choice... not
> sure though
>
> Graham

Hi Graham,

Certainly, if embedded programming is a a long term goal and you really want
to learn to use the PIC effectively, then PIC assembler is the BEST way to
start. However one small point needs to be clarified. A GOOD compiler WILL
generate efficient code that approaches to within about 90% the best
possible code produced by an EXPERIENCED VETERAN assembler programmer. Given
that a novice / junior assembler programmer will struggle to produce code at
least 60% as efficient as the experienced veteran programmer, the GOOD
compiler will produce much more efficient code than the novice / junior
programmer.

would you think or converting:

A = A >> 7

to:
rlf A
clrf A
rlf A Also you should consider that expressing a problem as a list of assembler
instructions can often obscure the solution. Seeing something written as:

a = (p + 1) * c + (p + 1)

will sometimes help you rearrange things to be more efficient:

a = (p + 1) * (c + 1)

Try seeing that from a list of assembler instructions.

Sometimes squeezing a little more performance or space out of a PIC requires
re-thinking the solution not just tweaking the existing program to reduce
instructions.

Good luck with your project.

Regards
Sergio Masci

http://www.xcprod.com/titan/XCSB - optimising structured PIC BASIC compiler



> Certainly, if embedded programming is a a long term goal and
> you really want
> to learn to use the PIC effectively, then PIC assembler is
> the BEST way to start.

[snip in which Sergio states that this holds only for experienced
programmers]

And even for experienced programmers the use of assembly makes sense
only when the hardware cost is more important than development cost,
which reduces the use for assembly even further.

But knowledge and occasional use (often in-line in a HLL program) of
assembly is a very different matter - it can increase the speed of a
program in critical areas or achive things taht would otherwise be
impossible.

Wouter van Ooijen

-- -------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products



Wouter van Ooijen wrote:
> > Certainly, if embedded programming is a a long term goal and
> > you really want
> > to learn to use the PIC effectively, then PIC assembler is
> > the BEST way to start.
>
> [snip in which Sergio states that this holds only for experienced
> programmers]

I don't read this to mean what I intended. What I meant was: Yes learn
assembler, learn low level manipulation of the MCU (this is very important)
but don't expect to produce code that is better than that produced by a
compiler just because you write it in assembler.

>
> And even for experienced programmers the use of assembly makes sense
> only when the hardware cost is more important than development cost,
> which reduces the use for assembly even further.
>
> But knowledge and occasional use (often in-line in a HLL program) of
> assembly is a very different matter - it can increase the speed of a
> program in critical areas or achive things taht would otherwise be
> impossible.

This is a complicated issue and you raise good points but I think many
students and hobbyists will not understand this until they get board writing
the same piece of code a hundred times or their homework is late once too
often.

I agree HLL can often be a much better way to go. After all what good is a
saving of 20% if it takes you 3 months longer to produce your product and
you loose the market.

Regards
Sergio Masci

http://www.xcprod.com/titan/XCSB - optimising structured PIC BASIC compiler



<snip>

> I agree HLL can often be a much better way to go.
<snip>
> Regards
> Sergio Masci
>
> http://www.xcprod.com/titan/XCSB - optimising structured PIC BASIC
compiler I have a board with Pic Basic PRO and need to do some floating point
math. simplest way was to add that in ASM into the program.

it was not a lot or code but it will run faster, and it overcomes
some limitations of certain software packages.

Dave