Adc and amux4 inputselect

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
        Hello I have 2 potentiometers. I want to read from both of them using 1 adcinc and the amux4 to change between port0 pin2 and port0 pin 4. It works fine with attached project, the problem occours when I add the function "styring". This should only just handle when in time it should change some PWM output signals and pulse width. It seems that suddenly it wont change the amux4 inputselect. It seems to read both information from the same input port0 pin 4 (0x02), and both my chars "ADCData_speed;" and "ADCData_stoptime; are both controlled by one potmeter. This is only the case when I run the "styring" function, I have had some problems figuring out the amux. Can anyone double check If I did set it up right? thanks in advance Best regards Simon   
0 Likes
10 Replies
Anonymous
Not applicable
        The same problem is with the amux8   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

In chip-view, parameters of AMUX4, will you please select AinMux0 as Analog_Column_Mux and test, if it is ok.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You have placed AMUX4 in column 1 which is correct for even numbered

   

pins. However when I look at P0_2 and P0_4 you do not have them defined

   

as Analog Input, right now they are shown as STDCPU.

   

 

   

Regards, Dana.

   

 

   

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Image did not post, now attached.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Some other items -

   

 

   

1) Your ADC clock, VC1,  is set for 12 Mhz, spec limit is 8 Mhz. VC1 Divisor should

   

be >= 3.

   

2) In global proerties, OpAmp bias set for low, should be high.

   

3) Name your pins in pin editor to make readability easier, especially in pinout viewer

   

4) Consider using this

   

 

   

ADCData_speed = ADCINC_bClearFlagGetData();

   

 

   

vs this

   

 

   

        ADCData_speed = ADCINC_bGetData();
        ADCINC_fClearFlag();    /* Clear ADC flag for next reading */
 

   

 

   

Regards, Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
        Thanks for all the replies, I will use em all. Very gratefull, since I don't have the time atm to study further into this. I want to though. I will test this one of the next days. Best regards Simon   
0 Likes
Anonymous
Not applicable
        Woops wrong picture I attached above. Should of been a smiley xD   
0 Likes
Anonymous
Not applicable
        Hello I did everything you have written, but it still doesn't work. As soon as I put in the while loops in the "styring" function, it kinda like reads both the values from the same input instead of switching in with the amux. Works fine without the "styring" function, works fine if the code is written in if statements. Maybe I just suck at programming 🙂 But I do believe that´s the case.   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I would suggest you to post the working and the not-working project here.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

“File”

   

“Archive Project”

   

Use Firefox or IE, not chrome to post.

   

 

   

 

   

Regards, Dana.

0 Likes