Discussion in "General help Guidance and Discussion" started by    priya123    May 9, 2008.
Wed Jun 04 2008, 01:47 AM
#31
Hello Priya,

i am sorry to say that this is one of the worst code i have seen so far, you ask why ?

1) what ever variables you have declared are not used anywhere in the program

2) what you want the code to perform is missing- objective is missing

3) you are simply loading some preset values into the display port

4) you are not comparing the ADC value to any known values

5) when you convert binary to Decimal you should first divide by 100D (64H) ,later by 10D
but you are dividing first by 10D and second also by 10D see here in your code 0ah i,e 10D:

mov a,#33h
mov b,#0ah
div ab
mov r7,b
mov b,#0ah
div ab
mov r6,b
mov r5,a


6) and what are you doing with these registers : R7,R6,R5 ?

seven segment_display: mov r1,#0
mov r2,#0c0
mov r1,#1
mov r2,#0f9
mov r1,#2
mov r2,#0a4
mov r1,#3
mov r2,#0b0
mov r1,#4
mov r2,#99
mov r1,#5
mov r2,#92
mov r1,#6
mov r2,#82
mov r1,#7
mov r2,#0f8
mov r1,#8
mov r2,#80
mov r1,#9
mov r2,#98
ret



7) what does this above Routine do ? - its rubbish

8) when a compiler compiles a code and outputs hex file, it doesn't mean that the code is error free - ever heard of "GIGO" term - "garbage In garbage Out"

9) provide a flowchart or block diagram of your logic so that we can help, forget " i have posted my logic in earlier posts" statement , nobody can track each and every thread in a forum,


Arun


 priya123 like this.
Wed Jun 04 2008, 02:15 AM
#32
thanx a lot arun sir for tracking my mistakes,I am trying to build a data-acquisition system by using adc and microcontroller. i have already developed a look-uptable for the adc. providing a variable voltage at pin6 of adc i have found out the adc values by connecting all the datapins of adc toleds on my trainer kit.i am trying to programmy microcontroller in such a way that when i apply say,1 volts to adc the output should be 033h(according to the look-up table of ADC). i have connected pins of port1 of microcontroller to data pins of ADC. I want to see the display through seven-segment display ,so i have connected a seven-segment display(common anode type)to port p3 of microcontroller.
Wed Jun 04 2008, 07:39 PM
#33
Hello priya123,

here is my code in two versions : ver A - displays 3 digit decimal on Common Anode
Ver B - displays 2 digit hex value on Common Anode

verA :

: code deleted by Arun

and here is want you desperately wanted

Ver B :

: code deleted by Arun

Hope this solves your long time problem !

Arun


[ Edited Tue Jul 15 2008, 08:39 AM ]
 nischay kumarpriya123 like this.
Tags adc with seven segment displayseven segment programinginterfacing 7-seg display7 segment display interfacing7 segment display programming
Sat Jun 07 2008, 06:16 PM
#34

hello sir,

your program works perfectly, i have tried it and have learned new concepts in asm programming

nischay kumar
Tue Jun 10 2008, 11:59 PM
#35
thanx arun sir,your program code really helped me a lot,but still there is one doubt which i want to make it clear . i am using ADC(0804) in free-running mode. I have connected it to microcontroller(89s52) in the following way:
ADC(0804)
pin no:1 -------- CS grounded
pin no:2---------rd connected to port pin 2.5
pin no:3---------wr and pin no:5--------------intr shorted together
pin no: 3 ---------------wr connected to port pin 2.6 of microcontroller
pin no :5----------------intr connected to port pin 2.7 of microcontroller
pin no:6 ------------- variable input ,voltage is varied here
pin o:7--------------- grounded
pin no:8-------------------- grounded
pin no:9------------------- vref (1.28v) ,i have left it open
pin no:10------------------grounded
pin no:11 to pin no:18 (data pins) connected to pins of port1 of microcontroller
pin no: 19 -------------- connected to external clock
pin no:20--------------+5 volts vcc.
sir please tell me whether this connection is correct? if incorrect,then what corrections should I make?
please help.
Wed Jun 11 2008, 02:25 AM
#36
Hello priya123,

very late reply, about the ADC in free running mode , your current setup is not Free running mode-

in the free running mode, the ADC constantly converts the analog voltage at its input without the micro sending control pulses. one conversion triggers another conversion without micro's interference.

i have already described the connections of ADC in my above code:

;***************************************************************************
; ADC 0804 IS CONNECTED IN FREE RUNNING MODE
; VREF IS CONNECTED TO +5VOLTS
;
; GROUND PINS CS,RD,Vin-,DGND,AGND ON THE ADC
; CONNECT WR PIN TO INTR PIN ON THE ADC
;****************************************************************************



you only need to connect ADC's (D0-D7) Data bus pins to the micro's port, in your case its Port1.

when ever you want to read the input voltage , you just Mov contents of Port1 to Accumulator or any other Register.

interval between two readings should be atleast 1 uSec, which is not a problem when using normal 8051 @ 12 Mhz clock rate

Arun
Wed Jun 18 2008, 09:27 AM
#37
sir,please provide me the pin configuration of LM35 and LM34 sensors or sir,please give me any link from where I can get the pin configuration.
Wed Jun 18 2008, 05:35 PM
#38
Look here : http://www.facstaff.bucknell.edu/mastascu/elessonshtml/Sensors/TempLM35.html

Google will give you umpteen links...do use it.
Fri Jun 20 2008, 06:31 AM
#39
hello sir,
thanx for ur information on LM 35 sensors,could u provide me some more information about LM 34 sensor(fahrenheit sensor) ,its pin configuration and characteristics.
Fri Jun 20 2008, 11:54 AM
#40
hello priya 123,

use this forum for help when your preliminary search doesn't give you good results.

before posting your queries try googling, don't expect spoon feeding here. below are the results for what you asked








next time such queries will be deleted without explanation.



Arun

Get Social

Information

Powered by e107 Forum System

Conversation

Sun Oct 13 2019, 02:02 AM
Aline Hutchinson
Hey there,
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

Downloads

Comments

ilylily07
Tue Oct 15 2019, 04:32 PM
hientran123
Tue Oct 15 2019, 02:27 AM
Sat Oct 05 2019, 02:38 PM
zexalo
Thu Oct 03 2019, 09:53 AM
thanhle12345
Thu Oct 03 2019, 07:37 AM
ramon_vsc
Fri Sep 20 2019, 04:53 PM
youssoufba
Thu Sep 19 2019, 11:57 AM
Taiphan000
Tue Sep 17 2019, 04:21 AM

Online

Guests: 48, Members: 0 ...

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

Members: 38097
Newest member: ilylily07
Forum Activity
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...
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...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sat Oct 19 2019, 07:05 PM
sir, 3rd and 4th dot matrix display flickering, ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Oct 18 2019, 09:18 PM
Hopefully you understand some of the program.Which...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Thu Oct 17 2019, 09:38 PM
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Oct 17 2019, 08:35 PM
Do you understand how this code works?If so, addin...