An 8051 Based Temperature Controlled Fan project
Tue Sep 04 2007, 05:33 pm
i hav read thru tis thread but i still got some problem to do with tis project. i hope to get some assist from u guys. thx
Tue Sep 04 2007, 07:20 pm
AJAY,I NEED MODIFIED MY PWM CODE WHICH WILL GIVE MY FAN 3 CONDITION FAN WILL OFF,SLOW AND FAST,CAN I CHANGE 1 OF THE VALUE INTO 0 IN ORFER MAKE IT OFF?SUCH AS SET MOV R7, #30 TO MOV R7, #0?ON THE OTHER HAND,THE SCHEMATIC CONNECTION HAD CHANGED,WILL IT AFFECT THE CODE SETTING?
Tue Sep 04 2007, 07:53 pm
well its really simple.. where you set the value 30.. instead of that switch off the timer.. clear the TF0 and stop the fan.. clear the FAN bit. just like we did in fast mode.. do the opposite for stop
also i saw the changes in the circuit.. i also told you to connect pullups on switches like you did on transistors.
and for 7 segment.. you need not to write such a big code..
also there are lot of modifications that are to be done in 7-seg display..
i am going to explain you with example..
say... you want to display a number like 39 (in hex) on display..
so.. as you already got the decoded value for displaying numbers on 7-seg.. you just need to separate the number to display and send it to the port where they are connected
The decode table will be the values you used in your program to send individual digits..
also i saw the changes in the circuit.. i also told you to connect pullups on switches like you did on transistors.
and for 7 segment.. you need not to write such a big code..
also there are lot of modifications that are to be done in 7-seg display..
i am going to explain you with example..
say... you want to display a number like 39 (in hex) on display..
so.. as you already got the decoded value for displaying numbers on 7-seg.. you just need to separate the number to display and send it to the port where they are connected
mov dptr,#decodedtable ;load the decoded values mov temp,a ;where temp is a temp variable anl a,#0F0H ;we just need the higher nibble swap a movc a,@a+dptr ; load the decoded value for ; the number to display mov 7segport,a ;7segport is the port where 7segments ;are connected acall delay ;you need some delay here.. about 10ms ;or more.. you can adjust it when u run ;then enable the common pin here setb common1 ;for first 7-seg ;now we send the lower nibble mov a,temp ;restore the number form temp anl a,#0FH ;mask the higher nibble to extract ;lower nibble only movc a,@a+dptr ;load the decoded value for ;lower nibble mov 7segport,a ;send the decoded value setb common2 ;enable the common pin for ;second 7-seg display decodedtable: db (decoded values here)....
The decode table will be the values you used in your program to send individual digits..
Tue Sep 04 2007, 08:01 pm
thanks for ur guideline,ajay,but 1 of my senior told me that we don need delay for 7segment code,cos it will alway display the temperature after get the data from adc
Tue Sep 04 2007, 08:03 pm
hye ajay..i got some problem with my assignment which is about 8051 based temperature controlled fan.
i having some difficulty about the source code.so,can u help me ??
i having some difficulty about the source code.so,can u help me ??
Tue Sep 04 2007, 08:24 pm
well cenadius.. we do need delay.. the reason is..
the 7-segs are connected to the same port.. and.. before the first 7-seg show the value you are deactivating it and displaying the second value... just test the code.. you will see nothing on 7-seg and you will see 88 on display.
the sequence is this way...
get the higher nibble..
move it to the seven segment port
activate the seven segment
put some delay
deactivate the seven segment
get the lower nibble
send to the seven segment port
activate the second seven segment
delay
deactivate it
This way you will see the proper value.
microcontroller execute instructions in microseconds.. so delay is must you can check with and without delay
@Natasha:
Please create a new thread.. and explain me your problem. I will surely help you out.
the 7-segs are connected to the same port.. and.. before the first 7-seg show the value you are deactivating it and displaying the second value... just test the code.. you will see nothing on 7-seg and you will see 88 on display.
the sequence is this way...
get the higher nibble..
move it to the seven segment port
activate the seven segment
put some delay
deactivate the seven segment
get the lower nibble
send to the seven segment port
activate the second seven segment
delay
deactivate it
This way you will see the proper value.
microcontroller execute instructions in microseconds.. so delay is must you can check with and without delay
@Natasha:
Please create a new thread.. and explain me your problem. I will surely help you out.
Tue Sep 04 2007, 09:00 pm
1 byte got 8 bits..
Bit 7 to Bit 4 - upper nibble
Bit 3 to Bit 0 - lower nibble..
combination of 4 bits is called a nibble
Bit 7 to Bit 4 - upper nibble
Bit 3 to Bit 0 - lower nibble..
combination of 4 bits is called a nibble
Powered by e107 Forum System