Re: PIC under Linux developpement Howto

David McNab <[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.gnupic
Message-ID <[email protected]>
Christopher Bergeron wrote:
> I'm going to have to second this one.  However, there's a part of me
> that thinks that having choices will be confusing to newbies.

Well. in the light of all this reaction, allow me to amend my original
suggestions:

 * C is most useful IMHO - more useful than dumbed-down high-level langs
   like BASIC, and less annoying for the newcomer than assembler, and
   easy to interface with assembler

 * another alternative is PyAstra - a cut-down Python to PIC assembler
   compiler - but Python scares many folks because whitespace is
   syntactically significant, so should probably stick with C instead

 * assembler is menial - justified only when performance or environment
   limitations necessitate it - you get way more functionality per litre
   of blood/sweat/tears when programming in higher level languages,
   because it's way easier to concentrate on the 'what' without being
   constantly distracted by the 'how' - basic stuff like parameter
   passing, data structures, and (in the 16F case) those damn fragmented
   program/data memory segments etc etc - C compilers spare the user of
   all that crap

 * a howto should take the user, step by manageable and verifiable
   step, from a bag of parts and an internet connection through to a
   board with a blinking 'hello world' LED, and then through to other
   PIC stuff like ADC, PWM, USART etc - without them needing to spend
   a cent on anything other than hardware

 * I'd suggest sdcc - it's not the prettiest C compiler, but it can
   do the simple stuff, and it's speech/beer free, and available on
   all decent linux distros

 * I'd suggest the 16F876/7 as the main chip, since it can self-program,
   it has the on-chip goodies, and it's cheaper than the 18Fs; upgrading
   from 16F to 18F is orders of magnitude easier than the other way
   round; also it's got less memory scarcity than (say) the 16f873

 * for a programmer - probably best to pick one that:
    - has minimal parts count
    - can work via serial port (PCs usually have 2 serial ports but only
      one parallel port, and the parport is often in use with a printer)
    - has PCB artwork and parts list, plus working Linux-compatible
      on-chip and on-host programming software, freely downloadable from
      the net (I bought a great programmer kit from Jaycar, but can't
      recommend this because Jaycar only has stores in Aus and NZ, and
      this would be a pain for people in other countries)

 * for a bootloader - I'm personally using TinyPIC Bootloader on my
   18Fs, but haven't got this working on the 16Fs (so I use the PicForth
   Serial Monitor on those chips) - need to choose a bootloader which:
    - is written in assembler and builds ok on gputils, or is written in
      C and builds ok with sdcc
    - has a working host client written in a common language, that is
      easily built with reliable results without dragging the user
      through autocrap/dependency hell (as linux progs can sometimes do)

 * tutorial should include a section on gpsim, using .map and .lst files
   so user can correlate the high-level code to the raw binary; should
   walk user through:
    - setting up gpsim config
    - single-stepping and use of breakpoints
    - inspecting SFRs and user data memory contents

This approach eliminates the complication of multiple
chips/languages/programmers.

-- 
Cheers
David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.