Documentation and explanation of example code

Published by kurisutofu on

Home Forums Cameras Modules for Raspberry Pi 5MP OV5647 V1 Cameras Documentation and explanation of example code

  • This topic has 3 replies, 2 voices, and was last updated 7 months ago by bin.
Viewing 2 reply threads
  • Author
    Posts
    • #13558
      kurisutofu
      Participant

      Hi,

      I’m playing with the motorized focus camera and used the example code from your github.
      While it is working fine, I’m having a hard time understanding what it is doing.

      I’m talking about the following code:

      value = (temp_val<<4) & 0x3ff0
      dat1 = (value>>8)&0x3f
      dat2 = value & 0xf0
      os.system("i2cset -y 0 0x0c %d %d" % (dat1,dat2))

      1 – I understand it’s using bitwise operators but what is it calculating?
      What is the purpose for dat1 and dat2?

      2 – Is there any doc I can refer to?
      For example, the chip and data address, are they fixed? Is it always 0 and 0x0c?

      3 – What are the SCL and SDA pins for?

      4 – What are the min/max values for dat1 and dat2?

      Thank you.

      • This topic was modified 7 months ago by kurisutofu.
    • #13598
      bin
      Keymaster

      Hi,
      1 – I understand it’s using bitwise operators but what is it calculating?
      What is the purpose for dat1 and dat2?

      This value is used to driver the motor current, Output current = (D[9:0]/1023) X 120mA
      User can control the motor rotate different angles through changing different current.
      the data1 is the value of D9-D4 and the data2 is the value of D0-D3.

      2 – Is there any doc I can refer to?
      For example, the chip and data address, are they fixed? Is it always 0 and 0x0c?
      The chip address is 0x0C, for the detail information, please refer to https://www.arducam.com/downloads/DW9714A-DONGWOON(Autofocus_motor_manual).pdf
      3 – What are the SCL and SDA pins for?
      This signal is i2c bus and used to control the motor

      4 – What are the min/max values for dat1 and dat2?
      The value range of the dat1 is 0x00 – 0x3F. The value of the dat2 is 0x00-0x0F.

      • #13602
        kurisutofu
        Participant

        Hi bin lv, thanks for the reply, it’s very useful!

        I’m not sure I understand what D[0:9] are but I’ll look into it.

    • #13625
      bin
      Keymaster

      OK. Let me know if you need more help.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.