Continue to Site

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.

  • 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.

Started to use the 18F series comments.

Status
Not open for further replies.

blueroomelectronics

Well-Known Member
Well some of you may know I'm working on a motorized robot platform called Mongoose and for its processor I've chosen the PIC 18F2525 (a 16F886 can also be used). See the thread in Robotics for info & pictures.

I chose the 18F2525 because
  • Two PWM outputs (one for each motor)
  • 24K Program space (48K bytes)
  • 1K EEPROM (might add an I2C EEPROM to the board...)
  • Free C18 compiler (student edition)
  • Works with the Inchworm ICD2
Now I've began writing small programs for it and let me share my experince so far.

I like it, I would even go so far to say if you've used the 16 series PICs the 18 series will seem easy.

For starters you don't need STATUS, RP0 nearly as much (not used it yet)
  • very little bank switching (unlike the 16 series)
  • you can get to the CONFIG memory
  • much larger linear address space (RAM included)
  • a LATx (latch) command makes using the ports better
  • all support the debug mode
  • 72 instructions including a movff (move FSR to FSR directly)
  • designed for C (but assembly is just fine)
  • very compact code possible
What may be harder...
Lots of CONFIG settings can be a little daunting at first but are manageable.
Appears you set CONFIG differently than the 16 series
ie CONFIG1H = 0x40 (simpler actually)
 
blueroomelectronics said:
Lots of CONFIG settings can be a little daunting at first but are manageable.
Appears you set CONFIG differently than the 16 series
ie CONFIG1H = 0x40 (simpler actually)

When I started using 18F, I was slightly annoyed by the number of config settings. However the supplied chip specific INC files actually include the latest format of config settings (they are commented out).
I found it easier to copy them from there into a separate INC file for each project and change any settings there.
 
Hi,

The 18F2525 comes in 28/PDIP 300mil. What does the 300mil means? I found a 40 pins version, 48kWords, great for user who are familiar with the 16F877 and need the extra memory.
 
tnay said:
Hi,

The 18F2525 comes in 28/PDIP 300mil. What does the 300mil means? I found a 40 pins version, 48kWords, great for user who are familiar with the 16F877 and need the extra memory.

300mil means it's a skinny dip. (0.3" wide like most small DIP ICs)
 
Once you go 18F you'll be reluctant to go back to the 16F series.

The only gotchas I've found so far are the read-write-modify ones and I had one design that used to glitch at random intervals. Turned out that if it had an interrupt iwhen running a particular line of code it wouldn't execute the next instruction after the return.

This was cured after a week of debugging by using the "RETURN FAST" command.
 
read-write-modify has been fixed if you use the LAT command I thought.

I'm not that familiar with its extended commands but it is in fact easier to use than 16 series chips.
 
I surely appreciate a larger memory for my case as I need to do a lot of real time calculation for my project. Anyway, I ordered a sample of both today. I'm very new to PIC and I have only worked on 16F877A using CCS C compiler. I wonder how it works on 18F.
 
C compiler for pics is not as useful as for pc though. Many different #pragma's need to be memorized in order to use it. I wonder if code from C18 can be ported to C30? This would be very useful for code reuse in 30F series.
 
The addition of LAT register
The increase of RAM memory
The extra (useful) instructions
Bank switching less frequent(?) and simpler

makes, (to me), for not thinking of going back to 16F family.
 
the #pragma statements are very compiler dependent. I'm using general preprocessor directives here, which are the standard C. I only taught myself using C, because assembly language is just too much for my project. I have a lot of complex real time calculation like sorting and masking, it's just not feasible for writing in assembly, imagine bugging through thousands of line.
 
Status
Not open for further replies.

Latest threads

Back
Top