Hi,
I am having an issue getting a consistent voltage from the DAC when using the
tsadclib1624 code. The board I am using is the TS-7800 with a TS-ADC16.
When I set the value of the DAC using tsadclib16_dacset() for the first time,
everything works as expected. However, if I attempt to set the value again
without restarting the program, the voltage read on the DAC output is only
sporadically the value that was set from the program. The code that I am using
is:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "tsadclib1624.h"
void adc_init(uint32_t maximumBufferSize)
{
int returnStatus;
sbctype boardModel = SBC_TS7800;
uint16_t maximumChannels = 24;
returnStatus = tsadclib1624_init(boardModel, maximumChannels,
maximumBufferSize);
if (returnStatus != 0) {
fprintf(stderr, "Board failed initialization\n");
exit(EXIT_FAILURE);
}
}
void set_dac(uint16_t dacValue)
{
int16_t whichBoard = 0;
uint16_t dacRangeValue = DACRANGE_02VU;
uint32_t dacCchannel = 0;
int rtn = tsadclib16_dacset(whichBoard, dacCchannel, dacRangeValue,
dacValue);
if (rtn)
printf("dacset failed(%d)!\n", rtn);
}
int main()
{
adc_init(10000);
while (true) {
set_dac(4095);
sleep(2);
}
return 0;
}
So the first dacset call works as expected, but subsequent calls when looping
in the while loop only sometimes work. That is, sometimes the output is 5V,
but other times it is ~0V.
I successfully used the code from the following post:
http://tech.dir.groups.yahoo.com/group/ts-7000/message/11102
(with the fix from the followup)
While the code from the post works correctly, I would really like to use the
tsadclib1624 functions and just link my program against them. Has anyone
encountered a similar issue or maybe has some insight into what could be
causing this unexpected behavior?
Thanks,
- Mark
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|