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.

External rom for PIC's

Status
Not open for further replies.

Steve2005

New Member
I have minimal experience with PIC's, but I was wondering how an EEPROM can be attached to a PIC to store a larger program for the processor to run. Is this doable, or can external ROM's only store data rather than instructions?

If this is possible then I'd rather have the program code transfer to the pic serially so I use minimal IO lines on the PIC.

If this is doable would I have to store the entire program on the eeprom and just have another program on the PIC itself that accesses the EEPROM.

I would be really greatful if you could give me an idea of what instructions allow me to do this, in assembly and BASIC if possible.


Cheers
- Steve -
 
Steve2005 said:
I have minimal experience with PIC's, but I was wondering how an EEPROM can be attached to a PIC to store a larger program for the processor to run. Is this doable, or can external ROM's only store data rather than instructions?

If this is possible then I'd rather have the program code transfer to the pic serially so I use minimal IO lines on the PIC.

If this is doable would I have to store the entire program on the eeprom and just have another program on the PIC itself that accesses the EEPROM.

I would be really greatful if you could give me an idea of what instructions allow me to do this, in assembly and BASIC if possible.

Basically no! - an external EEPROM really only stores data, the Harvard architecture of a PIC means that data and program memory are completely seperate.

Some PIC's allow you to access the program memory space in special ways (the PIC's which allow bootloaders), but programs which rewrite themselves are a very dangerous thing to write!.

There are a few PIC's that allow you to add external program memory, but not many.

Why do you want to do this anyway?.
 
BASIC Stamp had a similar idea, they can't put assembly instructions on the EEPROM either so they store some sort of interpreted BASIC instructions. It's very, very slow.

There are plenty of PICs with a HUGE amount of program space. You'd have to write an enormous volume of code to run out unless perhaps you stored audio files or graphics objects, real memory hogs, in constant ROM. In these cases that constant data is an ideal candidate for putting in external memory, leaving your program code on-chip.
 
Thanks for the replies.

Well, in answer to Nigel’s question of why I wanted to do this... I happened to dig out my old StampBug toy thingy and found that I have a nice BASIC compiler for PIC's, which as far as I know are quite cheap. I thought that this would be a good way to start writing programs in basic without having to pay large amounts of money for either PICBasic, but then I realised that the PIC chip used on the StampBug is a 16C56 which has no EEPROM built in and has no UV window for erasing the chips contents. But according to my instruction manual I should be able to change the program that is already there and replace it with my own.

There is a 93LC56 EEPROM chip on the StampBug as well, but I thought that was only for holding data, but I couldn’t quite understand how that would let me replace the currently installed program unless the PIC was pre programmed to just run a program from the EEPROM, but that doesn’t seem to be the case now.


Anyway, as a follow up question I have found that there are quite a few PIC's in the 16F... range that say that compilers which are recommended for use with these chips have a "Parallax BASIC Stamp 1 compatible instruction set" I'm guessing that means they have the same machine code instruction set as my 16C56 chip and if so then I can use my compiler that I got with stampBug to program these chips to...

This leads me to ask another question...
My stampBug has got hardly anything on it. Apart from the servo's, LED's, Touch sensors and on switch (which I'm pretty sure aren’t necessary to program the PIC) all there is are the PIC chip, the EEPROM, Resonator, 1 transistor, 1 capacitor and a few resistors. The StampBug connects to the PC's parallel port via a 3 Pin connector on the stampBug... So, it would seem to me that it would be very simple & cheap to make a board that I could plug some of those 16F's into and program with the software I've already got. If so can someone let me know what it is that needs to be done? Should I just build something the same as the stampBug and miss out the Servo's etc, and would I need to include the EEPROM or not. Anyway... thanks very much for reading and if I have got very confused along the way and started talking crap please let me know.

Cheers
- Steve -
 
Right - that explains why your question didn't make much sense!. You don't understand what a BASIC STAMP is?.

First off, the 16C56 is an OTP (One Time Programmable) PIC, which means you can neither erase it, or overwrite it.

Secondly, you don't have a BASIC compiler, what you have is a BASIC interpreter - actually programmed inside the 16C56!. A BASIC interpreter needs a BASIC program to run, and this is stored as tokenised data in the external EEPROM. So the 16C56 reads the data from the EEPROM, and interprets what it means - this is why they run extremely slowly, compared to a proper PIC program.

The program you run on your PC takes the BASIC source you enter, and tokenises it, then transfers the resulting data to the 93LC56 EEPROM.

So what you have can ONLY be used with your STAMP, it's useless for anything else.
 
Thanks very much, at least I know what I got know. Is their any free software that I can get for PIC's that allows me to produce my source code in BASIC, or alternatively any websites that give the assembly code for some of the BASIC instructions like PWM PULSEIN and PULSOUT. If nobody knows of any such sites then some advise on what I should be searching for to find them would be appreciated as Im having trouble finding anything like that.

Cheers
- Steve -
 
Steve2005 said:
Thanks very much, at least I know what I got know. Is their any free software that I can get for PIC's that allows me to produce my source code in BASIC, or alternatively any websites that give the assembly code for some of the BASIC instructions like PWM PULSEIN and PULSOUT. If nobody knows of any such sites then some advise on what I should be searching for to find them would be appreciated as Im having trouble finding anything like that.

Here's an online book which does just that 8)
https://www.dontronics.com/see.html

There are a number of 'free' limited BASIC compilers, basically demos of the full retail versions. Have a look at https://www.dontronics.com/see.html.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top