|
Forum Index : Microcontroller and PC projects : PicoMite: MCP4922 DAC on SPI
| Author | Message | ||||
| Calli Regular Member Joined: 20/10/2021 Location: GermanyPosts: 74 |
I used this DAC before and think it is a nice chip. Here is some code which works for me and might get you started. ' MCP4922 Dual 12bit DAC SetPin GP2,GP3,GP4,SPI SetPin GP6, DOUT Pin(GP6) = 1 SPI open 4000000,0,16 Do For a% = 0 To 4096-8 Step 64 ' CS Down (LOW Active) Pin(GP6)=0 ' DACn Write Buffer Gain_ Shutdown_ ' DWBGS junk = SPI(&B0111000000000000 + a%) ' 1st DAC Pin(GP6)=1 Pin(GP6)=0 junk = SPI(&B1111000000000000 + a%) ' 2nd DAC ' CS Pin(GP6)=1 'Print a% 'Pause 300 Next a% Loop SPI CLose Datasheet: https://www.mouser.de/datasheet/2/268/21897a-70809.pdf Be sure to get the active LOW-Pins LDAC_ and SHDN_ right, LDAC_ to LOW/GND will trigger the conversion every time the CS_ is rised, so we can save one Pin on the Picomite. Tie SHDN_to VDD to have the chip work. Cheers, Carsten |
||||
| Tinine Guru Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Appreciated but can I suggest somewhere that it won't get lost? |
||||
| Calli Regular Member Joined: 20/10/2021 Location: GermanyPosts: 74 |
http://www.fruitoftheshed.com/MMBasic.PicoMite-MCP4922-DAC-on-SPI.ashx C! |
||||
| twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1769 |
Thanks Carsten! FYI something similar from Peter (matherp): Micromite MK2: MCP4822 DAC Best regards Michael BTW: Micromite MK2:MCP342x i2c ADCs ‚My name is Ozymandias, king of kings Look on my works, ye Mighty, and despair!‘ Nothing beside remains. Round the decay Of that colossal wreck, boundless and bare The lone and ... |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |