24C256 is 32KB EEPROM.
So I'm using it, because I need that much amount of font/graphics data![]()
24C256 is 32KB EEPROM.
So I'm using it, because I need that much amount of font/graphics data![]()
In that case, if you're looking for speed then an I2C EEPROM isn't the best of choices.
I have no idea how slow the bit-banged I2CREAD is (probably pretty slow).
A 24C256 isn't all that slow, but you're going to be limited to about 400KHz using the pic's MSSP hardware.
That means a random read operation works out to something like 120us/byte @ 400KHz.
A faster choice would be an SPI EEPROM like a 25LC512. There you'll probably be able to get the MSSP to run at 8MHz,
which would speed up the random read to about 5-10us/byte.
If you can read more than 1 byte at a time then the operations are a bit faster, but Henrik's suggestion of using program memory would be faster.
9x2x8 lcd "command delays" per text line is probably the worst delay
your snippet lacks that exact detail
the st7920 chip has a spi i/f that's a little faster and uses less pins too
there are better methods, at least use a graphics row buffer
even unpacking a "DA" packed font from flash is fasted than bit banged i2c by a large margin
this example uses 16 byte row data transfers for either i/f [way more efficient]
http://www.picbasic.co.uk/forum/showthread.php?t=24218
post# 26/27
Warning I'm not a teacher
Thanks everyone.
So let's answer step by step.
There are no significant delays with ST7920 itself nor SPI should be used for it. I'm looking for best compatibility, and with LCDOUT it works like charm. When reading data from built-in eeprom of PIC16F886, I can update whole, 144x32 pixels screen at 20 fps. That's fully enough.
Regarding the SPI flash, I tried to use 25xx series, but was not able to connect to it via PBP. And by the way, as I know, there is no direct support for hardware MSSP in PBP, so it will be slow as I2C, or I have to use some large inserts on ASM or whatsoever, which will be again limitation in available hardware, like need for PIC18 series, while my code above can be used even on 16F628A.
Maybe I should use some old style, parallel eeprom, like ones used in old motherboards?
Oh, you don't want to limit yourself to the hundreds of available 18F series devices so your contemplating using old parallell I/F EEPROMs instead, needing so many I/O-lines that you'll probably have less PICs to choose from than if you went with an 18F series device in the first place. And of those devices that DO have enough pins 75% probably are 18F series anyway.
Also, a cheap 32k x 8 parallell EEPROM is like €14 while a cheap SPI FLASH with less than €1 (and has 4 times the amount of space).
You don't need assembly to use the MSSP module.
Oh, you don't want to limit yourself to the hundreds of available 18F series devices so your contemplating using old parallell I/F EEPROMs instead, needing so many I/O-lines that you'll probably have less PICs to choose from than if you went with an 18F series device in the first place. And of those devices that DO have enough pins 75% probably are 18F series anyway.
Also, a cheap 32k x 8 parallell EEPROM is like €14 while a cheap SPI FLASH is less than €1 (and has 4 times the amount of space).
You don't need assembly to use the MSSP module.
The main difference between us is the sourcing capabilities
I'm buying everything from china, so I'm paying about 3 cents for 24C256 and parallel eeprom is somewhere around 40 cents. I guess, I can tolerate the differenceBut for PICs, 2nd hand 16F886 is about 70 cents, and 2nd hand 18F4550 is about $4, that is already a difference
and regarding the pin count, what you're trying to say, that 40 pin or 64 pin PICs aren't available in 16F series? For sure they are.
So if you have simple, clean to understand code for working with MSSP in PBP, I'd like to have a look...
If you're trying to write something totally generic that can be used with all the 8-bit PIC's then the most generic solution is to use the bit-banged I2C routines.
If you want a faster method then using the MSSP hardware is the solution, but-
a) not all PIC's have an MSSP module
b) even if they do, they all don't work quite the same, so there may be some slight differences in programming
SPI is simpler and faster than I2C but will take 4 pins instead of 2.
Either way, you will be limited as to which pins can be used... bit-banged can use pretty much any pins but the MSSP uses fixed pins.
If somebody required me to use a parallel EEPROM for something like this I'd laugh and say "no thanks".
Bookmarks