I'm trying to get the DAC output for a PIC16LF1705 chip working in a test configuration.
I have the statement setup_dac(DAC_VDD | DAC_OUTPUT) in my startup code. I am attempting to write to the DAC output with a command dac_write(dacVal), where dacVal is an unsigned 8-bit value to be written to the DAC output.
I get a compiler error stating setup_dac and dac_write are undefined identifiers. I looked in the 16LF1705.h file and saw nothing about DAC setup.
According to the chip datasheet, there should be a DAC output available on pin A0.
Has anyone gotten this chip to work with the DAC output?
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Sun Jun 19, 2016 11:12 am
Your old version doesn't support it. You will have to write your own
routines. Something like this:
// Constants used in setup_dac() are:
#define DAC_OFF 0
#define DAC_VSS_VDD 0x80
#define DAC_VREF_VDD 0x81
#define DAC_VSS_VREF 0x84
#define DAC_VREF_VREF 0x85
#define DAC_VSS_FVR 0x88
#define DAC_VREF_FVR 0x89
// The following may be OR'ed in with the above using |
#define DAC_OUTPUT2 0x10
#define DAC_OUTPUT 0x20
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum