Basic Programming Help
Jason Gulbinas
Posts: 17
hello:
· I am new to Basic programming and·am currently geting through both·"What's a Microcontroller" and "Applied Sensors" ... both very helpful.· I am wondering what the logic would be behind a very simple program I am working on.· The program would take the current temperature (I know this part of the program) and would make a beep with the transducer once a temperature is passed though (I know this part too).· The problem I am having is that once the "target temperature" is passed I want the program to enter a new area where it will not keep beeping if the temperature is fluctuating ariund the target.·
So:
- Once target temperature is hit (Something like IF Temp (Variable) > 21 THEN...make a beep (FREQUOUT)
BUT once that is done don't do it again until the program is restarted totally.· Therefore, if the Tepm variates around 21, say, I don't want it to keep beeping.· Once it gets there and keeps rising it is okay if the sensor goes down and up a few times but I don't want the command to be initiated again.
I guess I might be able to accomplish this with a Subroutine that is entered after the "Target temp" is reached and cannot get out of since it is on it's own DO...LOOP routine?
Or perhaps make an index where the index can only reach 1 and it does not happen again?
Any help would be appreciated!· Thanks in advance!
· I am new to Basic programming and·am currently geting through both·"What's a Microcontroller" and "Applied Sensors" ... both very helpful.· I am wondering what the logic would be behind a very simple program I am working on.· The program would take the current temperature (I know this part of the program) and would make a beep with the transducer once a temperature is passed though (I know this part too).· The problem I am having is that once the "target temperature" is passed I want the program to enter a new area where it will not keep beeping if the temperature is fluctuating ariund the target.·
So:
- Once target temperature is hit (Something like IF Temp (Variable) > 21 THEN...make a beep (FREQUOUT)
BUT once that is done don't do it again until the program is restarted totally.· Therefore, if the Tepm variates around 21, say, I don't want it to keep beeping.· Once it gets there and keeps rising it is okay if the sensor goes down and up a few times but I don't want the command to be initiated again.
I guess I might be able to accomplish this with a Subroutine that is entered after the "Target temp" is reached and cannot get out of since it is on it's own DO...LOOP routine?
Or perhaps make an index where the index can only reach 1 and it does not happen again?
Any help would be appreciated!· Thanks in advance!
Comments
if temp =< target temp + 1·or temp=> target temp -1 then
frequout pin, 0
endif
It's difficult to help without your complete program.
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.
That is why they call it the present.
Don't have VGA?
Newzed@aol.com
·
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.
That is why they call it the present.
Don't have VGA?
Newzed@aol.com
·
IF Temp (Variable) > 21 AND flag=0 THEN
' make a beep (FREQUOUT)
flag = 1
ENDIF
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com