Hi,
I use mikroC PRO for ARM, STM32F3 DISCOVERY.
I can use ADC1, 2, 3 but can't use ADC4.
The ADC.h file does not include the ADC4.
Could you help me for this?
Thank you very much.
mikroC PRO for ARM, STM32F3 DISCOVERY, no ADC4 in ADC.h file
-
- Posts: 7
- Joined: 18 Aug 2016 15:34
- lana.arsic
- mikroElektronika team
- Posts: 1715
- Joined: 15 Jan 2016 12:50
Re: mikroC PRO for ARM, STM32F3 DISCOVERY, no ADC4 in ADC.h
Hi ratchapolp,
Welcome to the MikroE forum.
Can you please explain on which file you are referring to?
ADC4 for STM32F303VC is supported in our compiler,
you can try to use it with ADC Library (which you can select in Library Manager).
Best regards,
Lana
Welcome to the MikroE forum.
Can you please explain on which file you are referring to?
ADC4 for STM32F303VC is supported in our compiler,
you can try to use it with ADC Library (which you can select in Library Manager).
Best regards,
Lana
-
- Posts: 7
- Joined: 18 Aug 2016 15:34
Re: mikroC PRO for ARM, STM32F3 DISCOVERY, no ADC4 in ADC.h
The code is below, it can reading the voltage when use ADC1, ADC2 and ADC3. When I used ADC4 (ADC4_init();), the program hang up, no respond.
unsigned int adc_avg(unsigned char no_of_samples, unsigned char ADCx, unsigned char Channelx)
{
unsigned long avg = 0;
unsigned char samples = no_of_samples;
if (ADCx == 1)
{
ADC1_init(); // It is OK.
while(samples > 0)
{
avg += ADC1_Get_Sample(Channelx);
samples--;
}
}
else if (ADCx == 2)
{
ADC2_init(); // It is OK.
while(samples > 0)
{
avg += ADC2_Get_Sample(Channelx);
samples--;
}
}
else if (ADCx == 3)
{
ADC3_init(); // It is OK.
while(samples > 0)
{
avg += ADC3_Get_Sample(Channelx);
samples--;
}
}
else if (ADCx == 4)
{
ADC4_init(); //When I used ADC4, the program hang up, no respond.
while(samples > 0)
{
avg += ADC4_Get_Sample(Channelx);
samples--;
}
}
avg /= no_of_samples;
return avg;
}
unsigned int adc_avg(unsigned char no_of_samples, unsigned char ADCx, unsigned char Channelx)
{
unsigned long avg = 0;
unsigned char samples = no_of_samples;
if (ADCx == 1)
{
ADC1_init(); // It is OK.
while(samples > 0)
{
avg += ADC1_Get_Sample(Channelx);
samples--;
}
}
else if (ADCx == 2)
{
ADC2_init(); // It is OK.
while(samples > 0)
{
avg += ADC2_Get_Sample(Channelx);
samples--;
}
}
else if (ADCx == 3)
{
ADC3_init(); // It is OK.
while(samples > 0)
{
avg += ADC3_Get_Sample(Channelx);
samples--;
}
}
else if (ADCx == 4)
{
ADC4_init(); //When I used ADC4, the program hang up, no respond.
while(samples > 0)
{
avg += ADC4_Get_Sample(Channelx);
samples--;
}
}
avg /= no_of_samples;
return avg;
}
-
- Posts: 7
- Joined: 18 Aug 2016 15:34
Re: mikroC PRO for ARM, STM32F3 DISCOVERY, no ADC4 in ADC.h
Hi
I forgot attached a ADC.h file.
I downloaded from http://libstock.mikroe.com/projects/vie ... c-examples.
Thank you
I forgot attached a ADC.h file.
I downloaded from http://libstock.mikroe.com/projects/vie ... c-examples.
Thank you
-
- Posts: 7
- Joined: 18 Aug 2016 15:34
Re: mikroC PRO for ARM, STM32F3 DISCOVERY, no ADC4 in ADC.h
Hi
I found the problem in .lst file at
___GenExcept:
;__Lib_System_3XX.c, 310 ::
0x2CA0 0xB081 SUB SP, SP, #4
;__Lib_System_3XX.c, 311 ::
L___GenExcept27:
0x2CA2 0xE7FE B L___GenExcept27
It will loop at 0x2CA2
Could you suggest for me?
I found the problem in .lst file at
___GenExcept:
;__Lib_System_3XX.c, 310 ::
0x2CA0 0xB081 SUB SP, SP, #4
;__Lib_System_3XX.c, 311 ::
L___GenExcept27:
0x2CA2 0xE7FE B L___GenExcept27
It will loop at 0x2CA2
Could you suggest for me?
- lana.arsic
- mikroElektronika team
- Posts: 1715
- Joined: 15 Jan 2016 12:50
Re: mikroC PRO for ARM, STM32F3 DISCOVERY, no ADC4 in ADC.h
Hi,
I have tested ADC4 on EasyMx PRO v7 for STM32 board
with STM32F303VC and it works properly.
As regards problem with debugger, you can try to change your code,
and as regards ADC.h file, please contact author of that example.
Best regards,
Lana
I have tested ADC4 on EasyMx PRO v7 for STM32 board
with STM32F303VC and it works properly.
As regards problem with debugger, you can try to change your code,
and as regards ADC.h file, please contact author of that example.
Best regards,
Lana
-
- Posts: 7
- Joined: 18 Aug 2016 15:34
Re: mikroC PRO for ARM, STM32F3 DISCOVERY, no ADC4 in ADC.h
Hi Lana,
Could you share your code for me?
Thank you very much.
Could you share your code for me?
Thank you very much.
- lana.arsic
- mikroElektronika team
- Posts: 1715
- Joined: 15 Jan 2016 12:50
Re: mikroC PRO for ARM, STM32F3 DISCOVERY, no ADC4 in ADC.h
Hi ratchapolp,
I'm sorry, I have already used corrected library.
I'm sending you in attachment that library which you need to replace with
__Lib_ADC_1234_30X.emcl in Uses folder which is located in e.g.
C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Uses\ST M4.
Also, I'm sending you in attachment example for ADC4.
Best regards,
Lana
I'm sorry, I have already used corrected library.
I'm sending you in attachment that library which you need to replace with
__Lib_ADC_1234_30X.emcl in Uses folder which is located in e.g.
C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Uses\ST M4.
Also, I'm sending you in attachment example for ADC4.
Best regards,
Lana
- Attachments
-
- ADC Demo.zip
- (11.51 KiB) Downloaded 132 times
-
- __Lib_ADC_1234_30X.zip
- (5.86 KiB) Downloaded 129 times
-
- Posts: 7
- Joined: 18 Aug 2016 15:34
Re: mikroC PRO for ARM, STM32F3 DISCOVERY, no ADC4 in ADC.h
Hi Lana,
Thank you very much for your help.
It works.
I can read ADC1, ADC2, ADC3 and ADC4.
Thank you.
Thank you very much for your help.
It works.
I can read ADC1, ADC2, ADC3 and ADC4.
Thank you.
- lana.arsic
- mikroElektronika team
- Posts: 1715
- Joined: 15 Jan 2016 12:50
Re: mikroC PRO for ARM, STM32F3 DISCOVERY, no ADC4 in ADC.h
Hi ratchapolp,
You're welcome, I'm glad it was helpful.
Best regards,
Lana
You're welcome, I'm glad it was helpful.
Best regards,
Lana
Re: mikroC PRO for ARM, STM32F3 DISCOVERY, no ADC4 in ADC.h file
Hi, I'm new in programming microcontrollers. I used Mikroc Pro For ARM to make my code of ADC with STM32L152RBT6.
The program started correctly but when it reaches the line of reading the value from the adc channel it complains. Please help me. Is there a necessary configuration !!
thanks in advance
The program started correctly but when it reaches the line of reading the value from the adc channel it complains. Please help me. Is there a necessary configuration !!
thanks in advance
Re: mikroC PRO for ARM, STM32F3 DISCOVERY, no ADC4 in ADC.h file
Hi,
Can you please explain your issue in details ?
Regards,
Filip.
Can you please explain your issue in details ?
Regards,
Filip.