- This topic has 17 replies, 2 voices, and was last updated 12 years, 9 months ago by .
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › how to display a 4-digit numeric data on 7-seg displays with variable data at receiver
i have made the following code.this code receives the data byte serially in ascii and then displays it on seven segment display. check it there might be some errors as i was in a hurry.also if you want that the digits remain displayed if transistor is off then use a latch to store the data.
org 0
mov tmod,#20h
mov th1,#-6
mov scon,#50h
setb tr1
there: mov r3,#04h
now: jnb r1,now
mov dptr,#900h
mov a,sbuf
anl a,#07h
movc a,@a+dptr
mov p0,a
acall disp
back: djnz now
sjmp there
disp: cjne r3,#04h,next
mov p2,#01h
ljmp back
next: cjne r3,#03h,next1
mov p2,#02h
ljmp back
next1: cjne r3,#02h,next2
mov p2,#04h
ljmp back
next2: cjne r3,#01h,back
mov p2,#08h
ret
org 900h
[write the seven segment codes here one by one starting with 0-9]
while simulating in Keil its a prob with sbuf that u dont any value ovr thr…so only ‘0’ is displayed at evry disp with huge flikering….n i guess..for communication it has to be worked out on hardware itself …i guess…
yes check hardware connections also make some modifications in program if necessary.also check that the seven segments codes you have written is correct.