Discussion in "Project Help" started by    cenadius    Aug 19, 2007.
Mon Sep 10 2007, 07:22 pm
#71
Ajay,
May I know how we can have preset values in PWM? How we can make PWM accept values from ADC after ADC have finished translating the analogue signal?
Mon Sep 10 2007, 09:08 pm
#72
after finishing the ADC conversion you will get some value from the ADC, as you want the fan to be at three speeds (OFF, Slow, Fast)
The values you used in case of manual can be used in auto mode too.. all you need to do is check the temperature.
e.g if temp is between less than 20° - Fan off (stop timer and clear the fan bit)
if temp is between 20° to 30° - Fan slow (run the PWM with the same value as decided in manual mode)
if temp is between 30° and above - Fan Fast (stop timer and set the fan bit)

This how the auto mode works.. and for PWM values you can use any value i suggest you using 100. Value can be between 0 to 255. as only slow mode is there so 100 is ok.
Mon Sep 10 2007, 10:02 pm
#73
So that's mean code for PWM that you've posted before is complete? We only need to write the code for checking condition, is it? What is the code to stop the timer?
Tue Sep 11 2007, 12:50 am
#74
yes the code is complete..

What is the code to stop the timer?

tsubasa


:mad :mad :mad
clr TR0 or whatever timer you are using.. the clear the timer run bit.. i cannot believe you people are really studying or what... :-s
Tue Sep 11 2007, 01:15 am
#75
Hehe. Relax Ajay. Cool.....down..... Actually the time I wrote that question was when I had been pressured by my group leader to finish the coding. I also don't know why I asked you that stupid question. Sorry for that.
Tue Sep 11 2007, 01:25 am
#76
Ajay, today i just try my program but.....so... :mad:....7segment cant display properly...:mad:
Tue Sep 11 2007, 01:44 am
#77
make a simple counter program to check..
Tue Sep 11 2007, 08:00 am
#78
Ajay,
for cenadius code he used 4 seven segment disp. What about if we only use 2 seven segment? The code is still the same, is it? The different only at the lookup table, right?
Wed Sep 12 2007, 02:28 am
#79
As per you said in PM...
you are doing wrong.. he said.. V is the ADC value.. from 0 to 255. LM35 gives voltage o/p in mV for every 1° rise there is increase in 10mV.
So if the temp is 20°C then the voltage o/p will be 20*10 = 200mV

Now when you work with ADC, the total voltage range is divided in 256 steps. so... each step is equal to 5/256 V
or 19mV approximately. So you might be having little error in reading the temperature but it will be very close to the actual one.

So.. all you have to do is.. convert the ADC value directly to the temperature value.. and make a lookup table for that.. as i said you can have V from 0 to 255 so, you will have 256 different values as answer, that will be your temperature
Wed Sep 12 2007, 10:51 am
#80
i m really weak in assembly programming..May i ask some question which might sound silly to u all..?

when i wan to use a pin from my uC, i shud "SETB PX.X" right?

lets take a switch to pin P1.0as an example,

when the switch is on(do not grounded) den my P1.0 will detected as 1? when the the switch is grounded it will giv reading of 0. m i right?

e.g
a switch connect to P1.0
to control which mode to b used(auto or manual)
:wat i wan is when the switch is open den it will go to manual when it is grounded(pressed) it goes to auto

check out my code..

ORG 0000H
LOOP:SETB P1.0
JNB P1.0, AUTO
JMP MANUAL

AUTO:...................
..............
JMP LOOP

MANUAL:..............
.............
JMP LOOP

END

can tis stupid thing work? sry i m nt gd in programming. alwez ask stupid question..:P

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Clydehet
Wed May 01 2024, 06:44 pm
Davidoried
Wed May 01 2024, 06:11 pm
KevinTab
Sun Apr 28 2024, 05:35 am
Tumergix
Sun Apr 28 2024, 12:59 am
StevenDrulk
Sat Apr 27 2024, 08:47 pm
StephenHauct
Sat Apr 27 2024, 09:38 am
Adamsaf
Sat Apr 27 2024, 07:12 am
Robertphype
Sat Apr 27 2024, 12:23 am