We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
First, I thank keil.com for this forum...
I am using C515C, and I connected it to an LCD.
When I convert an analog signal coming from P6.1 to 8 bit, the output is right.
But when I convert the signal to 10 bit resolution, at the program execution reaches the conversion function it goes back to the start of the program...!! I feel that the problem is in using the "unsigned int " for the 10 bit.. Could you help me please...
----------------------------------------------- The program (8 bit conversion) -working fine-
unsigned char kk; . . void main() { . . ADC_vStart(0,1); kk = ADC_ubRead8BitConv(); . . }
---------------------------------------------- The program (10 bit conversion) -NOT Working-
unsigned int kk; . . void main() { . . ADC_vStart(0,1); kk = ADC_ubRead10BitConv(); . . } ---------------------------
Have you single-stepped the ADC_ubRead10BitConv() function?
Have you set up a stack? Is it large enough?
Thank you for the reply,,
I think these libraries are ok, because these libraries are made by the support tools from DAvE which are tools that prepare for me all the needed to start programming, like building the ADC functions, timers, levels of priorities...etc.
But the strange thing is that the program execution goes back to the start when it reaches the conversion code!!!
Are you sure that you correctly reconfigured everything to support 10-bit data?
Maybe you left something at 8 bits, and it's crashing because you're feeding it 10 (or 16) bits...
As Per suggested, single-stepping would show you what's going on...
ok,, this is the function...
#define uword unsigned int
uword ADC_uwRead10BitConv(void) { uword tmp = 0;
tmp = ADDATH;
tmp <<= 8;
tmp |= ADDATL;
tmp >>= 6;
return(tmp);
}
and..
sfr ADDATH = 0xD9;
Thanks..
It is working now,, you were right..
It always helps other people who find this thread at a later time, if you can expand a bit more about what was wrong, and how you managed to solve the problem.