@@ -22,34 +22,34 @@ The library is not tested with all different devices however stable.
2222Please post an issue if there are problems with a specific device.
2323
2424
25- | Type | Channels | Bits | MaxValue | Voltage reference |
26- | :--------| :--------:| :----:| :--------:| :-----------------:|
27- | MCP4801 | 1 | 8 | 255 | internal 2.048 V |
28- | MCP4802 | 2 | 8 | 255 | internal 2.048 V |
29- | MCP4811 | 1 | 10 | 1023 | internal 2.048 V |
30- | MCP4812 | 2 | 10 | 1023 | internal 2.048 V |
31- | MCP4821 | 1 | 12 | 4095 | internal 2.048 V |
32- | MCP4822 | 2 | 12 | 4095 | internal 2.048 V |
33- | MCP4901 | 1 | 8 | 255 | external |
34- | MCP4902 | 2 | 8 | 255 | external |
35- | MCP4911 | 1 | 10 | 1023 | external |
36- | MCP4912 | 2 | 10 | 1023 | external |
37- | MCP4921 | 1 | 12 | 4095 | external |
38- | MCP4922 | 2 | 12 | 4095 | external |
25+ | Type | Channels | Bits | MaxValue | Voltage reference |
26+ | :--------| :---------- :| :------ :| :---------- :| :-- -----------------:|
27+ | MCP4801 | 1 | 8 | 255 | internal 2.048 V |
28+ | MCP4802 | 2 | 8 | 255 | internal 2.048 V |
29+ | MCP4811 | 1 | 10 | 1023 | internal 2.048 V |
30+ | MCP4812 | 2 | 10 | 1023 | internal 2.048 V |
31+ | MCP4821 | 1 | 12 | 4095 | internal 2.048 V |
32+ | MCP4822 | 2 | 12 | 4095 | internal 2.048 V |
33+ | MCP4901 | 1 | 8 | 255 | external |
34+ | MCP4902 | 2 | 8 | 255 | external |
35+ | MCP4911 | 1 | 10 | 1023 | external |
36+ | MCP4912 | 2 | 10 | 1023 | external |
37+ | MCP4921 | 1 | 12 | 4095 | external |
38+ | MCP4922 | 2 | 12 | 4095 | external |
3939
4040
4141The output voltage of the MCP_DAC depends on the voltage supplied,
4242which is in the range of 2.7V .. 5.5V. Check datasheet for the details.
4343
4444
45- #### 0.5.0 Breaking change
45+ ### 0.5.0 Breaking change
4646
4747Version 0.5.0 introduced a breaking change to improve handling the SPI dependency.
4848The user has to call ** SPI.begin()** or equivalent before calling ** MCP.begin()** .
4949Optionally the user can provide parameters to the ** SPI.begin(...)**
5050
5151
52- #### 0.4.0 Breaking change
52+ ### 0.4.0 Breaking change
5353
5454The version 0.4.0 has breaking changes in the interface.
5555The rationale is that the programming environment of the ** Arduino ESP32 S3**
@@ -72,24 +72,25 @@ The following library functions have been renamed:
7272
7373
7474
75- #### 0.3.0 breaking change
75+ ### 0.3.0 breaking change
7676
7777The version 0.3.0 has breaking changes in the interface. The essence is that the
7878dependency of Wire (ESP32 / RP2040) is removed from the library.
7979This makes it possible to support the ** ESP32-S3** and other processors in the future.
8080Also it makes the library a bit simpler to maintain.
8181
8282
83- #### Related
83+ ### Related
8484
8585- https://github.com/RobTillaart/MCP_ADC
86- - https://github.com/RobTillaart/MAX520
87- - https://github.com/RobTillaart/MCP_DAC
88- - https://github.com/RobTillaart/MCP4725
89- - https://github.com/RobTillaart/DAC8550
90- - https://github.com/RobTillaart/DAC8551
91- - https://github.com/RobTillaart/DAC8552
92- - https://github.com/RobTillaart/DAC8554
86+ - https://github.com/RobTillaart/DAC8550 1 channel, 16 bit
87+ - https://github.com/RobTillaart/DAC8551 1 channel, 16 bit
88+ - https://github.com/RobTillaart/DAC8552 2 channel, 16 bit
89+ - https://github.com/RobTillaart/DAC8554 4 channel, 16 bit
90+ - https://github.com/RobTillaart/MCP_DAC 1, 2 channel, 8,10,12 bit
91+ - https://github.com/RobTillaart/AD5680 (18 bit DAC)
92+ - https://github.com/RobTillaart/MAX520 I2C, 4, 8 channel, 8 bit
93+ - https://github.com/RobTillaart/MCP4725 I2C, 1 channel, 12 bit
9394
9495
9596## Interface
@@ -98,7 +99,7 @@ Also it makes the library a bit simpler to maintain.
9899#include " MCP_DAC.h"
99100```
100101
101- #### Constructor
102+ ### Constructor
102103
103104- ** MCP_DAC(SPIClassRP2040 \* mySPI = &SPI)** Constructor base class for RP2040, hardware SPI.
104105- ** MCP_DAC(SPIClass \* mySPI = &SPI)** Constructor base class other platforms, hardware SPI.
@@ -112,16 +113,20 @@ The select pin is used for device selection in case of multiple SPI devices.
112113This relates to the number of bits, see table above.
113114
114115
115- #### Gain
116+ ### Gain
116117
117- - ** bool setGain(uint8_t gain = 1)** gain is 1 (default) or 2.
118+ In ** reset()** the gain is default set to 1x as that gives the lowest output voltages.
119+ This is the safest option, although datasheet 4.1.1.1 states default = 2x.
120+
121+ - ** bool setGain(uint8_t gain = 1)** gain is 1 (default) or 2.
122+ Values of 0 or larger than 2 return false and won't change the current setting.
118123- ** uint8_t getGain()** returns gain set, default 1.
119124
120- The analog output cannot go beyond the supply voltage.
125+ Note: The analog output cannot go beyond the supply voltage.
121126So if Vref is connected to 5V, gain = 2 will not output 10 Volts.
122127
123128
124- #### Write
129+ ### Write
125130
126131- ** bool write(uint16_t value, uint8_t channel = 0)** writes value to channel.
127132Default for channel 0 as that works for the single DAC devices.
@@ -145,14 +150,14 @@ That squeezes the most performance out of it for now.
145150Code for the other MCP4xxx can be written in same way.
146151
147152
148- #### Shutdown
153+ ### Shutdown
149154
150155- ** void shutDown()** shuts down the device, optional one might need to ** triggerLatch()** .
151156- ** bool isActive()** returns false if device is in shutdown mode.
152157Note: any ** write()** operation will set active to true again.
153158
154159
155- #### Hardware SPI
160+ ### Hardware SPI
156161
157162To be used only if one needs a specific speed.
158163Check datasheet for details.
@@ -161,7 +166,7 @@ Check datasheet for details.
161166- ** uint32_t getSPIspeed()** returns SPI transfer rate.
162167
163168
164- #### LDAC
169+ ### LDAC
165170
166171- ** void setLatchPin(uint8_t latchPin)** defines the latchPin, this is optional.
167172The latchPin is used for simultaneous setting a value in both DAC registers.
@@ -172,7 +177,7 @@ Note the latchPin must be the same for all instances that need to be triggered t
172177Note: pre 0.2.0 versions have the LDAC signal incorrectly inverted.
173178
174179
175- #### Buffered
180+ ### Buffered
176181
177182** MCP49xxx series only** , see page 20 ==> not functional for MCP48xx series.
178183
@@ -181,7 +186,7 @@ The default mode == false == unbuffered.
181186- ** bool getBufferedMode()** returns set value.
182187
183188
184- #### Debug
189+ ### Debug
185190
186191- ** void reset()** resets internal variables to initial value. (use with care!).
187192- ** bool usesHWSPI()** returns true if HW SPI is used.
@@ -193,7 +198,7 @@ Several functions removed in 0.3.0 as they were too processor specific,
193198and prevented support for the ESP32-S3.
194199
195200
196- #### ESP32 connections to MCP4922 (example)
201+ ### ESP32 connections to MCP4922 (example)
197202
198203ESP32 (first series) has ** four** SPI peripherals from which two can be used.
199204
@@ -229,14 +234,14 @@ Depending on ESP32 series e.g. HSPI is different, see code snippet below.
229234
230235## RP2040 specific
231236
232- #### SPI port selection
237+ ### SPI port selection
233238
234239The SPI Port selections happens in the hardware constructor with e.g. &SPI, &SPI1 etc.
235240In pre-0.3.0 an experimental feature ** void setGPIOpins** was supported to adjust the
236241hardware pins however this should now be handled by the user outside the library.
237242
238243
239- #### Pico connections to MCP4922 (example)
244+ ### Pico connections to MCP4922 (example)
240245
241246The RP2040 has ** two** SPI peripherals from which two can be used.
242247
0 commit comments