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

Sat Oct 24 2020, 11:19 PM
Rosalina
what is an outline of an essay https://essaywritinget.com - buying an essay online technology essays editing the essay where to buy essays comparative essay
Sat Oct 24 2020, 11:44 AM
Rene Derham
It’s only because he's a world-class copywriter, that he can hand you these done-for-you campaigns.
Thu Jun 11 2020, 06:27 AM
anudee
sir could please send the code for I2C and wifi interfacing with 8051
scena
Tue May 19 2020, 10:29 PM
Does anyone have microcontroller programming software for STC15F104W (core 8051, 4 k, 128 byte, 6 I/O pin, UART ... DIL8), that works?
Sat May 02 2020, 07:38 PM
Tamu Gurung
Hi I am looking for a assembly language program for a digital decimal counter. Time counts max limit of 2 mins starting from 2.00 mins and ending at 0.00. time is to be displayed on 4 7-segment LED displays. Edsim51 simulator to be used. Thanks
Wed Mar 25 2020, 01:39 PM
Tajammul
Sir kindly send the code file i2c for 8051
ExperimenterUK
Fri Mar 13 2020, 10:36 PM
@ Rohitnani,ABEBE..which project ?
Fri Mar 13 2020, 12:55 PM
ABEBE
how can get hadwere of this project
Rohitnani
Sat Mar 07 2020, 05:11 PM
Sir, Could you please send me the zip file input password....
Wed Feb 26 2020, 04:58 PM
Peter Parker
Is it possible to send multiple messages using only 1 GSM module?

Downloads

Comments

Mirza123
Thu Jun 25 2020, 03:46 PM
eunicelove124
Mon Jun 22 2020, 03:03 PM
cerouno
Tue Jun 16 2020, 05:10 PM
Marce
Sat Jun 13 2020, 09:43 PM
Davidthils
Thu May 21 2020, 12:44 PM
Jakeror
Thu May 21 2020, 01:28 AM
motorCar
Wed May 20 2020, 07:05 PM
Vordrync
Wed May 20 2020, 11:52 AM

Online

Guests: 92, Members: 0 ...

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

Members: 38215
Newest member: Mirza123