Documentation and explanation of example code
Published by kurisutofu on
New Home › Forums › 1. 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 1 year, 1 month ago by
bin.
- AuthorPosts
- November 29, 2019 at 4:45 pm #13558
kurisutofu
ParticipantHi,
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 1 year, 1 month ago by
kurisutofu.
- This topic was modified 1 year, 1 month ago by
- December 2, 2019 at 2:47 am #13598
bin
KeymasterHi,
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 motor4 – 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.- December 2, 2019 at 3:49 am #13602
kurisutofu
ParticipantHi 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.
- December 3, 2019 at 3:02 am #13625
bin
KeymasterOK. Let me know if you need more help.
- AuthorPosts
- You must be logged in to reply to this topic.