PIC Assembler.

On Mon, 22 Oct 2007 19:21:30 +0100, Eeyore
<rabbitsfriendsandrelations@hotmail.com> wrote:

Assembly language makes NO sense whatever to my mind in the modern world.
Flat, dead wrong. But then, I'm not surprised.

If you are seriously interested in defending that position, I will
present you with narrow, specific cases that come from __actual__
projects in real situations, complete with detailed analysis about why
and see if you can find a high level language to seriously promote
your above point. I will expect you to work, though.

Otherwise, I can tell you from actual experience with actual projects
that you are wrong -- in the modern world, no less.

Jon
 
Eeyore wrote:

Anthony Fremont wrote:


Eeyore wrote:

ian field wrote:


Does anyone have a link to any tutorials for PIC assembly?

Over the past few months I've been trying many permutations of
Google search string, but most of the tutorials I've found assume
previous experience at writing assy for microprocessors.

Why would you want to use assembly language ?

Hopefully because it's the right way to learn how to program AFAIC.


All of the worst code I've ever seen was written in assembler by people who
'thought' they knew what they were doing.

Assembly language makes NO sense whatever to my mind in the modern world. Sure,
it's cheap since it avoids the need for a usually paid for compiler and that's
your lot.
That's because you don't know and there for shouldn't even engage.

IIRC, there's a neat free high level language for PICs but since I
don't use PICs, I never bookmarked it.

You must be referring to the PIC-AXE thingys that are programmed at a fairly
high level by the user.


Not sure. I think there's some 'PIC BASIC' out there too.

Graham
Might as well forget coding in uC if you think that's a professional
way of going.

And what the hell do you think was used for those BASIC,C etc.
compilers?
And what do you think goes in the chip at the end?

You do realize the majority of PIC's don't come with lots of
memory and clock speed to work with ? Using high level languages
just makes for bloated slower code there by, crippling the PIC
compared to what it could do.

Oh well, just another proclaimed subject of yours.

--
"I'm never wrong, once I thought I was, then, eeyore came along!"
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5
 
The PIC user manual should be enough to get you started.

The best way I found was to play with the PIC and do simple things
like adding 2 numbers etc
Use the MPLAB simulator to try things out,

If you are struggling with assembler then go for a C compiler.
 
On Mon, 22 Oct 2007 15:05:25 GMT, "ian field" <dai.ode@ntlworld.com>
wrote:

Does anyone have a link to any tutorials for PIC assembly?

Over the past few months I've been trying many permutations of Google search
string, but most of the tutorials I've found assume previous experience at
writing assy for microprocessors.

Another problem is most of what I've found is HTML which is untidy to save
for later study and many pages lose their image files after being saved to
disk (anyone know why that happens?). Any help appreciated.

TIA.
Here's a nice tutorial series for beginners:

http://amqrp.org/elmer160/lessons/

To save an html page as a single file, use Internet Explorer and save
the file as "Web Page Complete (*.mht)" or something like that.

Have fun!

Tom
 
"ian field" <dai.ode@ntlworld.com> wrote in message
news:V_2Ti.20084$0z6.19665@newsfe7-win.ntli.net...
Does anyone have a link to any tutorials for PIC assembly?

Over the past few months I've been trying many permutations of Google
search string, but most of the tutorials I've found assume previous
experience at writing assy for microprocessors.

Another problem is most of what I've found is HTML which is untidy to save
for later study and many pages lose their image files after being saved to
disk (anyone know why that happens?). Any help appreciated.

TIA.
Ian,

Try these. Some are better than others and some have mistakes - but, you'll
be able to spot those within a short time.

http://www.mikroe.com/en/books/picbook/picbook.htm
http://www.winpicprog.co.uk/pic_tutorial.htm
http://www.mstracey.btinternet.co.uk/pictutorial/picmain.htm

Saving these to your hard drive can be done with a right-click and save as.
It creates two files, one is the html document and the other is a file
folder with the graphics. At least, it does on my Windoz machine.

In a later post, someone also recommended the PIC Elmer 160 tutorial. That
is a good one and each of the lessons downloads as a PDF.

Also, if you haven't already, download the datasheet for the PIC you are
using (www.microchip.com) and, if a 16F device, download the mid-range
user's guide, as well. Lots of necessary information in those documents.

As you have discovered, there are lots of books out there on the subject. It
really depends on where you want to go with this and how much money you want
to spend. Each book I have purchased has both strong and weak points. On
thing they all have in common is that none of them had everything I wanted
to know and all of them needed to be used with the datasheets and mid-range
user's guide for full understanding. The bottom line is that you may want to
concentrate on the free stuff for awhile until you figure out if you want to
concentrate on robotics, embedded systems, just making LEDs flash, or
designing the "next best thing".

Don't worry too much about the flame wars regarding assembly vs. C vs basic
vs whatever. Start out where you are comfortable and where you can find the
most information that will help you figure out how to get some use out of
these microcontrollers. Later, if you feel like it, play with the other
programming languages.

Are you using Microchip MPLAB and a development envirionment/simulator? If
not, I recommend downloading it from the Microchip site (it is free). I
don't know if it will work with your programmer, but you should be able to
use it to build your files, then use the hex code for your programmer.

Finally, you'll find that Microchip will sample chips to hobbyists. Check
that out on their site. These are free samples and, at least to U.S.
addresses, have been shipped without cost (though I don't imagine that will
continue forever). Someone mentioned the 16F88 as an upgrade 16F84A. I agree
it is a good one to start with. The internal oscillator saves a couple of
I/O pins (and a few parts) and the analog inputs are available if you don't
want to stick with just digital. Also, larger memory.

Above all, have fun learning!

Best of luck,
Richard
 
Anthony Fremont wrote:

Eeyore wrote:

Seriously, the need to use assembler vanished
about 30+ years ago.

What an absurd statement.
Why would you NEED to use assembler do please tell.

Graham
 
"Anthony Fremont" <nobody@noplace.net> wrote in message
news:13hqcm6jsi4je42@news.supernews.com...
ian field wrote:
"Anthony Fremont" wrote:
ian field wrote:
What makes the 18F parts easier than the 16F parts? I must admit not
having paid much attention to the 18F parts - I think the Velleman

The short answer is banking. The chip still uses banking, it's just
that it powers on in such a state that all the SFRs are accessible
without having to manipulate banking control bits. Just makes life
a little easier on a beginner.

Thanks - that certainly sounds like it might be easier, maybe I could
look into 18F parts and leave bank manipulation until I've learned a
bit more about learning assy'.

www.picbook.com That book covers the 18F452, but it is not a beginner's
guide. It's a college level text book with nice real-world examples.

programmer has limited 18F support compared to 16F parts, they might
even be only supported via ICSP and also restricted by what is
supported by the burner application. Fortunately the programmer is
remarkably similar to the David Tait & Serpic1 designs, so I may be
able to search for programmer software with more devices supported.

If you can spare the money, buy a programmer, don't try to build one
of the el-cheapo designs on the net. Most of the "no parts" type
programmers depend upon conditions that most modern PCs don't
operate under. Trust me you will have enough issues to sort out
without having to wonder if your programmer is working. I use one
from www.melabs.com. It wasn't exactly cheap, but it's fast,
powered by USB cable and will program almost anything.

Unfortunately I'm not wealthy so I'll just have to make the best of
what I can afford. The velleman is supposedly a proven reliable
design although a bit dated by now, since that's what I've got that's
what I'll have to put up with for now.

It'll probably work fine. I believe I built a Velleman kit for Atmel
parts.

You may wish to consider a pre-made dev board from somewhere like
www.olimex.com. Some boards will make use a bootloader so that you
don't need a programmer at all, just a serial connection to the
board.
Over the past few months I've been trying many permutations of
Google search string, but most of the tutorials I've found assume
previous experience at writing assy for microprocessors.

I learned from looking at other code and using Peatman's first
book, but I had quite a bit of past experience with programming in
assembler. I could give you some sample code that I've written if
you want.

Does the Peatman book have an ISBN number? Most bookshops around
here are reluctant to make much effort finding books without an
ISBN and if its a US book we in the UK tend to get charged as many
Ł as the price in $ regardless of exchange rate - so I'm already
baulking at the price before I've even seen it!

ISBN: 0-13-046213-6 is the number for the book at www.picbook.com. Like
usual, the 18F452 has been superceded by newer parts with less
errata. The older book is ISBN: 0-13-759259-0 and the title is
"Design with PIC Microcontrollers". To give you an idea of it's
age, it talks allot about the 16C74 which was pre 16F84. I'd
recommend the newer one.

Thanks, I'll phone the book shop tommorrow - is Peatman the author or
the publisher?

The author. Take a good look at the web site. You can download sections
of the book and check it out now.
The book is Ł45 and the Velleman K8048 doesn't support 18F parts at all as
far as I can see, so it looks as if the fruits of the 18F parts may elude me
for the time being. OTOH - EPE magazine has switched it's Teach In series
from general electronics to a PIC tutorial, this is usually about secondary
school level so I never bothered reading it before but now its all PIC it
might be just what I'm looking for.
 
Anthony Fremont wrote:

Eeyore wrote:
Anthony Fremont wrote:
Eeyore wrote:

Why would you want to use assembly language ?

Hopefully because it's the right way to learn how to program AFAIC.

All of the worst code I've ever seen was written in assembler by
people who 'thought' they knew what they were doing.

ISTR that you're some kind of 8052 genius. Let's see some of your code.
I have some experience with the 8051 family, true. I don't make any special
claim to have written the most elegant code ever but it works utterly reliably
and is easy to maintain.


Assembly language makes NO sense whatever to my mind in the modern
world. Sure, it's cheap since it avoids the need for a usually paid
for compiler and that's your lot.

Of all the reasons I can think of to use assembler, that one is near the
bottom of the list. One closer to the top of the list would be to gain a
real understanding of what's going on in the hardware.
That's kind of academically interesting and I've often examined the internal
operation of certain parts of the 8051 internal hardware to educate myself about
those kind of things but it's not very relevant to writing decent code IMHO.


There's nothing like
coding an interrupt handler in assembler to get an idea of what's required
to be done by an ISR. I've had to work with way to many programmers who
didn't have the faintest idea of what takes place at low levels. Talk to a
JAVA evangelist to see what I mean. :-/
I can imagine that an interrupt might conceivably benefit most from 'tweaking'
like that but my experience with PL/M shows it to produce very competent
interrupts without any such need to tweak.

Graham
 
Jonathan Kirwan wrote:

Eeyore wrote:

Assembly language makes NO sense whatever to my mind in the modern world.

Flat, dead wrong. But then, I'm not surprised.

If you are seriously interested in defending that position, I will
present you with narrow, specific cases that come from __actual__
projects in real situations, complete with detailed analysis about why
and see if you can find a high level language to seriously promote
your above point. I will expect you to work, though.

Otherwise, I can tell you from actual experience with actual projects
that you are wrong -- in the modern world, no less.
On what architecture and comparing with what HLL ?

Graham
 
Jamie wrote:

Might as well forget coding in uC if you think that's a professional
way of going.
Are you seriously trying to suggest that using HLLs is *unprofessional* ?


And what the hell do you think was used for those BASIC,C etc.
compilers?
Why is that even remotely relevant ? It's NOT.


And what do you think goes in the chip at the end?
Not assembler for sure !


You do realize the majority of PIC's don't come with lots of
memory and clock speed to work with ? Using high level languages
just makes for bloated slower code there by, crippling the PIC
compared to what it could do.
Most uCs are massively overpowered for the job anyway. Sure if you use 'C' for
example you may produce large quantities of slow running code but I'm not here to
defend 'C' or any other kludgy language and/or compiler.

Graham
 
"Marra" <cresswellavenue@talktalk.net> wrote in message
news:1193091936.570121.61080@t8g2000prg.googlegroups.com...
The PIC user manual should be enough to get you started.

The best way I found was to play with the PIC and do simple things
like adding 2 numbers etc
Use the MPLAB simulator to try things out,

If you are struggling with assembler then go for a C compiler.
When in Rome - do as Romans as they say. From what I've seen most everyone
else is using assy', and there must be some reason for that. Although I've
got the impression from what I've read so far, that If I intend to make a
career boost out of PICs then somewhere down the line I'll have to learn to
program PICs in C as well.
 
"Tom2000" <abuse@earthlink.net> wrote in message
news:1q1rh3llm1jsi61k7347cje0g4k0gjobkb@4ax.com...
On Mon, 22 Oct 2007 15:05:25 GMT, "ian field" <dai.ode@ntlworld.com
wrote:

Does anyone have a link to any tutorials for PIC assembly?

Over the past few months I've been trying many permutations of Google
search
string, but most of the tutorials I've found assume previous experience at
writing assy for microprocessors.

Another problem is most of what I've found is HTML which is untidy to save
for later study and many pages lose their image files after being saved to
disk (anyone know why that happens?). Any help appreciated.

TIA.


Here's a nice tutorial series for beginners:

http://amqrp.org/elmer160/lessons/

To save an html page as a single file, use Internet Explorer and save
the file as "Web Page Complete (*.mht)" or something like that.

Have fun!

Tom
Thanks - that starts off simple enough and is mostly well written, but it
takes off a bit too fast, I've read it through but found on each successive
chapter I was skipping over the code examples and just getting what I could
from the text. Its a great tutorial but I need a little slower curve.
 
ian field wrote:

"Marra" <cresswellavenue@talktalk.net> wrote

If you are struggling with assembler then go for a C compiler.

When in Rome - do as Romans as they say. From what I've seen most everyone
else is using assy'
What on earth gave you that idea ?

I hope you'll like the added complexity involved.

Graham
 
On Tue, 23 Oct 2007 15:08:07 +0100, Eeyore
<rabbitsfriendsandrelations@hotmail.com> wrote:

Anthony Fremont wrote:

Eeyore wrote:

Seriously, the need to use assembler vanished
about 30+ years ago.

What an absurd statement.

Why would you NEED to use assembler do please tell.

Graham
12F683
 
On Tue, 23 Oct 2007 14:36:24 GMT, "ian field" <dai.ode@ntlworld.com>
wrote:

When in Rome - do as Romans as they say. From what I've seen most everyone
else is using assy', and there must be some reason for that. Although I've
got the impression from what I've read so far, that If I intend to make a
career boost out of PICs then somewhere down the line I'll have to learn to
program PICs in C as well.

Your choice of programming tools depends on the processor and the task
at hand.

If you're writing a small rouine in one of the lower-level processors,
assembly is warranted.

As your project size increases on the larger machines, pure assembly
becomes too time consuming. For those, you'll want to use C or
another high-level language, for the most part. However, if
performance is a goal, you'll still find yourself writing your
workhorse functions in assembly code embedded within your C routine.

So I'd say that, if you want to have fun in PICville, you really need
to learn both.

You've got to start somewhere, though, and starting with a simple
assembly tutorial on a lower-level processor is a good place to begin.

(Oh, and while I'm discussing tutorials, work through the exercises as
best you can using the processor you have avaiable. You can't skip
the experiments. Try them out, study them, learn how they work, and
to prove to yourself that you understand each lesson, try modifying
the code in each exercise to see if it works that way you expect.)

Tom
 
On Mon, 22 Oct 2007 20:13:55 +0100, Eeyore wrote:

Tim Wescott wrote:

Eeyore wrote:
ian field wrote:

Does anyone have a link to any tutorials for PIC assembly?

Over the past few months I've been trying many permutations of Google search
string, but most of the tutorials I've found assume previous experience at
writing assy for microprocessors.

Why would you want to use assembly language ?

IIRC, there's a neat free high level language for PICs but since I don't use
PICs, I never bookmarked it.

Several reasons:

For _really teeny_ bits of code it's easier to just write in assembly
than to deal with the C runtime environment.

Who said anything about C ? Blech !


For _really fast_ bits of code you'll almost always get more speed out
of assembly than compiled C.

Who said anything about C ? Blech !


For _really odd_ bits of code you often can't do things in C at all, or
you get absurd levels of code bloat compared to what you can do in assembly.

Who said anything about C ? Blech !


There's no better way to learn how a microprocessor really works.

I disagree. Obsessing with operation at register level is academically interesting
but of almost no value to a coder and 'getting the job done'.


Many micro-based projects require just a bit of assembly programming to
really work well, and you can't do that unless you've got someone on
your team who can work in assembly. Even when they don't, understanding
what the processor is doing 'underneath C' can be invaluable for debugging.

Who said anything about C ? Blech !

Graham
In the embedded world we call people with the skill set to go with your
attitude "applications programmers".

It's not a compliment.

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
 
On Tue, 23 Oct 2007 15:22:42 +0100, Eeyore
<rabbitsfriendsandrelations@hotmail.com> wrote:

Jonathan Kirwan wrote:

Eeyore wrote:

Assembly language makes NO sense whatever to my mind in the modern world.

Flat, dead wrong. But then, I'm not surprised.

If you are seriously interested in defending that position, I will
present you with narrow, specific cases that come from __actual__
projects in real situations, complete with detailed analysis about why
and see if you can find a high level language to seriously promote
your above point. I will expect you to work, though.

Otherwise, I can tell you from actual experience with actual projects
that you are wrong -- in the modern world, no less.

On what architecture and comparing with what HLL ?
I am NOT thinking of any particular HLL, since the solution to one of
the problems/cases I have in mind cannot be solved properly in any I
know of. (There are many other cases which cannot be solved in C or
C++, but can in CLU or some other HLL -- but I'm eliminating those
thoughts just in case you happen to be familiar with every HLL I am
familiar with.) The architecture I'm thinking of is the case for most
microcontrollers without branch detection and cache. Even in those
cases, it probably applies, but the detailed answer will depend a
little.

Mostly, my problem with your statement is that it is obviously made
from the perspective of a god, which I know you are not. You don't
have the perspective to say it. And I'm prepared to show you cases
(more than one) which can give the lie to it and demonstrate that you
lack perspective in making it. If you hadn't been so sure of yourself
and had toned down the sweeping nature, I'd have left it be. But you
said what you said and I have a few cases to easily take it down a
notch or two.

I could tell you the upshot of one of the cases, right away, without a
lot of todo. And if you go back and use google to read my posts in
comp.arch.embedded, you will actually find some cases I mentioned
there for exactly this purpose. So you don't have to be caught
flat-footed, if you don't want to be. But they have been examined by
others and I don't recall anyone doing anything but finding the cases
sufficient to make the point. You could be the first to find the
flaws in what I will write, though. And these are actual cases from
real projects I've faced. Not made up school problems.

Jon
 
"Richard Seriani" <richard_s633@cox.net> wrote in message
news:vPjTi.11299$BT5.19@newsfe18.lga...
"ian field" <dai.ode@ntlworld.com> wrote in message
news:V_2Ti.20084$0z6.19665@newsfe7-win.ntli.net...
Does anyone have a link to any tutorials for PIC assembly?

Over the past few months I've been trying many permutations of Google
search string, but most of the tutorials I've found assume previous
experience at writing assy for microprocessors.

Another problem is most of what I've found is HTML which is untidy to
save for later study and many pages lose their image files after being
saved to disk (anyone know why that happens?). Any help appreciated.

TIA.
Ian,

Try these. Some are better than others and some have mistakes - but,
you'll be able to spot those within a short time.

http://www.mikroe.com/en/books/picbook/picbook.htm
http://www.winpicprog.co.uk/pic_tutorial.htm
http://www.mstracey.btinternet.co.uk/pictutorial/picmain.htm

Saving these to your hard drive can be done with a right-click and save
as. It creates two files, one is the html document and the other is a file
folder with the graphics. At least, it does on my Windoz machine.

In a later post, someone also recommended the PIC Elmer 160 tutorial. That
is a good one and each of the lessons downloads as a PDF.
<snip>

Many thanks, the first link is *very* interesting - I may already have the
other 2 saved. The Elmer 160 starts off simple enough but the code examples
quickly get heavy going, I need to go over a lot of simpler code over and
over until I get the hang of it.
 
Tom2000 wrote:
On Tue, 23 Oct 2007 15:08:07 +0100, Eeyore
rabbitsfriendsandrelations@hotmail.com> wrote:



Anthony Fremont wrote:

Eeyore wrote:

Seriously, the need to use assembler vanished
about 30+ years ago.

What an absurd statement.

Why would you NEED to use assembler do please tell.

Graham

12F683
Funny that you should mention that particular part. It's a much more
capable processor than it's name would have people believe. Even though
it's a 12F label, it's still a 14-bit core (like the 16F series parts)
making it the king of the 8 pin parts. Now something like a 10C with a
two-level stack..........
 
ian field wrote:
Many thanks, the first link is *very* interesting - I may already have the
other 2 saved. The Elmer 160 starts off simple enough but the code examples
quickly get heavy going, I need to go over a lot of simpler code over and
over until I get the hang of it.
have a look at:
http://www.dontronics.com/see.html
this may give you a different slant on assembly.

Don...



--
Don McKenzie

Affiliate Program: http://www.dontronics.com/affiliate
Site Map: http://www.dontronics.com/sitemap
E-Mail Contact Page: http://www.dontronics.com/email
No More Damn Spam: http://www.wizard-of-oz.com

Serial OLED uses standard micro-SD memory cards.
http://www.dontronics-shop.com/product.php?productid=16659
 

Welcome to EDABoard.com

Sponsor

Back
Top