|
|
View previous topic :: View next topic |
Author |
Message |
Regular Guy
Joined: 04 Jun 2017 Posts: 110
|
Assembler-Inputs |
Posted: Fri Sep 04, 2020 5:23 pm |
|
|
Any words of wisdom?
16F84A
Microchip Picdem 4
Microchip ICD2
MPLAB 8.40 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19542
|
|
Posted: Sat Sep 05, 2020 12:46 am |
|
|
But, also I have to ask 'why'?.
It has reached the point now, where it is possible to do pretty much
everything that can be done using assembler, directly in C, with no
extra overhead. To the point now, where I'd say "don't bother with
assembler", for 99.99% of situations. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
Posted: Sat Sep 05, 2020 5:08 am |
|
|
Mr. T asks 'why' ?
some reasons I can think of..
1) better understanding of HOW a PIC operates. By programming in Assembler you're as close to 'playing computer' as is possible ! High level languages 'mask' or 'hide' HOW things are done. Depending on how a 'function' was coded it might take longer or use more space than being done in Assembler. The better you understand how a PIC works, the better you can program it.
2) easier to learn.OK, I'm ready for the replies.... but PIC's only have 30-35 instructions far, far less than any version 'C' or other high level language. Once you learn the 'basics', you'll quickly build your own library of functions.
3) speed and size. Generally Assembler will create smaller, faster programs. While the CCS compiler is very smart and can 'optimize' code, handcoding in Assembler can SHOW you how to make 'better' programs. Today's PICs have LOTS of memory, speed and internal peripherals but in the 'good old days' you HAD to understand the PIC to take advantage of every bit of every byte, learn how registers work, etc. Microchip printed 'Tips and Tricks' filled with clever code to maximize PIC performance. Early application notes showed how to 'do the impossible'.
4) Comments ! When cutting code in Assembler, you almost always add a comment at the end of every line of code. It's an EASY way to figure out the next day WHY you did this or that. Even better, days or months later, you can READ why you did it, saying 'gee that was clever or grr..that was silly, I should have coded.....'
I started with the 16C84 and Assembler, then bought PCM v2.534, self taught myself CCS C, so I'm NOT a C programmer I kinda bodge this into that, getting programs to work. I only 'play with PICs' today, SMT is too small, heck DIPs are difficult to see too ! Pre-made 'Modules' are nice though !! |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Sat Sep 05, 2020 9:03 am |
|
|
temtronic wrote: | self taught myself CCS C, so I'm NOT a C programmer I kinda bodge this into that, getting programs to work. |
That seems to be a common situation hahah... In my case, I was hired as "mechanical design engineer" and then two weeks in they said "hey didn't you learn something about rs232 or something or other back in school?". I said "uh... yes" and I've been at this since then.
But I gotta agree with Ttelmah here. If you want to get started then just use C to get results. You can dive into the disassembly file afterwards to see how the PIC does things by assembly. To be honest, I still haven't had to do that. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|