How to write coding for inbuilt potentiometer on EVSPIN32G4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-02 4:50 AM
Hi,
I have used the below-linked code. But it didn't work.
Thanks
Mathan
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-03 5:38 AM
Hello Mathan Raja,
Sorry for the misunderstanding, let me rephrase : by enabling the Potentiometer in the MC WorkBench, the generated code should allow you to control your motor with the inbuilt potentiometer without changing anything in the code, the feature is enabled by default and should work nicely. Have you tried this ?
If you can't control your motor nevertheless, could you tell me what is happening : is the motor turning or not ? Does the MotorPilot return any error ?
Hope this will help,
Gaël A.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-03 1:39 AM
Hello Mathan Raja,
Using the MCSDK v6.2.1, you can generate code for the EVSPIN32G4 that will support Potentiometer feature. You will find it in the Stage Configuration tab.
Hope this will help,
Gaël A.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-03 2:42 AM
Hi,
I have already enabled the potentiometer and generated code by using the MC workbench.
But how to control the speed by using a potentiometer? Do you have any example code?
Thanks
Mathan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-03 5:00 AM
Hello Mathan Raja,
I don't understand, if you have followed the steps, the generated code should already allow you to control speed using the inbuilt potentiometer.
If it doesn't, please tell me your way of proceeding, as well as the errors you eventually encounter.
Hope this will help,
Gaël A.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-03 5:14 AM
Hi,
I have used the below code for reading the ADC values from the potentiometer. By using this ADC value, how to control the motor speed. I tried with this API ( SPDPOT_Run(&SpeedPotentiometer_M1, potentiometer_value);) but it didn't control.
RegConv_t PotRegConv_M1 =
{
.regADC = ADC1,
.channel = MC_ADC_CHANNEL_9,
.samplingTime = POTENTIOMETER_ADC_SAMPLING_TIME_M1,
};
while(1){
RCM_RegisterRegConv (&PotRegConv_M1);
if (RCM_GetUserConvState() == RCM_USERCONV_IDLE)
{
/* if Idle, then program a new conversion request */
RCM_RequestUserConv(&PotRegConv_M1 );
}
else if (RCM_GetUserConvState() == RCM_USERCONV_EOC)
{
/* if Done, then read the captured value */
potentiometer_value = RCM_GetUserConv();
// SPDPOT_Run(&SpeedPotentiometer_M1, potentiometer_value);
}}
In the MC workbench, I enabled the potentiometer (ADC1_IN9) and generated the code. Then I added above code for reading the ADC values
Thanks
Mathan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-03 5:38 AM
Hello Mathan Raja,
Sorry for the misunderstanding, let me rephrase : by enabling the Potentiometer in the MC WorkBench, the generated code should allow you to control your motor with the inbuilt potentiometer without changing anything in the code, the feature is enabled by default and should work nicely. Have you tried this ?
If you can't control your motor nevertheless, could you tell me what is happening : is the motor turning or not ? Does the MotorPilot return any error ?
Hope this will help,
Gaël A.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-20 10:53 PM
By enabling potentiometer in MCSDK, i am able to do speed control from Pilot by varying the potentiometer.
Is it possible to do position control too? I tried but the shaft doesn't move. Should i do anything to the code?
