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.

PIC16F84 capacity question

Status
Not open for further replies.

timtalk

New Member
I'm new to microcontrollers and am doing a bit of self training on how they work while building a small home project. My question I'm sure has a simple answer somewhere but i'm unable to find it. I'm using PIC C as a compiler, is there a simple way to know how much programming this microcontroller can handle? I.e. I'm guessing that if I wrote a 2200 line program for it that it would probably not fit. Is there a way to tell how many bytes a program will be and how many bytes the microcontroller can handle?
 
timtalk said:
I'm new to microcontrollers and am doing a bit of self training on how they work while building a small home project. My question I'm sure has a simple answer somewhere but i'm unable to find it. I'm using PIC C as a compiler, is there a simple way to know how much programming this microcontroller can handle? I.e. I'm guessing that if I wrote a 2200 line program for it that it would probably not fit. Is there a way to tell how many bytes a program will be and how many bytes the microcontroller can handle?

correct me if i'm wrong on this..

The PIC instructions are 14bit wide..they call it 1 word size..now when you look at the specs of the PIC, they are in terms of the number of words of program memory..So lets take PIC16F73. It has 4KWords. So that means you can write 4096 different instructions (assembly).
I do not use C, so I don't know how much each C instruction takes..But the calculations would be similar.
 
which compiler are you using? i believe all compilers have a memory usage report in the form of a pie chart or something like that. it all depends on the code you write. no one can say that you can write xyz lines of C for an F84. and this will vary from compiler to compiler

i hope that helps
 
You can only do it for assembler, as you know EXACTLY how many lines it will generate - with C, or any other compiler, you don't have the fainest idea how much space it will take - as the source code bears no resemblance to the final code.

A single line of C could well generate many tens of lines of assembler, if not hundreds? - a simple use of a maths function (particularly a floating point one) will require the maths library functions to be included.

But for a better start, don't use the obselete F84, use it's replacement the 16F628 instead, that provides twice the memory for less money!.
 
Yes as the topic says i'm trying to use a PIC16F84A. Here is my situation i'm currently using the following pins on the pic 1, 4, 5, 8 thru 16. That leaves me with 2, 3, 6, 7, 17, 18 as pins that I can use. Currently the used pins are turning on and off relays at specified times defined in the eeprom and this works great. The only problem is that it's a real pain to take the entire unit appart to get to the PIC remove it and make a change to the eeprom. I was thinking that it would be possible to use a small lcd and a key pad to manupliate the eeprom while the unit was running without removing the PIC. My first thoughts (of course keep in mind i'm very new to this) is that with 6 pins that are currently open I could use a transistor or a 74LS07 as a means to allow up to 30 combinations of entrys. I.e. pin 2 and pin 3 high would mean do this or that, or would set a bit that would then allow other pins or even the same pins to be use to enter more data till another combination of pins were set high at the same time to tell it that it was time to stop. All of this I'm guessing could take a bit of coding to get to where it works and I was wondering if the PIC would have room for it. If anyone has some C code examples of this PIC with a keypad and LCD for changing the eeprom data that would be really helpful and would save me many hours.
 
Nigel, Thanks for the info. I have no problems with changing to the new PIC I'm guessing that with a few wiring changes that I could make the new PIC work like the current PIC works and then start to modify from there.
 
timtalk said:
Yes as the topic says i'm trying to use a PIC16F84A. Here is my situation i'm currently using the following pins on the pic 1, 4, 5, 8 thru 16. That leaves me with 2, 3, 6, 7, 17, 18 as pins that I can use.

If you relocates pin8 to another unused pin then you can use pin7 and pin8 as serial I/O. With the addition of a MAX232 chip, you can have two way serial communication with the PIC using a PC. It is much easier to get/set the eeprom data this way.

Just a suggestion for you to consider.
 
I understand that the PC would be easier to use, Unfortunatly the people who i'm going to give this unit to do not know how to use a PC well as it is and to try to show them how to connect it to thier pc and program it may prove to be a nighmare in itself. Thus I was hoping for a simple keypad on the top of it and a set of instructions to the side as to how to program it. But since i'm not sure if that's even possible I may have to rethink the entire project.
 
timtalk said:
Thus I was hoping for a simple keypad on the top of it and a set of instructions to the side as to how to program it. But since i'm not sure if that's even possible I may have to rethink the entire project.

That's even easier. You can leave out the MAX232 chip and connect the PIC directly to another keypad console(PIC+LCD), using the two serial I/O pins.
 
timtalk said:
But can it be done easily with only the 6 pins availble???

I think so. Interfacing a LCD even in 4-bit mode requires quite a lot of pins so you are still better off using a serial LCD and enable the USART on the PIC to drive it. So there are four lines left over for your keys.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top