CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Assembler-Inputs

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Regular Guy



Joined: 04 Jun 2017
Posts: 110

View user's profile Send private message

Assembler-Inputs
PostPosted: Fri Sep 04, 2020 5:23 pm     Reply with quote

Any words of wisdom?

16F84A

Microchip Picdem 4

Microchip ICD2

MPLAB 8.40
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Sep 04, 2020 5:47 pm     Reply with quote

Read the Microchip PIC16 Reference manual section on i/o ports:
http://ww1.microchip.com/downloads/en/devicedoc/31009a.pdf
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Sat Sep 05, 2020 12:46 am     Reply with quote

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: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Sep 05, 2020 5:08 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Sat Sep 05, 2020 9:03 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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