Discussion in "Project Help" started by    cenadius    Aug 19, 2007.
Sat Sep 15 2007, 02:01 am
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
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

	org 0BH
	ljmp timer0_int

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

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

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

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

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

	clr soc
	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

   setb F0
   setb fan
   mov TH0, R7
   clr TF0

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

	mov r6,#20
	mov r5,#255
	djnz r5,$
	djnz r6,wait

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

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


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
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
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
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
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
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
Sure i will update it...
Thu Oct 04 2007, 04:41 am
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


Powered by e107 Forum System



Sun May 19 2024, 07:39 am
Sat May 18 2024, 07:28 am
Fri May 17 2024, 06:14 pm
Fri May 17 2024, 10:28 am
Fri May 17 2024, 10:19 am
Fri May 17 2024, 09:53 am
Fri May 17 2024, 09:46 am
Thu May 16 2024, 07:31 pm