ADC, MCP3008:修訂間差異

出自flip the world
Tommy留言 | 貢獻
已建立頁面,內容為 "800px|MCP3008 800px|MCP3008 with multi meter == Connection == <pre> MCP3008 Bus Pirate ======================= Vd…"
 
Tommy留言 | 貢獻
Refactor: add [[Category:Sensors and Modules ]]
 
第92行: 第92行:
# Measured voltage = 0x21D * 3.3 / 1024 = 1.7v
# Measured voltage = 0x21D * 3.3 / 1024 = 1.7v
</pre>
</pre>
[[Category:Sensors and Modules]]

2026年8月21日 (五) 13:17的最新修訂

MCP3008 MCP3008 with multi meter

Connection

MCP3008     Bus Pirate
=======================
Vdd         +3.3V
Vref        +3.3V
AGND        GND
CLK         CLK
Dout        MISO
Din         MOSI
CS/SHND     CS
DGND        GND

CH0         Vin
CH1         Vin
CH2         Vin
CH3         Vin
CH4         Vin
CH5         Vin
CH6         Vin
CH7         Vin

SPI mode setting

HiZ>m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
9. DIO
x. exit(without change)

(1)>5
Set speed:
 1. 30KHz
 2. 125KHz
 3. 250KHz
 4. 1MHz

(1)>1
Clock polarity:
 1. Idle low *default
 2. Idle high

(1)>1
Output clock edge:
 1. Idle to active
 2. Active to idle *default

(2)>2
Input sample phase:
 1. Middle *default
 2. End

(1)>1
CS:
 1. CS
 2. /CS *default

(2)>2
Select output type:
 1. Open drain (H=Hi-Z, L=GND)
 2. Normal (H=3.3V, L=GND)

(1)>2

ADC Read command

  • SPI Timing

MCP3008 - write cmd and get result

  • SPI clock

MCP3008 - SPI colck 30kHz

  • B9 - B0 stands for digital output
  • Measured voltage = 0xB9.B0 * (input voltage, ex., 3.3v) / 1024
SPI>][0x18rr]
/CS DISABLED
/CS ENABLED
WRITE: 0x18 ( XXX - start bit - single/diff - D2 - D1 - D0)
READ: 0xA1  ( XX - B9 - B8 - B7 - B6 - B5 - B4)
READ: 0xD7  ( B3 - B2 - B1 - B0 - XXXX)
/CS DISABLED
SPI>

# Measured voltage = 0x21D * 3.3 / 1024 = 1.7v