Hi.
I am a little bit confusing with this.
I am using processor expert to configure the ADC and it came up with
PORTB_PCR0 &= (uint32_t)~(uint32_t)((PORT_PCR_ISF_MASK | PORT_PCR_MUX(0x07)));
why the mux is 07? i have read the manual and the adc would be ALT(0). is this 07 right?
thanks in advance.
已解决! 转到解答。
Hello Edriano:
Yes, the option for ADC in PTB0 is 0x0. Actually the 0x07 is just a mask for the AND operation ( &= ~(...)). So the written value to PORTB_PCR0[MUX] is 000.
Regards!,
Jorge Gonzalez
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi thanks.
Ok they like to complicate things. know i see they are doing an & and then inverting everything in order to fit.
why can't they just write thinks like we can follow the manual.
Hello Edriano:
Yes, the option for ADC in PTB0 is 0x0. Actually the 0x07 is just a mask for the AND operation ( &= ~(...)). So the written value to PORTB_PCR0[MUX] is 000.
Regards!,
Jorge Gonzalez
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi,
What Jorge is saying is just right. Sometimes the code generated by Processor Expert is not easy to understand and you may think that there is a lot of code for a simple PORTB_PCR0 = 0x00; or nothing because this Pin is by default in its Analog alternative.
Regards,
Adrian