Author Topic: PIC24 assembler templates  (Read 8621 times)

0 Members and 1 Guest are viewing this topic.

Offline deephaven

  • Frequent Contributor
  • **
  • Posts: 785
  • Country: gb
  • Civilization is just one big bootstrap
    • Deephaven Ltd
PIC24 assembler templates
« on: July 20, 2011, 01:03:15 pm »
I'm after an initial template file for a PIC24 series device. There's lots of stuff to define with all those interrupt vectors etc and it would just take away some of the work and possible mistakes if this was already defined somewhere. I couldn't find anything on the Microchip website which only wants you to use C it seems. So do any templates exist?
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: PIC24 assembler templates
« Reply #1 on: July 20, 2011, 08:27:03 pm »
I vaguely remember the same question being asked on the Microchip forums, can't remember if there was any useful response. Few people are mad enough to want to program in assembler a processor which has a decent (free) C compiler and architecture to use it.

 

alm

  • Guest
Re: PIC24 assembler templates
« Reply #2 on: July 20, 2011, 09:40:51 pm »
I would expect the number of people programming a fairly large MCU entirely in assembly is quite low. Assembly is usually reserved for the small 6-8 pin devices with very limited amounts (if any) of RAM and ROM. It takes a lot of man years to fill up an average PIC24 in assembly. That might explain your troubles finding anything.
 

Offline deephaven

  • Frequent Contributor
  • **
  • Posts: 785
  • Country: gb
  • Civilization is just one big bootstrap
    • Deephaven Ltd
Re: PIC24 assembler templates
« Reply #3 on: July 21, 2011, 09:03:03 am »
I'm basically a hardware guy, however I have done quite a bit of programming for the PIC16 and PIC18 series always in assembler. I always think in 'hardware' terms and am uneasy with the vitualisation C gives you. I know you can have a look at what assembly the C has complied to, but then you just might as well written it in assembler in the first place.
 

Offline johnmx

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: pt
Re: PIC24 assembler templates
« Reply #4 on: July 21, 2011, 12:24:53 pm »
Search Microchip’s website for ‘Code Examples’. Under the PIC24 examples, some are written in assembly. Modify and use any of those files as your template.

http://www.microchip.com/TechDoc.aspx?type=CodeExamples
Best regards,
johnmx
 

Offline deephaven

  • Frequent Contributor
  • **
  • Posts: 785
  • Country: gb
  • Civilization is just one big bootstrap
    • Deephaven Ltd
Re: PIC24 assembler templates
« Reply #5 on: July 21, 2011, 01:29:50 pm »
Search Microchip’s website for ‘Code Examples’. Under the PIC24 examples, some are written in assembly. Modify and use any of those files as your template.

http://www.microchip.com/TechDoc.aspx?type=CodeExamples

As far as I could see these are either for 16/18 series, anything higher is in C.

As there didn't seem to be a shortcut I gave in and read the docs and have managed to create a framework which works.
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: PIC24 assembler templates
« Reply #6 on: July 21, 2011, 02:16:05 pm »
I'm basically a hardware guy, however I have done quite a bit of programming for the PIC16 and PIC18 series always in assembler. I always think in 'hardware' terms and am uneasy with the vitualisation C gives you

I currently have a task to port and rewrite in C about 11 kloc of ugly assembler, written by someone who probably felt the same way. I reckon it is going to take a couple of months although half that is down to it being poorly documented and what it does being complicated. In the past I have ported 4 kloc of C doing similarly complicated low level hardware control to a new processor in a day and a half.

Not like C is a high level language, many people (me included) consider it to be portable assembler.
 

Offline hisense999

  • Contributor
  • Posts: 39
Re: PIC24 assembler templates
« Reply #7 on: July 21, 2011, 08:41:14 pm »
I'm basically a hardware guy, however I have done quite a bit of programming for the PIC16 and PIC18 series always in assembler. I always think in 'hardware' terms and am uneasy with the vitualisation C gives you

I currently have a task to port and rewrite in C about 11 kloc of ugly assembler, written by someone who probably felt the same way. I reckon it is going to take a couple of months although half that is down to it being poorly documented and what it does being complicated. In the past I have ported 4 kloc of C doing similarly complicated low level hardware control to a new processor in a day and a half.

Not like C is a high level language, many people (me included) consider it to be portable assembler.

Perfect explaintation, this is why nobody use assembler today, and why C is so common, C is nothing more than friendly assembler - just assembler lovers not understand C enought, with understanding of pointers and references C code is translated into perfectly optimised assembler, yes assembler is must to know but only to get clue how to code in C to get optimised ASM code and I don't know any assembler guy which can win with modern C compilers :)
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 10317
  • Country: my
  • reassessing directives...
Re: PIC24 assembler templates
« Reply #8 on: July 22, 2011, 12:48:53 am »
Perfect explaintation, this is why nobody use assembler today,
ekkk... wrong! it should be... "Perfect explaintation, this is why i dont use assembler today" i here means you, not me.
It's extremely difficult to start life.. one features of nature.. physical laws are mathematical theory of great beauty... You may wonder Why? our knowledge shows that nature is so constructed. We simply have to accept it. One could describe the situation by saying that... (Paul Dirac)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf