اطلاعیه

Collapse
No announcement yet.

دقت SRF02 چقدره؟

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    دقت SRF02 چقدره؟

    سلام
    آیا SRF02 بر اساس میلی متر هم میتونه خروجی بده؟کسی تست کرده؟
    مدار یا سورس(بسکام) نمونه کسی داره بزاره تا ما بتونیم اینو راه بندازیم؟

    #2
    پاسخ : دقت SRF02 چقدره؟

    سلام
    اره سنسور خوبیه
    من راه انداختم
    دقتش هم فکر کنم 1 سانت باشه
    برنامه هم با c دارم
    برای بسکام ندارم

    دیدگاه


      #3
      پاسخ : دقت SRF02 چقدره؟

      سلام
      من با یسکام باهاش کار کردم وقتش خیلی خوب بود اما یادم می یاد کمتر از 5 سانت رو اگر اشتباه نکنم نمی تونست درست دیگه سنس کنه دقتش در حد چند میلی متر بود
      شرمنده حدودا 3 سال پیش باهاش کار کردم و الان کدهاش رو نداشتم اما ساده هست با پروتکل I2c راحت می تونین باهاش کار کنین فقط در آدرس دهی در صورت به کار گرفتن چندتاش دقت کنین تا مثل من که 4تاش رو داشتم راه اندازی می کردم(دو تا sfr02 و دو تا sfr06) اذیت نشین
      هیچ دانش آموزی نیست که به در خانۀ دانشمندی آمد و شد کند, مگر این که خداوند برای هر گامی که برمی دارد عبادت یک سال را برایش رقم زند.

      دیدگاه


        #4
        پاسخ : دقت SRF02 چقدره؟

        از این ماژولها حداکثر در حد یک سانت میتونی دقت بگیری

        دیدگاه


          #5
          پاسخ : دقت SRF02 چقدره؟

          http://www.iranmicro.ir/forum/showpost.php?p=41209&postcount=15

          دیدگاه


            #6
            پاسخ : دقت SRF02 چقدره؟

            در دوحالت USART و I2C کار میکند

            نمونه برنامه در حالت I2c با Bascom


            $regfile = "m8def.dat"
            $crystal = 8000000 'quartz frequency
            $baud = 9600
            $framesize = 42
            $swstack = 42
            $hwstack = 42


            '-------------------------------------------------------------------------------

            Config Scl = Portd.0 'ports for IIC-bus
            Config Sda = Portd.1

            '-------------------------------------------------------------------------------

            Config Lcdpin = Pin , Db4 = Portd.5 , Db5 = Portd.4 , Db6 = Portd.3 , Db7 = _
            Portd.2 , E = Portd.6 , Rs = Portd.7

            Config Lcd = 16 * 2

            Cursor Off
            Cls

            '-------------------------------------------------------------------------------

            Const Srf02_slaveid = &HE0 'default I2C address of SRF02
            Dim Distance As Integer
            Dim Slaveid As Byte

            '-------------------------------------------------------------------------------

            Declare Function Srf02_firmware(byval Slaveid As Byte) As Byte
            Declare Function Srf02_entfernung(byval Slaveid As Byte) As Integer

            '-------------------------------------------------------------------------------

            Wait 3 'Wait three seconds
            I2cinit


            '-------------------------------------------------------------------------------
            '
            ' ÔÑæÚ ÈÑäÇãå ÇÕáí
            '
            '-------------------------------------------------------------------------------


            Locate 1 , 3 : Lcd "Start Data"

            Do

            Slaveid = 5
            Distance = Srf02_entfernung(slaveid)
            Locate 2 , 1 : Lcd "Distance" ; Distance , "cm"
            Wait 1

            Loop



            '============================================ ===================================
            '============================================ ===================================


            End


            '============================================ ===================================
            '============================================ ===================================


            '============================================ ===================================
            '-------------------------------------------------------------------------------
            '------------- Auxiliary functions for SRF02 -------------
            '-------------------------------------------------------------------------------
            Function Srf02_firmware(byval Slaveid As Byte) As Byte

            Local Firmware As Byte
            Local Slaveid_read As Byte
            Slaveid_read = Slaveid + 1
            I2cstart 'Send a start sequence
            I2cwbyte Slaveid 'I2C address of the SRF02 with the R/W bit
            I2cwbyte 0 'read register set
            I2cstop 'Send the stop sequence.
            I2cstart 'Send a start sequence
            I2cwbyte Slaveid_read
            I2crbyte Firmware , Nack
            I2cstop 'Send the stop sequence.
            Srf02_firmware = Firmware

            End Function


            '============================================ ===================================
            '-------------------------------------------------------------------------------
            '
            '-------------------------------------------------------------------------------
            Function Srf02_entfernung(byval Slaveid As Byte) As Integer

            Local Low_byte As Byte
            Local High_byte As Byte
            Local Firmware As Byte
            Local Temp As Byte
            Local Slaveid_read As Byte

            Slaveid_read = Slaveid + 1

            'Start measurement process in
            I2cstart 'Send a start sequence
            I2cwbyte Slaveid 'I2C address of the SRF02 Register
            I2cwbyte 0 'Internal address of the command register
            I2cwbyte 81 'The command to start the SRF02 ranging in cm
            I2cstop 'Send the stop sequence

            ' Wait_surveying:
            ' Waitms 1
            ' Firmware = Srf02_firmware(slaveid)
            ' If Firmware = 255 Then Goto Wait_surveying

            Do
            Waitms 1
            Firmware = Srf02_firmware(slaveid)
            Loop Until Firmware = 255


            I2cstart 'Send a start sequence
            I2cwbyte Slaveid 'I2C address of the SRF02 Register
            I2cwbyte 2 'Internal address of the first distance register
            I2cstop 'Send the stop sequence
            I2cstart 'Send a start sequence again (repeated start)
            I2cwbyte Slaveid_read 'I2C address of the SRF02 with the R/W bit high
            I2crbyte High_byte , Ack 'I2C address of the SRF02 with the R/W bit low
            I2crbyte Low_byte , Nack 'Send the stop sequence
            I2cstop
            Srf02_entfernung = Makeint(low_byte , High_byte)

            End Function


            End

            دیدگاه

            لطفا صبر کنید...
            X