1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Would you like to write a PIC book with me?

Discussion in 'Electronic Books' started by blueroomelectronics, Nov 23, 2007.

  1. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    I wonder how an AVR vs 18F PIC thread would look, or AVR vs dsPIC... :)
     
  2. Thunderchild

    Thunderchild New Member

    Joined:
    Jul 3, 2005
    Messages:
    2,294
    Likes:
    9
    Location:
    UK
    well as I'm new to pics I don't know if 18F is more difficult to program in assembly than 16F pics
    but I think one 16F should be mentioned
     
  3. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    Ahh there's the popular belief, IMO the 18F is no harder to learn than a modern 16F.
    The minimal need for bank switching and that RAM starts at 0x00 helps.
    You also never need to worry about RMW if you use LATx
    The 18F was designed with C in mind and you can even get a decent free C18 compiler.
    IMO the 18F1320 is a nice 18pin starter chip, it's not as fully featured as many (no comparators, no SPI, no internal clock 4xPLL :( ) but it's still a great chip to start with.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. bananasiong

    bananasiong New Member

    Joined:
    Mar 7, 2006
    Messages:
    1,893
    Likes:
    7
    Location:
    Malaysia

    Yes, it's good to have the knowledge of 14-bit core's 35 instructions. Many of the 75 instructions in 18F are similar to 16Fs'. The bank switching in PIC18 makes my life easier. When using PIC16, I always check the datasheet for the bank of that particular register (even the 'find' of pdf can be used, but it is still time consuming).
    I don't know C18, even haven't used all the 75 instructions in PIC18 :p
     
  6. Thunderchild

    Thunderchild New Member

    Joined:
    Jul 3, 2005
    Messages:
    2,294
    Likes:
    9
    Location:
    UK
    exactly learning the 16F MCUs is 2/3 the way of learning the 18F as you already know the MCU architechture and half the instructions
     
  7. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    I've got to start posting 18F tips of the day.
    Todays:
    You can treat W just like any other file register.
    Eg:
    Code (text):
    decfsz WREG
    Very handy for delay routines...
     
  8. Thunderchild

    Thunderchild New Member

    Joined:
    Jul 3, 2005
    Messages:
    2,294
    Likes:
    9
    Location:
    UK
    well have you any pages ready to show us ?
     
  9. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    Soon Soon, I've been so busy lately I've not had time to work on the book.
     
  10. bananasiong

    bananasiong New Member

    Joined:
    Mar 7, 2006
    Messages:
    1,893
    Likes:
    7
    Location:
    Malaysia
    Oh really??!!?? I didn't know about this even I'm using a PIC18 :p
    Is this applied for all the instructions that associated with the RAM?

    Is WREG defined in the include file? Or can I straight away use w?
     
  11. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    You can use WREG right away it is defined in the .inc file, it's just another SFR in the 18F and above PICs. I got the idea from Pommies servo program (he does it with the 16F PIC using an addlw $FF sneaky)
    Code (text):
    Delay        
        dcfsnz  WREG    
        return              
        bra     Delay
     
  12. bananasiong

    bananasiong New Member

    Joined:
    Mar 7, 2006
    Messages:
    1,893
    Likes:
    7
    Location:
    Malaysia
    Oh I see, thanks ;)
    I'm using the Delay part of Pommie's servo program as well. Still remember it is 8*w instruction cycle :)
    Didn't notice WREG in 18F, seems I have to somehow modify my program especially the delay part.
     
  13. Funny NYPD

    Funny NYPD New Member

    Joined:
    Oct 4, 2007
    Messages:
    177
    Likes:
    2
    Location:
    USA
    waiting for the new book.
     
  14. 43617373

    43617373 New Member

    Joined:
    Oct 14, 2007
    Messages:
    45
    Likes:
    0
    Location:
    BC Canada
    This was such a great project, what ever happened to it? Is there anything I can do to help it get on track again?
     
  15. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    I've been so busy with the Ladybug project I've only got a little time to work on it but I'll keep going.
     
  16. mashersmasher

    mashersmasher New Member

    Joined:
    Apr 2, 2008
    Messages:
    127
    Likes:
    2
    if you guys did this i'd get it and make a donation regardless. i've found it a bit tricky finding pic info and making a free information book would be a really big help for all of us new people. i was deathly afraid of pics when i started so i went with a bs2. now i know how inefficient they are and how much cheaper/better pics alone are.
     
  17. adaminc

    adaminc New Member

    Joined:
    Jun 20, 2005
    Messages:
    64
    Likes:
    0
    Location:
    Oshawa, Ontario, Canada
    You should come up with a list of subjects, in relative order, then we could give suggestions on what to include.

    Here are some of the things I had to learn when starting with ucontrollers.

    • Choosing a Crystal (and the appropriate Decoupling Capacitors)
    • Issues with stray capacitance on breadboards
    • Setting up the Internal Oscillator
    • Turning off unused features (like the Comparators)
    • Making Ports Analog/Digital
    • Setting up Interrupts (learning that there is no vector table on 18f and lower).
    • Setting up/Reading the ADC
    • Using an LCD(HD44780) 4bit/8bit modes
    There are more, but I cant think of any more this late at night, anyways.

    I also think that maybe you should try and make it more abstract, and not focus on a specific device when talking about a topic, then after the theory you could have links to source-code for specific pic devices in specific languages.

    i.e. You could talk about setting up and reading from the ADC by talking about setting certain registers, then reading from certain memory locations etc.. Then you could provide asm code for 1 or 2 popular 16f's and 18f's, then some ansi C code for 16f's and 18f's.

    This is an idea I have been toying with since I have started to rewrite my PIC libraries, by creating a tutorial then tacking my code on it.
     
  18. SuperTech

    SuperTech New Member

    Joined:
    Apr 13, 2008
    Messages:
    2
    Likes:
    0
    If you write this book please do not make it hard to understand. I had to take a microcontroller course and I hated it because the book we used, "PIC Microcontroller: An Introduction to Software & Hardware Interfacing" is the worst book at communicating to the reader how to program a pic. The author of that book assumed too much of prior knowledge of the reader. So please make your book NOOB friendly....
     
  19. vdd

    vdd New Member

    Joined:
    Oct 3, 2007
    Messages:
    39
    Likes:
    5
    This book is focus on the PIC 18F series, it might be bit advance for absolute beginners.
     
  20. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    Actually the 18F series PICs are easier than the 16F IMO. I thought the same thing ages ago but the 18F feels right, great compilers and the free versions of C18 & Swordfish BASIC are awesome.
     
  21. vdd

    vdd New Member

    Joined:
    Oct 3, 2007
    Messages:
    39
    Likes:
    5

    Would it be easier for an absolute beginner to start with the 16F series? Or is it better to start with the 18F series?

    I mean a beginner might be overwhelmed by so much new features the 18F series have.
     
    Last edited: Apr 13, 2008

Share This Page