26 lines
680 B
Org Mode
26 lines
680 B
Org Mode
|
:PROPERTIES:
|
||
|
:ID: 44750563-aa76-450d-8c72-cba9c0e0f6cd
|
||
|
:END:
|
||
|
#+title: MCP413X/415X/423X/425X
|
||
|
|
||
|
7/8-Bit Single/Dual SPI Digital POT with Volatile Memory
|
||
|
|
||
|
* Commands
|
||
|
#+begin_src python
|
||
|
def cmd(address, command, data=0x0):
|
||
|
command_byte = (address << 4 & 0b11110000
|
||
|
| command << 2 & 0b00001100)
|
||
|
if command in (0b00, 0b11):
|
||
|
# Include data byte
|
||
|
return bytearray([command_byte | (0b11 & data >> 8), data & 0xff])
|
||
|
return bytearray([command_byte])
|
||
|
|
||
|
return [format(b, '#010b') for b in cmd(0x01, 0b11, 0x4ff)]
|
||
|
#+end_src
|
||
|
|
||
|
#+RESULTS:
|
||
|
| 0b00011100 | 0b11111111 |
|
||
|
|
||
|
* Resources :ATTACH:
|
||
|
-[[attachment:22060b.pdf][Data Sheet]]
|