Content originally posted in LPCWare by lostman on Thu Apr 23 02:20:26 MST 2015
Thank you for the suggestion.
I have scaled up the values and it is like 10777,9218,7597,5938,4261,2592,953,-633,-2141,-11919,-23128 etc.
I have 100 such numbers and I have stored it in .txt file and tried to read from there (included stdio.h) and directed to DACR register. But I am not getting any values in CRO. Can you please tell me where was I wrong. Following is my code:
#include "LPC17xx.h"
#include "type.h"
#include "dac.h"
#include "stdio.h"
int main (void)
{
FILE *myFile;
uint32_t numberArray[100];
myFile = fopen("C:/Users/Admin/Documents/LPCXpresso_6.1.4_194/workspace1/dac/test.txt", "r");
SystemInit();
DACInit();
while ( 1 )
{
for (i1 = 0; i1 < 100; i1++)
{
fscanf(myFile, "%d", &numberArray[i1]);
LPC_DAC->DACR = numberArray[i1] <<6;
}
}
}
When I try to print the values in numberArray
it prints as below:
268468160
268468164
268468168
268468172
268468176
268468180
268468184
268468188
268468192
268467796
268467800
268467804
268467808