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.

A Microcontroller based Analogue Waveforms Analyzer Project

Status
Not open for further replies.
Thanks Exo!! But how can I know whether my PIC enough RAM to store the samples? For example, if I need 128 samples, how many RAM do i need? :roll:
 
km said:
if I need 128 samples, how many RAM do i need? :roll:

If a sample is 8 bit then you need 128 bytes of ram,
for 16 bit samples you would need 256 bytes, and so on
 
-

Exo said:
If a sample is 8 bit then you need 128 bytes of ram,
for 16 bit samples you would need 256 bytes, and so on

I a bit confused.:? Can you explain to me by how many samples? eg: 256 samples are suitable for how many byte of RAM?
 
Re: -

km said:
Exo said:
If a sample is 8 bit then you need 128 bytes of ram,
for 16 bit samples you would need 256 bytes, and so on

I a bit confused.:? Can you explain to me by how many samples? eg: 256 samples are suitable for how many byte of RAM?

One 8 bit sample will fit in one byte of RAM, filling it completely. So for 16 bit samples you need two bytes of RAM. If you use 10 bit samples, these also will not fit in one byte - so you would probably need to use two byes (or you can join them together, storing four 10 bit samples in five bytes).

Presumably you will probably be using an 8 bit sample?.

Also bear in mind that PIC RAM is in a number of different banks, if you are using large amounts of RAM you will have to select between banks accordingly.
 
-

:wink: Thanks Nigel, I get the idea now!! YES! I'm using 8-bit sample.
Nigel Goodwin said:
Also bear in mind that PIC RAM is in a number of different banks, if you are using large amounts of RAM you will have to select between banks accordingly.

What do you mean by "have to select between banks accordingly"? :?:
 
Re: -

km said:
What do you mean by "have to select between banks accordingly"? :?:

Pic's of the 16F range can only access 127 bytes of RAM at once so their memory is divided into banks. You will have to switch between banks to access each block of 127 bytes...
 
Re: -

Exo said:
Pic's of the 16F range can only access 127 bytes of RAM at once so their memory is divided into banks. You will have to switch between banks to access each block of 127 bytes...

Except it's not quite as simple as that :cry:

The special function registers are addressed in the same banks of memory, so you don't get 127 bytes of RAM in a single bank.

For an example, the 16F628A (whose datasheet happens to be in front of me) has 224 bytes of RAM (GPR's).

80 bytes in bank 0.
80 bytes in bank 1.
48 bytes in bank 2.
0 bytes in bank 3.

These only add up to 208 bytes, the other 16 bytes are common to all 4 banks, and are the top 16 bytes of the 127 byte space.

This is all explained in the datasheet.
 
-

Hi Nigel, just want to get some advice from you. :idea: For my project, I will need 128 samples (at least) to give a sufficiently accurate reading. As for the ADC resolution, 8-bit is OK. So, the PIC 16F628 and the A2D TLC 548 (8-bit resolution) will cause any problem? :roll:
 
Re: -

km said:
Hi Nigel, just want to get some advice from you. :idea: For my project, I will need 128 samples (at least) to give a sufficiently accurate reading. As for the ADC resolution, 8-bit is OK. So, the PIC 16F628 and the A2D TLC 548 (8-bit resolution) will cause any problem? :roll:

Only the problems of memory paging, you will need to use at least two memory pages to get 128 bytes. If 80 bytes was enough, you could use a single memory page.
 
-

Nigel Goodwin said:
Only the problems of memory paging, you will need to use at least two memory pages to get 128 bytes. If 80 bytes was enough, you could use a single memory page.

What do you mean by memory paging? (is it the different of banks you mentioned earlier) :roll: - Do I need to change the use of another PIC? If YES, can you please recommend me one? (without a built-in A2D) Thank you :wink:
 
km said:
Nigel Goodwin said:
Only the problems of memory paging, you will need to use at least two memory pages to get 128 bytes. If 80 bytes was enough, you could use a single memory page.

What do you mean by memory paging? :roll: - Do I need to change the use of another PIC? If YES, can you please reccomend me one? (without a built-in A2D) Thank you :wink:

As I explained above, PIC memory is arranged in a number of banks, four in the case of the 16F628A - none has more than 80 bytes of memory (or 96 bytes, counting the 16 bytes common to all banks).

You need to select which bank you want to use, bank 0 being the default, for your purposes you will have to switch banks during reading and writing memory. It's all explained in the datasheets!.

AFAIK all mid-range PIC's work like this, I think high-range ones have more 'user friendly' memory.
 
-

Thanks for your reply Nigel :wink:

Nigel Goodwin said:
You need to select which bank you want to use, bank 0 being the default, for your purposes you will have to switch banks during reading and writing memory. It's all explained in the datasheets!.

Is it mean that I have to store the first 80 bytes of samples in bank 0 then for the next 48 bytes of samples I can store in either bank 1 or bank 2?

By the way, is there any differences between PIC 16F628-04/P & PIC 16F628-20/P :?:
 
Re: -

km said:
Thanks for your reply Nigel :wink:

Nigel Goodwin said:
You need to select which bank you want to use, bank 0 being the default, for your purposes you will have to switch banks during reading and writing memory. It's all explained in the datasheets!.

Is it mean that I have to store the first 80 bytes of samples in bank 0 then for the next 48 bytes of samples I can store in either bank 1 or bank 2?

Yers, or some variation on that!.

By the way, is there any differences between PIC 16F628-04/P & PIC 16F628-20/P :?:

Only the guaranteed oscillator speed, but I've never seen (or heard of) any problems running 04 chips at 20MHz.
 
-

Nigel Goodwin said:
For an example, the 16F628A (whose datasheet happens to be in front of me) has 224 bytes of RAM (GPR's).

80 bytes in bank 0.
80 bytes in bank 1.
48 bytes in bank 2.
0 bytes in bank 3.

These only add up to 208 bytes, the other 16 bytes are common to all 4 banks, and are the top 16 bytes of the 127 byte space.

Is it compulsory to include the 16 bytes when storing the samples into the RAM? :roll:
 
Re: -

km said:
Is it compulsory to include the 16 bytes when storing the samples into the RAM? :roll:

You can include them or not, it's up to you, but as they are common to all banks it's probably better to use them for something else rather than waste them as plain storage - an obvious use for some of them would be as indexes into the ram buffer.
 
-

As I had mentioned, the suitable number of samples for my project is 128. How can I apply to my project (to make it use 128 samples) :?: Do I need to built extra circuit :idea:
 
Need Help!.

Which type of active low-pass filter should I design at my input stage? (for the 2nd op-amp of the analogue circuitry) :idea: How many poles do I need? One more thing I want to ask about the analogue circuitry - for the 3 inputs, can I input let say -5 to 5V to the first input and the circuit will change it to 0-5V? What will happen if I input 0-10V? Also, what is the maximum AC voltage that the analogue circuitry can handle? :roll:
 

Attachments

  • analogue_circuitry.jpg
    analogue_circuitry.jpg
    12.2 KB · Views: 362
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top