this program is correct ?

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

this program is correct ?

Do
   Waitms 500
   Kb = Getkbd()
   Kb = Lookup(kb , Equal)
   If Kb = 12 Then Goto Number

            Z = Getadc(0) : Z = Z / 2
Locate 1 , 1 : Lcd "temp is:" ; Z ; "c"


Locate 2 , 1
Lcd Time$
Waitms 500



   W = Getadc(1)
Loop Until W > 300
Cls
Lcd "Alarm"
Set Alarm

getadc0 = lm35
and getadc1 is mq5 ...the loops are correct ?!

my english isnt good !! use easy words pls !!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am not a native Chinese speaker, but code is MUCH easier to read if you use indentation. e.g. you line up blocks of code nicely.

Do
    foo
    ...
Loop Until bar

You will generally see for yourself if you have a problem with your logic.

It is also helpful to you, if you add a few comments.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

no i want to understand that this program have any problem ??

because i cant get answar in circuit with this program

my english isnt good !! use easy words pls !!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your main loop ends with

 Loop Until W > 300

And I do not like "If Kb = 12 Then Goto Number".
Are you not returning to main?

The code should probably be

   Do
      Waitms 500
      Kb = Getkbd()
      Kb = Lookup(kb , Equal)
      If Kb = 12 Then Goto Number       '??

      Z = Getadc(0) : Z = Z / 2
      Locate 1 , 1 : Lcd "temp is:" ; Z ; "c"
      Locate 2 , 1
      Lcd Time$
      Waitms 500


         Do
            W = Getadc(1)
         Loop Until W > 300

      Cls
      Lcd "Alarm"
      Set Alarm
   Loop

End
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

no this program have continu . number isnt important ! it is for get number from keypad

so see this ...i think i cant use your loops !

Main:
Reset Alarm
Reset Connect
S = Es

Cls

Do
   Waitms 500
   Kb = Getkbd()
   Kb = Lookup(kb , Equal)
   If Kb = 12 Then Goto Number

            Z = Getadc(0) : Z = Z / 2
Locate 1 , 1 : Lcd "temp is:" ; Z ; "c"




Locate 2 , 1
Lcd Time$
Waitms 500





   W = Getadc(1)
Loop Until W > 300
Cls
Lcd "Alarm"
Set Alarm


Do
   W = Getadc(1)
   B = W / 1024
   A = B * 100
   Lowerline
   Lcd A ; "%   "
   If W < 300 Then Goto Main
Loop Until W > 600
Cls
Lcd "Dialing..."
Lowerline
Lcd S
Set Connect
Wait 1
Dtmfout S , 200
Wait 15
Goto Main

my english isnt good !! use easy words pls !!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If runs correctly then probably is.If you have any doubts just compile and then simulate it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

so the post 6 : 31 pm is ok ?

my english isnt good !! use easy words pls !!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi excuse me comment on your post

i want to convert output of mq9 to ppm

i read the datasheet,but the datasheet just had a figure based on Rs/Ro and ppm

how can i convert the adc_data of output sensor to ppm?

please help me

tnx all

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mohammad,

 

In the future please use the "New Post" button to start a new topic, (new Thread), in the Forum.

 

This Thread is 5 years old, and people don't want to read through it to find your new question at the bottom.

 

To answer your question more info is needed.

What language?

What microcontroller?

What is mq9

How much experience do you have with the language and with microcontrollers?

What have you tried so far?

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok sure

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is mq9

An unmanned aerial vehicle?

http://en.wikipedia.org/wiki/Gen...

 

MQ-9 Reaper CBP.jpg

 

But given the context, probably more like

http://www.dfrobot.com/image/dat...

 

 

how can i convert the adc_data of output sensor to ppm?

Think about your question for a moment.  It is like asking "how long is a piece of string?"  Don't you think, for example, that the answer will be different if the ADC reference voltage is 1V or 3V or 5V?   And many other factors such as that.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Sun. Mar 8, 2015 - 07:25 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lots of pertinent hits on the first page of results

http://www.lmgtfy.com/?q=mq9+avr...

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.