ADC Simulation for HCS08 series MCU using CodeWarrior Ver6.3 Real Time Simulator HCS08 FCS ADC Module -> ADDI (Queue ADC Input Data) & ADCLR (Clear ADC input queue)

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

ADC Simulation for HCS08 series MCU using CodeWarrior Ver6.3 Real Time Simulator HCS08 FCS ADC Module -> ADDI (Queue ADC Input Data) & ADCLR (Clear ADC input queue)

865 Views
srinivasubatchu
Contributor I

I have selected MC9S08SL8 MCU in CodeWarrior development environment and created new project in FCS (Full Chip Simulation) mode. I wish to simulate the ADC peripheral using CodeWarrior Real Time Simulator in the debug mode.   

To simulate the Analog to Digital Converter ADC with CodeWarrior ver6.3, I have received message from NXP Community that using ADDI and ADCCLR, I can simulate with the "real time simulator".  I have created a new project for ADC and after compiling, with the real time simulator filled the ADDI with the assumed data for example  $0001, $0003,$0005,$0007,$0009,$0011,$0013,$0015,$0017,$0019,$0021,$0023,$0025,$0027,$0029,$0031,$0033,$0035,$0037,$0039,$0041,$0043,$0045,$0047,$0049,$0051,$0053,$0055,$0057,$0059,$0061,$0063,$0065,$0067,$0069,$0071,$0073,$0075,$0077,$0079,$0081,$0083,$0085,$0087,$0089,$0091,$0101,$0103,$0105,$0107,$0109,$0111,$0113,$0115 

Please let me know, how to map the above data using ADDI in the  "ADC - ISR i.e. Interrupt Service Routine" to 10 bit conversion  data  to ADCRH & ADCRL,  Similarly, please let me know the purpose of ADCCLR and how I can use in ADC simulation. 

In the Real-Time Simulator, when I tried to reset and start run again, I have noticed that the entered data for ADC simulation is getting lost i.e. entire entered data is lost and again I need to reenter. 

Please understand my question and request you to help me for the above points with detailed explanations. 

NXP CodeWarrior ver6.3 - User

Srinivasu Batchu

India.

e-mail:  bsv369@gmail.com  

Labels (1)
0 Kudos
1 Reply

642 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Srinivasu,

Thank you for contacting community.

Personally I don't like using simulator to simulate peripherals, I use a board for peripherals test. If I have to use simulator anyway, I avoid using interrupt but use polling instead. This can make your simulation steps less tedious.

Below is the steps that I used to simulate ADC. Just FYI.

I attached my testing demo code.

In the code I measure the ADC values via 3 channels. See below:

pastedImage_2.png 

I would list my testing procedure step by step:

  1. set ADC input data in simulator(I set 3 data in this sample):

 pastedImage_3.pngpastedImage_4.png

 

  1. when running code in first “while (!ADCSC1_COCO);” ADACT=1pastedImage_5.png
  2. Then run to first breakpoint “Xout = ADCRL;” see registers are changed as below: ADCSC1_COCO=1, ADACT=0

 pastedImage_6.png

  1. then step to ADCSC1 = 0x01; you could see ADCSC1_COCO=0 as the ADC data is read.

 

  1. go on step to “while (!ADCSC1_COCO);”, you can see ADACT=1 again.

 pastedImage_7.png

 


Have a great day,
Jennie Zhang

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

0 Kudos