Discussion in "Project Help" started by    cenadius    Aug 19, 2007.
Sat Sep 15 2007, 02:01 am
#91
what help you need? can you please create a new topic? this discussion is different from your requirement...
Mon Sep 17 2007, 02:30 pm
#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, 01:34 pm
#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, 01:50 pm ]
Fri Sep 21 2007, 02:32 pm
#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, 02:59 pm
#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, 03:27 pm
#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, 05:25 pm
#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, 07:53 pm
#98
Sure i will update it...
Thu Oct 04 2007, 04:41 am
#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, 06:22 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

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am