ADC interrupt example

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

cross mob
User19313
Level 1
Level 1
5 replies posted 5 questions asked First reply posted
Hello All

Can someone provide me a reference to an example in which ADC calculation complete triggers an interrupt?
Also I was looking for an example where ADC used for more than 4 channels (e.g. 10)

Thank you.

Best regards
Shailendra
0 Likes
5 Replies
cwunder
Employee
Employee
5 likes given 50 likes received 50 solutions authored
What device are you using?
0 Likes
teoBits
Employee
Employee
5 sign-ins 100 replies posted 50 replies posted
Hello Shailendra,

you can try the CCU6_ADC example, it is triggering an interrupt at every measure to read the conversion and print it on the terminal!
here you can find the tutorial: CCU6_ADC tutorial

hope it helps,
teoBits
0 Likes
User19313
Level 1
Level 1
5 replies posted 5 questions asked First reply posted
Dear teoBits

Thank you for providing me the referene.
As I understand, the interrupt is generated upon completion of conversion.
Is there any way to generate interrupt when conversion crosses a certain threshold value?

I am getting analog value but I wanted to treat it like digital line.

Best regards
Shailendra
0 Likes
RValascho
Employee
Employee
First like received 5 questions asked First question asked
Hi Shailendra,

You can do this. In the case of a result completion, this is probably done by via a source event or a result event. But in the case of a boundary condition, you need to use a channel event. These are the 3 types of events available ISR flags in our ADC. To set this up, you need to set up a boundary condition. There are 2 global boundaries (GLOBBOUND) available, and 2 group boundaries for each group (GxBOUND) available. Configure your digital result boundary in one of these registers. Next, you need to locate the specific CHCTR register that is tied to the physical channel. You need to tell the channel which boundary conditions, from previous, to look at for upper (BNDSELU) and lower (BNDSELL) boundaries. Select upper and/or lower boundaries. Then, all ADC service requests are a two step setup. You need to enable the event first. CHCTR.CHEVMODE will enable the flag, and it is configurable as an option to your boundary condition. Now you have the boundaries and the flag, but we need to choose a generic service request to target a core service. In the CEVNP0 register, for the specific channel (all channels have 4 bit field) and specific group, you can then tie a specific service request to this boundary event. There are 4 group specific request lines, and 4 general request lines. Once you tie the channel event to a specific service request node, this now maps to a specific SRC_VADC... (register) node where you can configure the type of service (TOS), Priority (SRPN Vector entry), and enable the interrupt(SRE).
0 Likes
User19313
Level 1
Level 1
5 replies posted 5 questions asked First reply posted
Dear RValascho

Thank you for detailed answer.

Best regards
Shailendra
0 Likes