Discussion in "Project Help" started by    cenadius    Aug 19, 2007.
Fri Sep 14 2007, 08:31 PM
#91
what help you need? can you please create a new topic? this discussion is different from your requirement...
Mon Sep 17 2007, 09:00 AM
#92
here is the complete code.. just read it.. see the instruction set carefully and try to imaging what is going on...
Test it on board directly.. and i cannot guarantee 100% working..
all you need to do is test it..

;-------------------------------------------
;
;   Function of switches used in my program
;
;      SPDT = Auto/Manual
;      SW2 = Off
;      SW3 = Low
;      SW4 = Fast
;
;-------------------------------------------

automan equ P3.4
off     equ P1.4
flow    equ P1.5
ffast   equ P1.6
soc     equ P3.1
read    equ P3.0
fan     equ P3.3
mode    equ 20H
done    equ 21H
adc     equ 30H
adcport equ P2
MSB     equ P1.0
LSB     equ P1.1
seg7    equ P0

	org 0H
	sjmp start

	org 03H
	setb done
	reti

	org 0BH
	ljmp timer0_int

start:
	clr fan
	clr done
	clr mode
	clr MSB
	clr LSB
	mov IE,#10000011B
	
scan:
	acall read_adc
	JNB automan,auto
	clr mode
	sjmp manual
auto:
	setb mode
manual:
	JB mode,inauto
	JNB off,fanoff
	JNB flow,fanlow
	JNB ffast,fanfast
	sjmp scan

fanoff:
	clr TR0
	clr TF0
	clr fan
	JNB off,$
	sjmp scan

fanlow:
	mov r7,#50H
	setb TR0
	JNB flow,$
	sjmp scan

fanfast:
	clr TR0
	clr TF0
	setb fan
	JNB ffast,$
	sjmp scan

inauto:
	mov a,adc
	clr c
	cjne a,#30H,chk
chk:
	jc fanoff
	clr c
	cjne a,#60H,chk1
chk1:
	jc fanlow
	sjmp fanfast

read_adc:
	clr soc
	nop
	setb soc
	jnb done,$
	clr done
	clr read
	mov a,adcport
	setb read

	mov dptr,#ctable
	movc a,@a+dptr
	mov adc,a

	mov dptr,#dtable
	swap a
	anl a,#0FH
	movc a,@a+dptr
	mov seg7,a
	setb MSB
	acall delay
	clr MSB

	mov a,adc
	anl a,#0FH
	movc a,@a+dptr
	mov seg7,a
	setb LSB
	acall delay
	clr LSB
	ret

timer0_int:
   JB F0, HIGH_DONE
LOW_DONE:
   setb F0
   setb fan
   mov TH0, R7
   clr TF0
   reti

HIGH_DONE:
   clr F0
   clr fan
   mov A, #0FFH
   clr C
   subb A, R7
   mov TH0, A
   clr TF0
   reti

delay:
	mov r6,#20
wait:
	mov r5,#255
	djnz r5,$
	djnz r6,wait
	ret

ctable:
DB 0H, 0H, 1H, 1H, 2H, 2H, 2H, 3H
DB 3H, 4H, 4H, 4H, 5H, 5H, 5H, 6H
DB 6H, 7H, 7H, 7H, 8H, 8H, 9H, 9H
DB 9H, 10H, 10H, 11H, 11H, 11H, 12H, 12H
DB 13H, 13H, 13H, 14H, 14H, 15H, 15H, 15H
DB 16H, 16H, 16H, 17H, 17H, 18H, 18H, 18H
DB 19H, 19H, 20H, 20H, 20H, 21H, 21H, 22H
DB 22H, 22H, 23H, 23H, 24H, 24H, 24H, 25H
DB 25H, 25H, 26H, 26H, 27H, 27H, 27H, 28H
DB 28H, 29H, 29H, 29H, 30H, 30H, 31H, 31H
DB 31H, 32H, 32H, 33H, 33H, 33H, 34H, 34H
DB 35H, 35H, 35H, 36H, 36H, 36H, 37H, 37H
DB 38H, 38H, 38H, 39H, 39H, 40H, 40H, 40H
DB 41H, 41H, 42H, 42H, 42H, 43H, 43H, 44H
DB 44H, 44H, 45H, 45H, 45H, 46H, 46H, 47H
DB 47H, 47H, 48H, 48H, 49H, 49H, 49H, 50H
DB 50H, 51H, 51H, 51H, 52H, 52H, 53H, 53H
DB 53H, 54H, 54H, 55H, 55H, 55H, 56H, 56H
DB 56H, 57H, 57H, 58H, 58H, 58H, 59H, 59H
DB 60H, 60H, 60H, 61H, 61H, 62H, 62H, 62H
DB 63H, 63H, 64H, 64H, 64H, 65H, 65H, 65H
DB 66H, 66H, 67H, 67H, 67H, 68H, 68H, 69H
DB 69H, 69H, 70H, 70H, 71H, 71H, 71H, 72H
DB 72H, 73H, 73H, 73H, 74H, 74H, 75H, 75H
DB 75H, 76H, 76H, 76H, 77H, 77H, 78H, 78H
DB 78H, 79H, 79H, 80H, 80H, 80H, 81H, 81H
DB 82H, 82H, 82H, 83H, 83H, 84H, 84H, 84H
DB 85H, 85H, 85H, 86H, 86H, 87H, 87H, 87H
DB 88H, 88H, 89H, 89H, 89H, 90H, 90H, 91H
DB 91H, 91H, 92H, 92H, 93H, 93H, 93H, 94H
DB 94H, 95H, 95H, 95H, 96H, 96H, 96H, 97H
DB 97H, 98H, 98H, 98H, 99H, 99H, 00H, 00H

dtable:
DB 3FH, 06H, 5BH, 4FH, 66H, 6DH, 7DH, 07H, 7FH, 67H

END



Note: Temp 100° cannot be displayed on 2 7-segments.
 Sir Phoenix like this.
Tags 8051 based temperature controlled fanautomatic fan controlseven segment display
Fri Sep 21 2007, 08:04 AM
#93
yeah!! At last my projects is ended,however it is a failure, but no matter what i wan post my highly appreciation here to AJAY who have give me so many help and guidelines in doing the coding part of this projects.


[ Edited Fri Sep 21 2007, 08:20 AM ]
Fri Sep 21 2007, 09:02 AM
#94
I am sorry... for that failure.. but thats how you learn. it was a project work an assignment and if i would give you the code directly you could have never learn anything.
Now the working code is there in my last post so you can try it out
Thank you for your comments
Fri Sep 21 2007, 09:29 AM
#95
actually my project failure is no bcause the code not working but the hardware got problem,it make my 8051 cant run,all my group mate even my senior also donno why, 1 of my lecture told e that my 7segment display got problem and have drag all the 8051 current and make it malfunction
Fri Sep 21 2007, 09:57 AM
#96
hmm.. i saw your circuit and it doesn't look like you have problem with the 7-seg. Could be that during development process of the project it got malfunctioned. Still the real problem could only be found if i see the controller or the board myself.
Fri Sep 21 2007, 11:55 AM
#97
Ajay, can u put the comment on the code to make me can understand how the code that u write flow? thanks
Fri Sep 21 2007, 02:23 PM
#98
Sure i will update it...
Wed Oct 03 2007, 11:11 PM
#99
hey,ajay,can u teach me how to write the delay code?my exam is near but i stil not understand on how to write the delay code,u just use any example u have and explain to me pls....
Thu Oct 04 2007, 12:52 PM
can you start a new topic on this? i just don't want to confuse people...
There are common two methods to generate delay.. first is using timers and second is registers... so i will explain both of them and also answer your doubts. Please create another topic

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: 22, 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...