How can i use ADC in ZVMC128?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can i use ADC in ZVMC128?

723 Views
byeongjinkim
Contributor II

I set it up as below.

pastedImage_1.png

--- test code---

main.c file

pastedImage_2.png

event.c file

pastedImage_3.png

and then start debugging, breakpoint on 'AD1_OnError' ISR continuous.

but, ADC0EIF register value is zero. ("empty")

why is not operate ADC?

MCU : S12ZVMC128 (nxp evb)

codewarrior 10.7 version

i referenced help manual example as below

pastedImage_4.png

0 Kudos
3 Replies

601 Views
RadekS
NXP Employee
NXP Employee

Hi Byeongjin,

I tested configuration very similar to your on my side and ADC seems works correctly.

It looks like problem with the breakpoint location and code optimization.

I do not see any code on screenshots which will use “test” variable as input. Therefore, I suppose that compiler/linker mark this line as dead/unused code and strip it out. Therefore, the breakpoint at this unused code in reality points to different function – AD1_OnError().

Please check map file whether “test” variable is used/unused.

I would like to recommend using “asm NOP;” instruction for breakpoint since such instruction cannot be optimized out by compiler/linker.

Note: please be aware that VRH_0 is mapped to PAD8. You should use VRH_1 mapped to VDDA if you don't use external reference.

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

601 Views
byeongjinkim
Contributor II

I tested it correctly. I did not have it when I took a screenshot.

I made new project, and then operating correctly. but I could not find the cause.

thank you, have a good day

0 Kudos

601 Views
RadekS
NXP Employee
NXP Employee

Hi Byeongjin,

I am glad that it works now correctly.

Sometimes the breakpoints may behave strangely – typically when we setup breakpoint and edit code after that. I typically select Remove all breakpoints option and setup them manually again. That fix such issues in most of the cases.  

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos