PIC 18F Series

Thread Starter

R!f@@

Joined Apr 2, 2009
9,918
I am running into issues even with the 20*4 LCD with too much Msg's

Last project (ADC checker) is working upto 3 Rows.
Error msg is RP bit should be set manually for indirect addressing or something. I will post about it later.

I have read all these issues will be cleared if I use 18F series PIC's

I like to know what no's should I keep in stock.
There are few here who knows about the 18F part no.s that are needed to keep in hand for projects as such.

I am not yet familiar with those yet.
So a suggestion about PIC18F no's that I can keep in stock will be a lot of help and I can look up the data to study them.

8 pins to 40 pins will be suitable.
 

Thread Starter

R!f@@

Joined Apr 2, 2009
9,918
I found a PDF.
Attached below.

Are these all there is about 18F's ?

Looking at the PDF I made a little list

1. PIC18F1320
2. PIC18F2320
3. PIC18F258
4. PIC18F452
5. PIC18F458

How's this list for a general Stock.
If OK, I can start saving.
 

Attachments

Last edited:

MaxHeadRoom

Joined Jul 18, 2013
28,619
Apart from a few 18pin 18F1220, most projects I have covered so far have been with the 28pin versions.

I have used both the 28pin 18F2221 & 18F23K22, for anything larger, 40pin 18F46K22.

The K22 series require a programmer with later firmware, if using Pickit it is only the 3 that covers the K22 series. Otherwise Pickit2. covers the rest.
The advantage of the K22 series is multiplexing of pins, so you do not get stuck having to go with a larger Pic if using a variety of modules in one μp, e.g. ECCP, Usart, T1OSC etc.
Max.
 

JohnInTX

Joined Jun 26, 2012
4,787
When picking things like 18F452, look for 18F4520 which is a later (fewer bugs) version of the 452. Frequently, bringing up an older part will get a suggestion for a later version. Always use the later version.

Then look at the errata for your prospective chip. Go for one with 'B' level silicon or better with few reported issues. I don't use any 'A' level silicon if I can avoid it.

In a given package the lines shake out along memory/RAM amounts then peripherals. Buy the one with the biggest memory, the cost difference is negligible compared to the hassle of running out of memory. If you filter the selection guide for pins/Vdd and peripheral set, it cuts down the number of chips to something manageable.

Lots of RAM is a must with MicroC.

Have fun.

Just curious, what's the cheapest way to ship to Maldives? Any customs issues?
 
Last edited:

BobTPH

Joined Jun 5, 2013
8,813
What is the problem you are having with 16F PICs? There is nothing magical about 18F that makes it better for use with and LCD.

Are you talking about storage for messages? If you have a lot of text to store, you should store it in program memory.

Bob
 

Thread Starter

R!f@@

Joined Apr 2, 2009
9,918
Cannot quote to every one so.
@Max.
I have easyPIC7 Eva Board.

@John
I chose all the ones with BIG memory and all tht I left out the smaller memory ones.
Get 18F4520 instead of F452. OK I will look into it.
"B" ..? Is this the prefix or version ?
Does it mean 18F4520B ???

I have custom issues from time to time. But small postal packages are not an issue.
Cheapest way is just standard shipping I think.
From Aliexpress it is Hongkong post or Chinese standard shipping (insured). It is the cheapest.
Ebay also standard international shipping(insured or with tracking)

@Bob.
I am trying to get my codes completed with LCD. I am getting weird characters with 16F with too many msg's.
The VA meter project is done with fewer msg's but I like to include two more in it
The ADC checker got busted at the 4th Row.
Cannot put any more msg's.
My main issue which I haven't been able to find an answer so far is storing the msg's in Program memory.

Is it the EEPROM ?

I still like to know how I can do it. Cause I am not running out of memory, Statistics (mikroC Pro) shows tht but still msg's get corrupted.
 

BobTPH

Joined Jun 5, 2013
8,813
@Bob.
I am trying to get my codes completed with LCD. I am getting weird characters with 16F with too many msg's.
The VA meter project is done with fewer msg's but I like to include two more in it
The ADC checker got busted at the 4th Row.
Cannot put any more msg's.
My main issue which I haven't been able to find an answer so far is storing the msg's in Program memory.

Is it the EEPROM ?

I still like to know how I can do it. Cause I am not running out of memory, Statistics (mikroC Pro) shows tht but still msg's get corrupted.
Program memory is program memory, the memory that stores the program. You can also read and write it in a program on any modern PIC. You could also use EEPROM for the message text, but it is usually only 256 bytes, so you might run out of it. If you are using RAM, the problem with PIC16F is that the RAM is broken up into small, discontinuous chunks, and 18F does not have that problem, but any constant text should not be in RAM anyway since that is wasteful. Look at your MicroC doc's to see how you can store text in either program memory or EEPROM. Note that you will need a special function to write from one of these to the LCD. If the MicroC library has support for LCD, it should have support for strings in program memory as well.

Bob
 

JohnInTX

Joined Jun 26, 2012
4,787
@John
I chose all the ones with BIG memory and all tht I left out the smaller memory ones.
Get 18F4520 instead of F452. OK I will look into it.
"B" ..? Is this the prefix or version ?
Does it mean 18F4520B ???
You can't tell from the part number. You CAN tell from the Device ID and Revision ID that is accessible by most programmers (you also can read it at runtime on some parts). While the parts have 'date codes' the silicon rev is not readily apparent on many of them (contact the Microchip sales office or tech support).
EDIT: the Programming Specifications for the chip will tell you if you can access the DeviceID/Rev and how to do it at runtime.

Here's what I mean about the silicon revs (for an 18F4520) Compare errata sheets for silicon Rev A1 with Rev B4. 44 issues in the A1! Can't hardly move without getting busted. Some of the latest parts come out of the chute pretty clean but as I've said before:
The data sheet giveth, the errata taketh away.

To minimize the risk of getting older, buggy chips, buy from a franchised, high volume distributor, not Ebay, not brokers. Non-franchised guys frequently have excess stock from years back.

If the MicroC library has support for LCD, it should have support for strings in program memory as well.
Good point. Specify 'code' to put in ROM i.e.
Rich (BB code):
const char code aString[]="Hello"; // vs.
const char bString[]="There";
but looking at the generated code, it is the same, at least for this. In our earlier display multiplexer, either one made the tables/strings in ROM. Maybe the optimizer makes use of 'code' but I don't know... Its good as it is.

One possibility for your messaging problems is that MicroC does NOT completely handle the midrange RAM like it should. From the manual:
Limits of Indirect Approach Through FSR
Pointers with PIC16 are “near”: they carry only the lower 8 bits of the address. Compiler
will automatically clear the 9th bit upon startup, so that pointers will refer to
banks 0 and 1. To access the objects in banks 2 or 3 via pointer, user should manually
set the IRP, and restore it to zero after the operation. The stated rules apply to
any indirect approach: arrays, structures and unions assignments, etc.
Note: It is very important to take care of the IRP properly, if you plan to follow this
approach. If you find this method to be inappropriate with too many variables, you
might consider upgrading to PIC18.
Note: If you have many variables in the code, try rearranging them with the linker
directive absolute. Variables that are approached only directly should be moved to
banks 3 and 4 for increased efficiency.
THe 16F887 requires IRP to access RAM banks 2 and 3 via the FSR registers. Look at your assembler output, search on the name of the message with an underscore i.e. _string. If you see it using FSR, you probably have a problem. Looking at DigitsBuf[] in the charger project, I see it doing just that.

18F - yes.
 
Last edited:

Thread Starter

R!f@@

Joined Apr 2, 2009
9,918
I see what you are saying.

I was going to ask about where to buy the 18F. So ebay is out.
Wht about Digikey or Mouser.

Which supplier would you buy from ?

Last night I tried const char approach and even though I see tht the RAM usage is getting minimized I get problems. Sometimes it works sometimes it doesn't.
I learned how to put the code in PM and copy it to RAM before sending to LCD.
Still the problem exists. I guess I have to use 18F for LCD's.
 

MaxHeadRoom

Joined Jul 18, 2013
28,619
I buy from DigiKey, no problems so far.
A main reason for me is overnight delivery to Canada with no brokerage chgs and flat rate shipping.
Max.
 

BobTPH

Joined Jun 5, 2013
8,813
I buy from Microchip direct, which always has the lowest price, but the shipping is from Thailand, so it takes about 2 weeks.

Bob
 
Top