- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to test a very simple code, insamp (with two PGA and one ADC). When I run the code, it stop in the line:
if (ADCINC_1_fIsDataAvailable() != 0);
Below is the code, can anyone tell me what wrongs, thankks a lot in advance!
#include <m8c.h> // part specific constants and macros
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
#include "PSoCGPioInt.h"
int iResult;
void main(void)
{
PGA_1_Start(PGA_1_HIGHPOWER);
PGA_2_Start(PGA_1_HIGHPOWER);
ADCINC_1_Start(ADCINC_1_HIGHPOWER); /* Turn on ADC power */
ADCINC_1_GetSamples(0); /* Sample forever */
while(1) {
if (ADCINC_1_fIsDataAvailable() != 0) /* If ADC sample is ready... */
{
iResult = ADCINC_1_iGetData() + 2048; /* Get result, convert to unsigned and clear flag */
ADCINC_1_fClearFlag();
}
}
}
The general system setup as below:
VC1=sys/3
VC2=VC1/8
VC3=sys/1
Analog Power: SC on/RefH
RefMax:Vdd/2+/-BandGap
OpAmp bias Low
A-buff_power low
Switch Mode Pump OFF
Trip Voltage LVD4.81V
Including is my project codes.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi JimL,
Can you please repost the question in PSoC1 topics of the forum?
In this space, PSoC5 topics are discussed.
Regards,
dasg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
JimL,
You need to enable Global Interrupts for the ADC to work. Add the code "M8C_EnableGInt;" in main. See if this fixes the problem. Also, check out my blog post PSoC1 ADCs - The Five Golden Rules that talks about best practices to get the ADC working without any problem.
Best Regards,
Ganesh