8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

Go to page  1 [2] 3 4 5
Moderators: Ajay, Junied , abbas1707, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph
Author Post
priya123
Tue May 13 2008, 05:09PM
 User Offline
Registered Member #7113
Joined: Wed Apr 09 2008, 02:39AM

Posts: 48
Thanked 0 times in 0 posts
sir,i have gone through the description of the chip KLS5XX.i have connected the following port pins of my microcontroller(8051) with the following segments of my seven-segment-display(KLS5XX).
PORT PIN NO(8051): SEVEN SEGMENT DISPLAY
(SP5503)

P3.0-------------------------------------------------------------------A (PIN NO 7)
P3.1-------------------------------------------------------------------B (PIN NO 6)
P3.2--------------------------------------------------------------------C (PIN NO 4)
P3.3--------------------------------------------------------------------- D (PIN NO 2)
P3.4--------------------------------------------------------------------- E(PIN NO 1)
P3.5--------------------------------------------------------------------F (PIN NO 9)
P3.6--------------------------------------------------------------------G (PIN NO 10)
P3.7--------------------------------------------------------------------DP (PIN NO 5)
As the chip i am using is a common cathode configuration so at the common pin(PIN NO 3)i have provided a 330 ohmresistor and grounded it.



[ Edited Tue May 27 2008, 03:49PM ]

p
Back to top


Arun Kumar V
Tue May 13 2008, 05:50PM

 User Offline
Registered Member #426
Joined: Sun Jan 28 2007, 11:50PM

Posts: 376
Thanked 155 times in 127 posts
Hello Priya,

there are few things you need to know :

1) Micros like 8051 are good at sinking Current than sourcing current (2 mA); so its better to use Common Anode type rather than c.cathode, still if you want to use C.cathode type then the display will turn on very dim ( if directly connected to port pins - which you are doing right now)

2) the hex values for each number are correct with respect to Common cathode display - but your assembler/compiler may show error "undefined symbol" for those hex values- so you have to Use them in Binary form for eg: for displaying Number 9, instead of 67H use 01100111b in your program.

3) there is one more problem with Common cathode type - at the time of power on since all the ports are inputs i,e logic 1's your display will show '8." so the first instruction in your main program should be MOV P1,#00H

4) Use non inverting octal Buffer like 74HC244 - between Port pins and the display for more current

5) use of single Common Resistor is wrong, when more segments are "ON" the display looks feeble, when number like "1" is displayed it looks bright- so use independent resistors for each segment so that the segment LEDs don't have to fight for Current share


All the best


Arun

Back to top



This post has been thanked 1 time
 priya123 
priya123
Wed May 14 2008, 04:14PM
 User Offline
Registered Member #7113
Joined: Wed Apr 09 2008, 02:39AM

Posts: 48
Thanked 0 times in 0 posts
sir, i have connected the entire circuit on the breadboard.i have used separate resistors for every display,but when i turn on my circuit the 7-segment display lights up and shows 8.display is bright but after that only segment g is lighted and it shows no further results, but the logic of my program is that whenever i vary the voltage say when i place it at 1volt it should show 33.first it should display3 and again 3.in between these 2 displays there is some delay.my program logic is: for 1volts i want the display to be 33h,for 2 volts display should be 67h.my circuit is : i have connected an ADC with the microcontroller& then at port1 i have connected this 7-segment display.data lines of ADC are also connected with the port p1 of microcontroller.i am varying the voltage at pin 6 ofADC(0804) i am enclosing my program code.Sir kindly go through this code .please point out what changes are to be made and whether the code is correct or not.please get me out of this problem.my program code is:
setb p2.5
setb p2.6
intr bit p2.7
setb intr
adc_port equ p1
adc_val equ 30h
voltage_val equ r3
org 0h
start: acall read
acall conversion
mov a,adc_val
sjmp start
conversion: clr wr
setb wr
read: clr rd
mov a,adc_val
setb rd
mov r3,#00h
mov a,#00h
cjne a,#00,over1
over1: acall data_display1
mov r3,#01h
mov a,#33h
cjne a,#51,over2
over2: acall data_display2
mov r3,#02h
mov a,#67h
cjne a,#103,over3
over3: acall data_display3
mov r3,#03h
mov a,#97h
cjne a,#151,over4
over4: acall data_display4
mov r3,#04h
mov a,#99h
cjne a,#153,over5
over5: acall data_display5
mov r3,#05h
mov a,#0ffh
cjne a,#255,over6
over6: acall data_display6
data_display1: mov a,#00h
mov b,#0ah
div ab
mov r7,b
mov b,#0ah
div ab
mov r6,b
mov r5,a
mov a,r7
acall disp_7segment
acall delay
mov a,r6
acall disp_7segment
acall delay
mov a,r5
acall disp_7segment
acall delay
ret
data_display2: mov a,#33h
mov b,#0ah
div ab
mov r7,b
mov b,#0ah
div ab
mov r6,b
mov r5,a
mov a,r7
acall disp_7segment
acall delay
mov a,r6
acall disp_7segment
acall delay
mov a,r5
acall disp_7segment
acall delay
ret
data_display3: mov a,#67h
mov b,#0ah
div ab
mov r7,b
mov b,#0ah
div ab
mov r6,b
mov r5,a
mov a,r7
acall disp_7segment
acall delay
mov a,r6
acall disp_7segment
acall delay
mov a,r5
acall disp_7segment
acall delay
ret
data_display4: mov a,#99h
mov b,#0ah
div ab
mov r7,b
mov b,#0ah
div ab
mov r6,b
mov r5,a
mov a,r7
acall disp_7segment
acall delay
mov a,r6
acall disp_7segment
acall delay
mov a,r5
acall disp_7segment
acall delay
ret
data_display5: mov a,#97h
mov b,#0ah
div ab
mov r7,b
mov b,#0ah
div ab
mov r6,b
mov r5,a
mov a,r7
acall disp_7segment
mov a,r6
acall disp_7segment
mov a,r5
acall disp_7segment
acall delay
ret
data_display6: mov a,#0ffh
mov b,#0ah
div ab
mov r7,b
mov b,#0ah
div ab
mov r6,b
mov r5,a
mov a,r7
acall disp_7segment
mov a,r6
acall disp_7segment
mov a,r5
acall disp_7segment
acall delay
ret
disp_7segment: mov p1,#00h
cjne a,#0,d1
mov p1,#03fh
d1: cjne a,#1,d2
mov p1,#06h
d2: cjne a,#2,d3
mov p1,#5bh
d3: cjne a,#3,d4
mov p1,#04fh
d4: cjne a,#4,d5
mov p1,#066h
d5: cjne a,#5,d6
mov p1,#6dh
d6: cjne a,#6,d7
mov p1,#7dh
d7: cjne a,#7,d8
mov p1,#07h
d8: cjne a,#8,d9
mov p1,#7fh
d9: cjne a,#9,d10
d10: mov p1,#67h
delay: mov r4,#200
here: djnz r4,here
ret
end



[ Edited Tue May 20 2008, 05:52PM ]

p
Back to top


Arun Kumar V
Thu May 15 2008, 04:05AM

 User Offline
Registered Member #426
Joined: Sun Jan 28 2007, 11:50PM

Posts: 376
Thanked 155 times in 127 posts
Are you NUTS ?

3) there is one more problem with Common cathode type - at the time of power on since all the ports are inputs i,e logic 1's your display will show '8." so the first instruction in your main program should be MOV P1,#00H


clearly i have mentioned about this problem and solution for that, " MOV P1,#00H"wasn't this supposed to be your first instruction in your code

THINK BEFORE YOU INK


Arun
Back to top


priya123
Thu May 15 2008, 07:59PM
 User Offline
Registered Member #7113
Joined: Wed Apr 09 2008, 02:39AM

Posts: 48
Thanked 0 times in 0 posts
sir,i know i am disturbing u all too much but i am undone,anyways,u told me to put MOV P1,#00h in my program code,i have put it at the disp_7segment subroutine---is it correct? i have also tried putting the instruction M0V P1,#00H after voltage_val equ r3.when i simulate my program theresults are all the same.after building my circuit the problem which i am facing is the seven-segment display first displays 8 and then after a short while 0 but it further doesnt display any other value when i vary the voltage,i have mentioned my program logic in the earlier posts, i have tried several times but unable to track the problem.sir,please help me to get out of this problem.


[ Edited Thu May 15 2008, 08:01PM ]

p
Back to top


Arun Kumar V
Thu May 15 2008, 09:51PM

 User Offline
Registered Member #426
Joined: Sun Jan 28 2007, 11:50PM

Posts: 376
Thanked 155 times in 127 posts
i have connected an ADC with the microcontroller& then at port1 i have connected this 7-segment display.data lines of ADC are also connected with the port p1 of microcontroller


1) Why in the world did you connect ADC & 7 seg display to the same PORT 1 ? use the ADC on some other free port

2) Why do you want to Multiplex data bus lines?

3) In which mode are you using AD 0804 - Free running mode or microcontroller master mode ?

4) use MOV P1,#00H just after your variables ; the idea is to Blank out the display during power-ups.

Arun

Back to top



This post has been thanked 1 time
 priya123 
sashijoseph
Fri May 16 2008, 02:48AM

 User Offline
Registered Member #5870
Joined: Mon Feb 04 2008, 06:26PM

Posts: 496
Thanked 112 times in 105 posts
CODE:
setb p2.5
setb p2.6
intr bit p2.7
setb intr
adc_port equ p1
adc_val equ 30h
voltage_val equ r3
back: clr wr
setb wr
read: clr rd
mov a,adc_val
setb rd


Plenty of mistakes in this ADC code.What is 'rd' ,'wr'...? Where are you reading the ADC value from adc_port?
First thing go through this... http://www.8051projects.net/adc-interfacing/adc0804-8051-programming.php
and correct your adc routine.
What Vref/2 value have you chosen?
You have 'hardcoded' your display routine to display some values(33,67 etc).Where is the comparison with the adc value read in?
For eg. if you want to display 33 if input voltage is 1V,you'll have to read the adc and compare the value read with 51 decimal(assuming you have left Vref/2 pin open,which gives a step size of 19.5mv thus giving a digital value of 51 for 1000mv input(adc value=Vin/step size)).
If adc value is 51 then you call the data_display1 routine.
Similarly for other Vin values.

So make the necessary changes and get back to us.

Let there be music........
Back to top



This post has been thanked 1 time
 priya123 
pdi33
Sat May 17 2008, 01:29AM

 User Offline
Registered Member #1329
Joined: Mon Jun 04 2007, 09:28AM

Posts: 548
Thanked 109 times in 105 posts
hi priya,
i have already mentioned earlier and would like to repeat that please mention the definition of various variables like rd/wr.etc. and also the hardware connections as that would help us understand exactly what logic u have applied in our code. it is always good practice to add comments whereever possible so that we can understand ur code better and provide some useful feedback. now, as far as ur problem is concerned, follow the following procedure, if possible:
first temporarily remove the code which reads ur ADC.u can do that by just adding a semicolon before the ADC read instructions. and check the display code if it is working properly by outputing some fixed values to the display. Once it shows the correct values, reintroduce the adc value and put the values in the display routine.
step by step troubleshooting would always save u a lot of time.
good luck.
P.S. look back in some posts by arun and shashi and u will find some really useful hints on how to correctly interface the LED display. read them carefully (note them down preferably as i understand u have a very slow internet connection) and try correcting the errors by urself. Please understand that if u can correct ur logical errors,( as far as possible) than that would benifit u the most and that is the sole intention of all of us here.

* inspired to develop,developing to inspire *
Back to top



This post has been thanked 1 time
 priya123 
priya123
Tue May 20 2008, 04:54PM
 User Offline
Registered Member #7113
Joined: Wed Apr 09 2008, 02:39AM

Posts: 48
Thanked 0 times in 0 posts
sir, here i am describing the hardware connections of my project------------------
FOR ADC(0804)
PIN 20: supply voltage +5 volts
PIN 18---PIN 11:these are the data lines and are connected in the following way
PIN 18 CONNECTED TO PORT P3.0(microcontroller 8051)
PIN 17 CONNECTED TO PORT P3.1
PIN 16 CONNECTED TO PORT P3.2
PIN 15 CONNECTED TO PORT P3.3
PIN 14 CONNECTED TO PORT P3.4
PIN 13 CONNECTED TO PORT P3.5
PIN 12 CONNECTED TO PORT P3.6
PIN 11 CONNECTED TO PORT P3.7
PIN 1: CS is grounded
PIN 2 :RD IS CONNECTED TO P2.5(PIN NO:26 OF MICROCONTROLLER 8051)
PIN 3: WR IS CONNECTED TO P2.6(PIN NO:27 OF MICROCONTROLLER 8051)
PIN 4: here i have provided external clock
PIN 5: INTR IS CONNECTED TO P2.7(PIN NO: 28 OF MICROCONTROLLER 8051)
PIN 6: here i have provided a variable input at which i am varying the voltage value
PIN 7: grounded
PIN 8,PIN 10: grounded separately
PIN 9: OPEN
Vref: 1.28 volts

FOR MICROCONTROLLER(8051):
connections with ADC (0804) are already mentioned
PIN 40: power supply +5 volts Vcc
PIN 31: EA/VPP connected with pin 40
here also i have provided external clock and build the reset circuitry with capacitors and pull -up-resistors
PORT PIN P1.0: segment A of seven-segment display (SP5503)
PORT PIN P1.1: segment B of seven-segment display
PORT PIN P1.2: segment C of seven segment display
PORT PIN P1.3: segment D of seven-segment display
PORT PIN P1.4: segment E of seven-segment display
PORT PIN P1.5: segment F of seven-segment display
PORT PIN P1.6: segment G of seven-segment display
PORT PIN P1.7: segment H ofseven-segment display
SP5503 is a commoncathode chip so i have used common cathode configuration
sir, this is my entire hardware connection,i have also tried to correct my code and so edited the post please go through it once.
theanking u



[ Edited Tue May 27 2008, 03:48PM ]

p
Back to top


Arun Kumar V
Tue May 20 2008, 05:57PM

 User Offline
Registered Member #426
Joined: Sun Jan 28 2007, 11:50PM

Posts: 376
Thanked 155 times in 127 posts
PIN 18 CONNECTED TO PORT P1.0(microcontroller 8051)
PIN 17 CONNECTED TO PORT P1.1
PIN 16 CONNECTED TO PORT P1.2
PIN 15 CONNECTED TO PORT P1.3
PIN 14 CONNECTED TO PORT P1.4
PIN 13 CONNECTED TO PORT P1.5
PIN 12 CONNECTED TO PORT P 1.6
PIN 11 CONNECTED TO PORT P1.7
PIN 1: CS is grounded

PORT PIN P1.0: segment A of seven-segment display (SP5503)
PORT PIN P1.1: segment B of seven-segment display
PORT PIN P1.2: segment C of seven segment display
PORT PIN P1.3: segment D of seven-segment display
PORT PIN P1.4: segment E of seven-segment display
PORT PIN P1.5: segment F of seven-segment display
PORT PIN P1.6: segment G of seven-segment display
PORT PIN P1.7: segment H ofseven-segment display


in my last post i asked a question :

1) Why in the world did you connect ADC & 7 seg display to the same PORT 1 ? use the ADC on some other free port


Arun
Back to top



This post has been thanked 1 time
 priya123 
Go to page  1 [2] 3 4 5  

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems