Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Mehdi
06/27/05 04:21
Modified:
  06/27/05 04:30

Read: 1341 times
Tehran
Iran


 
Msg Score: +1
 +1 Good Answer/Helpful
#96003 - Ultrasonic Detection Code!
Responding to: Pradono Antyanto's previous message
Dear Pradono
Because of you didn't post full parts of your code
We can't say you what is exact problem
I select some part of my program which i write previously for your need
Try it and let me know the result
Good Luck
Mehdi


;This program is for ultrasonic range meter(without temperature effect calculating)
;at first mcu sends one 40khz pulse,
;if reflected pulse is received less than 70 msec
;means that distance is short
;but if the timer is overflowed,then mcu sends ten 70khz pulse and T_Flag is set
;if reflected pulse is received less than 70 msec
;means that distance is medium
;but if the timer is overflowed,then mcu sends twenty 70khz pulse and T_Flag is set
;again,if reflected pulse is received less than 70 msec
;means that distance is long
;but if the timer is overflowed,mcu must send this message to display and T_Flag is set
;distance is undetermined (you must add this part of code to your program in START_1:)

T_FLAG                EQU 00H
REC                   EQU P2.3
REC_START             EQU P2.4
TRANS                 EQU P2.5
PULSE_POWER           EQU 40H

CLR T_FLAG

;...
;...
;...

START_OF_MEASURING:
LCALL CHANGE_POWER              ;CHANGE NUMBER OF 40 KHZ PULSES IN TRANSMITTER
MOV TMOD,#00010000B
MOV TH1,#0
MOV TL1,#0
SETB TR1
LCALL PULSE_GEN                 ;SEND 40 KHZ PULSE ACCORDING TO PULSE_POWER VALUE
SETB REC
SAS10:                          ;PREVENTING FROM FATAL ERROR
JB REC,SAS10                    ;FIRST EFFECT OF TRANSMITTER IN RECIEVER
SAS12:
JB TF1,START_1
JNB REC,SAS12                   ;CORRECT REFLECTION IS OBTAINED
CLR TR1                         ;SAVE TIMER VALUE
CLR T_FLAG                      ;POWER OF PULSE IS SUITABLE
                                ;NOW YOU CAN FIND THE DISTANCE EASILY
RET

START_1:
SJMP START_OF_MEASURING         ;DISTANCE IS UNDETERMINED(TIMER IS OVERFLOWED)
                                ;TRY AGAIN


CHANGE_POWER:
JNB T_FLAG,NEXT_3
MOV A,PULSE_POWER
CJNE A,#1,NEXT_1
MOV PULSE_POWER,#10
RET

NEXT_1:
CJNE A,#10,NEXT_2
MOV PULSE_POWER,#20
RET

NEXT_2:
CJNE A,#20,NEXT_3
MOV PULSE_POWER,#1
NEXT_3:
RET

PULSE_GEN:
MOV R7,PULSE_POWER
HEY:
SETB TRANS
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
CLR TRANS
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
DJNZ R7,HEY
SETB TRANS
RET


List of 187 messages in thread
TopicAuthorDate
Ultrasonic Signal Processing        Stanley Lio      06/10/05 08:11      
   Time dependant gain        Jez Smith      06/10/05 08:29      
      Further attenuation...      Andy Neil      06/13/05 15:39      
   Signal recovery.      Steve M. Taylor      06/10/05 10:11      
      AGC?      Stanley Lio      06/10/05 19:25      
   AGC as Steve said//      Payam Soltany      06/10/05 10:49      
   My Algorithm was:      Mehdi      06/10/05 11:11      
      My Algorithm was:      Mehdi      06/10/05 22:08      
   Ultrasonic Ranging      Mahmood Elnasser      06/10/05 11:46      
   Matched filter on the rescue      Enrique Viseras-marin      06/10/05 13:25      
   matched filters      Jez Smith      06/10/05 14:36      
      Phase locked amplifier      Steve M. Taylor      06/10/05 15:04      
         Its a different thing      Jez Smith      06/11/05 01:41      
            Ah      Steve M. Taylor      06/11/05 05:35      
               Thats the one....      Jez Smith      06/11/05 07:47      
                  Clever woman      Steve M. Taylor      06/11/05 12:15      
      Just an idea      Enrique Viseras-marin      06/10/05 16:06      
   The scope plot tells it all!        Kai Klaas      06/10/05 17:43      
   Largest signal      Stanley Lio      06/10/05 19:24      
      'Greatest' echo is the wrong criterion!      Kai Klaas      06/11/05 03:31      
               Stanley Lio      06/11/05 03:47      
         somehow I remember...      Stanley Lio      06/11/05 07:47      
            No, no...      Kai Klaas      06/13/05 10:22      
               Oops~ forgot...      Stanley Lio      06/14/05 00:50      
   the product      Stanley Lio      06/10/05 19:40      
      Power of transmission pulse      Mehdi      06/10/05 22:41      
   Preamp circuit Here      Stanley Lio      06/11/05 03:52      
      Add caps to remove base line noise      Kai Klaas      06/11/05 03:58      
      Another potential problem...      Musharraf Hanif      06/11/05 06:32      
   Problem with ADC?      Musharraf Hanif      06/11/05 06:12      
   possible solution to the ADC problem      Musharraf Hanif      06/11/05 06:52      
      Ok~      Stanley Lio      06/11/05 07:39      
   Debug Result      Stanley Lio      06/13/05 07:38      
      ADC Sampling and code debugging      Mahmood Elnasser      06/13/05 13:01      
         sampling time      Stanley Lio      06/14/05 00:53      
   Adc for Ultrasonic?      Reza Javan      06/14/05 01:22      
   Next, comes to "average"      Stanley Lio      06/20/05 21:05      
      Why use the adc?      Russell Bull      06/20/05 21:42      
         Forgot to tell...      Stanley Lio      06/21/05 00:07      
   Circle in RED      Stanley Lio      06/21/05 00:37      
   Asking for help again - Filter      Stanley Lio      06/22/05 05:20      
      Notch      Steve M. Taylor      06/22/05 06:05      
         I don't know      Stanley Lio      06/22/05 08:38      
            DSP      Mahmood Elnasser      06/22/05 14:38      
               Nah      Steve M. Taylor      06/22/05 14:39      
                  for the sake of learning      Mahmood Elnasser      06/22/05 14:42      
                     so      Steve M. Taylor      06/22/05 16:13      
                        I agree      Mahmood Elnasser      06/23/05 00:13      
         Amplitude      Stanley Lio      06/22/05 20:23      
            Op amps      Steve M. Taylor      06/23/05 03:08      
               100pF      Stanley Lio      06/23/05 07:32      
                  bypass ??      Steve M. Taylor      06/23/05 07:47      
                     Yes      Stanley Lio      06/23/05 07:55      
                        No sort of bypass      Steve M. Taylor      06/23/05 08:08      
                           BTE054 BTE054USS2      Stanley Lio      06/23/05 08:18      
                              Better noise control      Steve M. Taylor      06/23/05 09:22      
                              re: BTE054      Jacob Boyce      06/23/05 13:29      
                                 Replace LMV6032 with LM324      Stanley Lio      06/23/05 19:40      
                                    re:low sensitivity      Jacob Boyce      06/24/05 07:18      
                              re:no filtering      Jacob Boyce      06/23/05 13:37      
                                 Note      Steve M. Taylor      06/23/05 14:27      
                                 Notch filter?      Stanley Lio      06/23/05 19:46      
                                    No,      Steve M. Taylor      06/24/05 04:16      
      Bandpass      Kai Klaas      06/23/05 17:31      
         NOT a criticism      Steve M. Taylor      06/24/05 04:19      
            Update...      Kai Klaas      06/24/05 07:02      
               Umm... Nowadays?      Stanley Lio      06/24/05 07:15      
                  Op amp parameters      Steve M. Taylor      06/24/05 07:27      
                     "Filters for Dummy"      Stanley Lio      06/24/05 07:34      
                        Have you tried it with .....      Steve M. Taylor      06/24/05 07:47      
                           Yes, I've tried it and it works well      Stanley Lio      06/24/05 09:58      
                              Basic electronics      Steve M. Taylor      06/24/05 10:06      
                                 0.002uF -> 3300uF      Stanley Lio      06/24/05 10:15      
                                    re:noise      Jacob Boyce      06/24/05 10:29      
                                       Exactly the same      Stanley Lio      06/24/05 10:44      
                                          test of signal      Jacob Boyce      06/24/05 11:08      
                                             It's over 1.2m      Stanley Lio      06/24/05 19:49      
                                    TWO bypass caps.      Steve M. Taylor      06/24/05 11:05      
                                 Two were found      Stanley Lio      06/24/05 10:47      
                                    Usenet      Steve M. Taylor      06/24/05 11:17      
                              Why using a PLL, when a bandpass can ...      Kai Klaas      06/24/05 11:06      
                                 which is why ,,,,      Steve M. Taylor      06/24/05 11:13      
                                    Not sure what you meant..      Kai Klaas      06/24/05 12:16      
                                 Already      Stanley Lio      06/24/05 20:11      
                                    But it MUST work properly!!      Kai Klaas      06/25/05 04:21      
                                       Circuit here      Stanley Lio      06/25/05 05:45      
                                       Op-amp to replace LM324      Stanley Lio      06/25/05 06:20      
         Non-inverting Input Voltage Divider      Stanley Lio      06/24/05 06:08      
   LM567      Stanley Lio      06/24/05 07:19      
   re:LM324      Jacob Boyce      06/24/05 08:25      
      re:wrong link      Jacob Boyce      06/24/05 08:28      
      No AGC        Steve M. Taylor      06/24/05 09:37      
         AGC      Jacob Boyce      06/24/05 09:48      
            Yes      Steve M. Taylor      06/24/05 09:51      
         re: no AGC      Jacob Boyce      06/24/05 10:10      
      LMC6032 is much more linear than LM324        Kai Klaas      06/24/05 11:24      
         re:      Jacob Boyce      06/24/05 11:29      
         re:attenuation of signal      Jacob Boyce      06/24/05 11:42      
            Good ones and bad ones      Kai Klaas      06/24/05 12:23      
         another article of interest      Jacob Boyce      06/24/05 12:07      
   tramsmit & receive      Reza Javan      06/25/05 02:45      
      how to measure the distance perfectly?      Pradono Antyanto      06/26/05 08:26      
         Fatal Error!      Mehdi      06/26/05 09:25      
            How about this one....      Pradono Antyanto      06/27/05 02:04      
               Ultrasonic Detection Code!        Mehdi      06/27/05 04:21      
                  is that right?      Erik Malund      06/27/05 11:57      
                     Not right,,,,,      Michael Karas      06/27/05 12:20      
                        Thanks!      Mehdi      06/27/05 19:44      
                  another missing!      Mehdi      06/27/05 19:55      
                  i'll try it..      Pradono Antyanto      06/28/05 05:08      
   Some Applications of ultrasonic      Reza Javan      06/25/05 02:49      
   "Op amps for everyone"      Stanley Lio      06/25/05 06:24      
   woo... tiring trip      Stanley Lio      06/26/05 04:55      
      Check this one      Kai Klaas      06/26/05 17:04      
         Thanks      Stanley Lio      06/26/05 19:52      
            is it not fundamentally wrong      Erik Malund      06/27/05 12:01      
               Both      Stanley Lio      06/27/05 18:09      
               I knew that...      Kai Klaas      06/28/05 05:16      
                  Synthetic grounds      Steve M. Taylor      06/28/05 06:24      
                  no, Kai      Erik Malund      06/28/05 06:30      
                     Steve, Erik      Kai Klaas      06/28/05 07:05      
         The circuit works, but...      Stanley Lio      06/27/05 22:08      
            Moral      Steve M. Taylor      06/28/05 05:15      
               Puh, what antennas...      Kai Klaas      06/28/05 05:41      
                  Which means I can't use breadboard      Stanley Lio      06/28/05 07:54      
                     In one word.      Steve M. Taylor      06/28/05 07:55      
            Using the LM318      Stanley Lio      06/28/05 22:19      
               Missing 10K      Jerson Fernandes      06/29/05 02:23      
                  More caps      Steve M. Taylor      06/29/05 03:18      
                  Where?      Stanley Lio      06/29/05 05:53      
                     Parallel      Jerson Fernandes      06/30/05 06:37      
                     Does it work now?      Kai Klaas      07/01/05 07:43      
                        Yes, it works fine      Stanley Lio      07/02/05 02:26      
               Theoretical work missed      Kai Klaas      06/29/05 06:26      
   Fatal Error!      Mehdi      06/26/05 09:24      
      Another article to peruse      Russell Bull      06/27/05 01:19      
         Another one...      Kai Klaas      06/27/05 04:31      
            same application      Mehdi      06/27/05 06:47      
               Sorry      Kai Klaas      06/27/05 07:56      
                  Why sorry?      Mehdi      06/27/05 08:31      
            That's exactly what I want to do      Stanley Lio      06/27/05 18:18      
            which one is the best way?      Pradono Antyanto      07/11/05 04:39      
               Capacitors      Steve M. Taylor      07/11/05 04:53      
                  i've got it      Pradono Antyanto      07/11/05 05:10      
   not the best solution      Benjamin Damet      07/01/05 08:09      
      Laser ranging      Steve M. Taylor      07/01/05 14:59      
         how much      Stanley Lio      07/02/05 02:30      
      I've withdrawn from the competition      Stanley Lio      07/02/05 03:00      
         NOT finance      Steve M. Taylor      07/02/05 03:44      
            Re: money is not everything      Stanley Lio      07/02/05 09:38      
               Good Luck      Raghunathan      07/02/05 18:20      
               good luck      James Hinnant      07/03/05 00:58      
                  Good luck      Steve M. Taylor      07/03/05 05:34      
                     Thanks!      Stanley Lio      07/03/05 06:34      
                        The noise again      Pradono Antyanto      07/12/05 05:01      
                           re:link      Jacob Boyce      07/12/05 06:46      
                           Link      Stanley Lio      07/12/05 09:20      
                              this is the link      Pradono Antyanto      07/12/05 09:24      
                                 re:noise      Jacob Boyce      07/12/05 12:02      
                                    5-14 Khz      Pradono Antyanto      07/12/05 12:56      
                                       re:5-14kHz      Jacob Boyce      07/12/05 13:02      
                                          The Noise Amplitude      Pradono Antyanto      07/12/05 13:13      
                                 gain      Jacob Boyce      07/12/05 14:19      
                                    the problem is gain      Pradono Antyanto      07/12/05 14:38      
                                 Schematic        Kai Klaas      07/13/05 17:29      
                                    Thank You but...      Pradono Antyanto      07/14/05 00:26      
                                    Thank You but...      Pradono Antyanto      07/14/05 00:36      
                                       1/4Watt is enough      Kai Klaas      07/14/05 05:03      
                                          Simulation result      Pradono Antyanto      07/14/05 05:31      
                                             Strange plots...      Kai Klaas      07/14/05 07:09      
                                                How about Compensation?      Pradono Antyanto      07/15/05 00:24      
                                                   Not needed      Kai Klaas      07/15/05 04:33      
                                                      Bigger Pulse      Pradono Antyanto      07/30/05 05:35      
                                                         Bridge configuration can help      Kai Klaas      07/30/05 10:46      
                                                            The same circuit but...      Pradono Antyanto      07/30/05 22:52      
                                                               ...but much stronger      Kai Klaas      07/31/05 05:02      
                                                                  I have tried      Pradono Antyanto      07/31/05 07:42      
                                                                     What do you mean by ripple?      Kai Klaas      08/01/05 07:37      
                                                                        The ripple      Pradono Antyanto      08/02/05 08:42      
                                                                           No, it is not. The output from a logic      Erik Malund      08/02/05 08:48      
                                                                           Answer      Kai Klaas      08/02/05 09:00      
                                                                              Yup Kai      Pradono Antyanto      08/02/05 09:06      
                                                                                 It's to adjust oscillating frequency      Kai Klaas      08/03/05 07:10      
                                                                                    Finished      Pradono Antyanto      08/03/05 23:59      
                        Exams VS academic      Li Wk      07/16/05 08:24      
                           "Plan B"      Stanley Lio      07/17/05 05:09      
                              Universities in HongKong      Li Wk      07/30/05 20:03      

Back to Subject List