Discussion in "8051 Discussion Forum" started by    Una    Mar 16, 2010.
Tue Mar 16 2010, 03:21 PM
#1
I have made a sound level meter. The output is sent to ADC0804 and then to 8051. Every time, the reading goes above a certain level, I want the reading to be stored in the controller. Also, at the end of the day a graph has to be plotted from the values. Is it possible? Or at least to be able to retrieve the values? please tell me soon.
Tue Mar 16 2010, 05:00 PM
#2
yes i would recommend you using an external EEPROM like 24C256 or 24C128 etc. to store your data and later you can retrieve them. These memories works on I2C protocol.
Tue Mar 16 2010, 05:16 PM
#3
What is 12C protocol? Actually I haven't used an external memory before. Cant the internal RAM of the controller be enough? And what about the graph? Im really short on time, can you please tell me something easy and good. Thankyou
Tue Mar 16 2010, 05:25 PM
#4
data stored in internal ram wont stay if no power but if you are using EEPROM data will still be there if you dont have power connected to device. If you are new to EEPROMs and I2C then it may take long for you to understand the whole but is good to learn new things.
check tutorial section for tutorial on I2C: http://www.8051projects.net/microcontroller-tutorials/

as you said you are short of time then you can use RAM are you using C or assembly?
Wed Mar 17 2010, 01:44 AM
#5
ok. But how would I retrieve the values? Please tell me about the graph as well? And how many samples would I be able to store in the RAM?
Thu Mar 18 2010, 07:37 PM
#6
i would be glad to tell you how this all be done but i have to know what language are you using. Is it C or assembly?

and number of samples would be limited to amount of RAM you have in controller or on your hardware board.

[Topic moved to 8051 Discussion forum]
Fri Mar 19 2010, 01:25 AM
#7
Im using assembly
Mon Mar 22 2010, 10:44 AM
#8
ok.. as i told you storing in RAM is limited to available amount of RAM in your controller.

you can define a memory location that will be used for storing ADC values and after storing on one location your move to next location. just like a queue in C code.

you need to maintain two pointers one for read and one for write.

here is a small example:
Lets say our memory location to store ADC data is 50H in ram and pointers are stored at Readpointer at 4EH and write pointer at 4FH.
you can define them like this in assembly.

StoreLoc equ 50H
RdPtr equ 4EH
WrPtr equ 4FH

You have to initialize your Read and write pointer to same location which is start of your queue in this example its 50H.

mov RdPtr, #50H
mov WrPtr, #50H


Now you can use r0 or r1 to read/write data on memory location pointed by RdPtr or WrPtr. Here is small example of read and write in assembly:

;Writing to location pointed by WrPtr
mov r0, WrPtr ;move write address to R0 pointer
mov @r0, ADC_Data ;move adc data to ram
inc @r0 ;increment write pointer

;Reading data from location pointed by RdPtr
mov r0, RdPtr ;load address from read pointer
mov A, @r0 ;read data from location an store in Accumulator
inc @r0 ;increment read pointer


Now you also have to take care the length of queue. coz you cannot just keep writing you have to limit it in some way. like in this case my queue length is going to be 16 values. so i will keep checking till i reach 5FH when i reach 5FH i will reset pointer to top position.

mov A, WrPtr
cjne A,#5FH, NotFull ;check Write pointer is equal to 5FH if not then we still have space to store more data
;else we have to set WrPtr to start of queue and keep over writing last stored values
mov WrPtr, #50H
;queue is full here we are going to overwrite

NotFull:
;we have come here coz queue is not full yet..
so we can keep writing data


similarly you have to check for read pointer.. there are many ways you can implement queues in controller you need to find out a suitable and easy way to do this.. it all upon choice.
Tags queue in 8051 assemblydata queue using 8051 assembly

Get Social

Information

Powered by e107 Forum System

Conversation

ExperimenterUK
Sat Oct 12 2019, 10:23 PM
Log in.. then post your code in the 8051 forum
Sat Oct 12 2019, 10:18 AM
Bhadra Sajikumar
i am doing a countdown timer with 8051 for my project, unfortunately our professor had to take a leave of absence before he could teach us most of it.. can someone explain the .asm code of it for me?
Mon Sep 23 2019, 07:37 AM
Nathaniel
I am doing a project for my schools wireless security system with cameras,sensors and spot lights using 8051 micro controller, could you help me out with the design and its source code.
Wed Sep 18 2019, 08:48 PM
Caryn Kover
Thank you for your time,
ExperimenterUK
Mon Aug 05 2019, 07:09 PM
@Ismail ..post in forum, give details
Mon Aug 05 2019, 04:33 PM
Ismail balghmi
Hello. Please I won't download
ExperimenterUK
Wed Jul 24 2019, 12:47 AM
@BUSTER123 Please post in the forum
Tue Jul 23 2019, 06:13 PM
BUSTER123
hello! newbie here. i am kind of a guy who hates using ready - made existing libraries, so this helped a lot as i was trying to control and write to a character lcd display. however, i can't figure out how to set the cursor position. for example, i want to set it to the 5th column in the first row, so position 5. so according to the table, i am sending 10000101 on the 8 data lines of the lcd (register select pulled low). the cursor does not move there however. and i cant move the cursor left or right too. is it something wrong that i am doing? thank you.
ExperimenterUK
Thu Jul 11 2019, 07:55 PM
@ramos https://www.theengineeringprojects.com/2017/09/l298-motor-driver-library-proteus.html
ExperimenterUK
Thu Jul 11 2019, 07:44 PM
@praveen123. Can you give a link to the project ?

Downloads

Comments

auwal
Tue Nov 19 2019, 03:13 PM
ANKITPATEL
Mon Nov 18 2019, 11:00 AM
Casmir
Wed Nov 13 2019, 06:25 AM
DeepakBGattani
Mon Nov 11 2019, 01:31 PM
Jeanbusatta
Sun Nov 10 2019, 04:42 AM
mdayaz
Sat Nov 09 2019, 03:41 PM
baoyen123
Fri Nov 08 2019, 10:06 AM
xiwang
Fri Nov 08 2019, 07:28 AM

Online

Guests: 35, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38105
Newest member: auwal
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Nov 19 2019, 10:44 PM
The 8051 has too little memory to do anything us...
ilylily07 Avatar
Posted By ilylily07
Mon Nov 18 2019, 09:54 AM
0v7670 camera interfacing with stc 8051.using asse...
Jeanbusatta Avatar
Posted By Jeanbusatta
Sun Nov 10 2019, 04:43 AM
ty, really needed it
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Oct 22 2019, 05:18 AM
wimac Avatar
Posted By wimac
Mon Oct 21 2019, 09:18 AM
I’ve been following this thread and looking at the...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 03:09 PM
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 03:02 PM
sir, when i on display ,sometime 3rd display is no...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 02:53 PM
sir, when i on display ,sometime 3rd display is no...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Oct 20 2019, 12:21 AM
Your code seems okay on my simulationTry my code o...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sat Oct 19 2019, 07:13 PM
please find video attachment. 3rd & 4th displa...