Software issue with DAC MCP4921

General discussion on mikroBasic PRO for ARM.
Post Reply
Author
Message
alex20
Posts: 4
Joined: 12 Aug 2014 15:42

Software issue with DAC MCP4921

#1 Post by alex20 » 12 Aug 2014 15:55

Hello everyone.

I am using a PIC16F886 with a DAC MCP4921 SPI. I work in assembly language.
I cannot get the DAC to give voltage on its output pin. I have correctly assigned all other pins : the clock, the data in (for MCP, which is data OUT for PIC), the CS/SS, the ground, the power, and the refference.
Using an oscilloscope I succesfully managed to view all the signals on the DAC's pins. The problem is that I have absolutely nothing (no voltage) on the output pin.
As an algorithm for the DAC subroutine, I did this :

-configured all registers (sspcon)
-give a word (8 bytes) to the SSPBUF (buffer register)
-check if buffer full (if not, check again)
-give another word (8 bytes)
-check if buffer full (if not, check again)

I have also tried to load a dummy word (0x00 or 0xff) before loading the actual data to SSPBUF but with no result.

Can anyone give me some advice? Has anyone got a subroutine for DAC communication?

Thank you in advance,
alex

User avatar
petar.timotijevic
mikroElektronika team
Posts: 1739
Joined: 19 Feb 2014 13:46
Location: Serbia
Contact:

Re: Software issue with DAC MCP4921

#2 Post by petar.timotijevic » 13 Aug 2014 15:50

Hi,

Please see

DAC click - Example - Board features 12-bit Digital-to-Analog Converter MCP4921 that features SPI interface and an optional double buffered output
http://www.libstock.com/projects/view/2 ... ck-example


Best regards,
Peter

Post Reply

Return to “mikroBasic PRO for ARM General”