- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Trying to read ADC values, utilizing the debug function. But it seems , that I cannot use the add watch button, to read the value from the variable.
I am using PSoC 5LP CY8C5888LT*LP097.
The Code:
include "project.h"
int main(void)
{
// CyGlobalIntEnable; /* Enable global interrupts. */
IDAC8_1_Start();
IDAC8_1_SetPolarity(IDAC8_1_SINK);
ADC_DelSig_1_Start();
ADC_DelSig_1_StartConvert();
int8 output;
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
for(;;)
{
if(ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_RETURN_STATUS))
{
output = ADC_DelSig_1_GetResult8();
}
//IDAC8_1_SetValue(75);
/* Place your application code here. */
}
}
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to just declare the variable above the main()
Eg:
int8 output;
main()
{
Your application
}
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tamas,
Declare the variable 'output' as a global variable.
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bragadeesh,
How should I do that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to just declare the variable above the main()
Eg:
int8 output;
main()
{
Your application
}
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi again,
I can now add the watchpoint. But unfortunately it does not show the correct input values - from the voltage supply. From the watch point I get a value of -37, the reference supply from the psoc is 4.7V.
Below ADC configuration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tamas,
If you are not expecting any signed numbers for the variable (negative values), declare it as unsigned integer.
Eg: uint8 output
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bragadeesh,
Better results now. Though, at 1V i am getting a value of 214 ((4.7V/1023)*214 = 0.98V) and at 4V I am getting 96 ((4.7V/1023)*96 = 0.45V). I have no idea why - is because i am using ADC_DelSig_1_GetResult32() at a 10 bit ADC?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found the mistake, I was using uint8.