2552 views|4 replies

2624

Posts

6

Resources
The OP
 

RT052 (6) ADC [Copy link]

The first thing to do is of course to add the header file!

//Step 1: Add adc header file

#include "fsl_adc.h"

// Step 2: Add adc's return value for printing

volatile uint16_t ADC_Value;

Under the construction of the ADC initialization function

// Step 2: Create a new ADC initialization function

void RT1052_ADC_Init(void)

{

adc_config_t adcConfigStruct;

adc_channel_config_t adcChannelConfigStruct;

/*

* config->enableAsynchronousClockOutput = true;

* config->enableOverWrite = false;

* config->enableContinuousConversion = false;

* config->enableHighSpeed = false;

* config->enableLowPower = false;

* config->enableLongSample = false;

* config->referenceVoltageSource = kADC_ReferenceVoltageSourceVref;

* config->samplePeriodMode = kADC_SamplePeriod2or12Clocks;

* config->clockSource = kADC_ClockSourceAD;

* config->clockDriver = kADC_ClockDriver1;

* config->resolution = kADC_Resolution12Bit;

*/

ADC_GetDefaultConfig(&adcConfigStruct);

//Maximum resolution 12bit only external reference

//adcConfigStruct.referenceVoltageSource=kADC_ReferenceVoltageSourceAlt0;

//Start continuous conversion mode

adcConfigStruct.enableContinuousConversion=true;

ADC_Init(ADC1, &adcConfigStruct);

// Enable ADC interrupt

EnableIRQ(ADC1_IRQn);

// Enable ADC1 automatic calibration

ADC_DoAutoCalibration(ADC1);

//Disable hardware trigger

ADC_EnableHardwareTrigger(ADC1, false);

//Read channel 0

adcChannelConfigStruct.channelNumber = 0;

adcChannelConfigStruct.enableInterruptOnConversionCompleted = true;

// Channe_group 0 is used for software or hardware triggering

ADC_SetChannelConfig(ADC1, 0u /*ADC_CHANNEL_GROUP*/, &adcChannelConfigStruct);

}

It is relatively simple to enable the ADC interrupt here. Just use EnableIRQ(ADC1_IRQn);. There is this section in the official SDK of RT1052, but where can I find the name type of IRQn?

You can find it by searching for specific interrupt in MIMXRT1052.h. It should be noted that there is no description of ADC interrupt in SDK API Reference.

SDK_2_12_1_MIMXRT1052xxxxB\boards\evkbimxrt1050\driver_examples

Go to see his source code.

The ADC of RT1052 has automatic gain calibration.

Just use auto calibration before performing the conversion.

It also has an offset calibration function. The idea is that the KB value can be directly calibrated using this function.

A hardware comparator is integrated internally, and the 12-bit accuracy of the comparator is suitable for most occasions.

Anyway, it’s very good!

This post is from NXP MCU

Latest reply

I also like the standard library, which is more flexible. Otherwise, it takes too much time to find it.   Details Published on 2022-12-9 13:34
Personal signature

希望做一些大家觉得好用的东西!

 

115

Posts

0

Resources
2
 

It seems that most chip companies' libraries are still standard libraries.

This post is from NXP MCU

Comments

Standardization can speed up development  Details Published on 2022-12-7 14:06
 
 
 

2624

Posts

6

Resources
3
 
hustjtj0806 posted on 2022-12-7 12:03 It seems that the libraries of most chip companies are still the specifications of the standard library

Standardization can speed up development

This post is from NXP MCU
 
Personal signature

希望做一些大家觉得好用的东西!

 
 

6027

Posts

6

Resources
4
 

I also like the standard library, which is more flexible. Otherwise, it takes too much time to find it.

This post is from NXP MCU

Comments

Yes, it's too troublesome to find it.  Details Published on 2022-12-9 13:47
 
Personal signature

在爱好的道路上不断前进,在生活的迷雾中播撒光引

 
 

2624

Posts

6

Resources
5
 
Qintianqintian0303 posted on 2022-12-9 13:34 I also like the standard library, which is more flexible. Otherwise, it will take too much time to find it

Yes, it's too troublesome to find it.

This post is from NXP MCU
 
Personal signature

希望做一些大家觉得好用的东西!

 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Featured Posts
【TI mmWave Radar Review】+3D Profile Test

We have read the official configuration file before. Now we will modify and test it according to our needs. First, copy ...

[Raspberry Pi Pico Review]——by fxyc87

@fxyc87 - Unboxing + Download - Start Programming - Start compiling the program 2 - How to save the written progra ...

[Hua Diao DIY] Fast food box cover, a very low-cost experimental platform for building robot walking

This post was last edited by eagler8 on 2021-2-7 17:50 After eating the fast food porridge, in addition to the delicio ...

[Silicon Labs BG22-EK4108A Bluetooth Development Review] Unboxing

Unboxing On January 2 , 2022, I received the development board BG22-EK4108A from Silicon Labs and Arrow Electronics . ...

Portable LED Light Retrofit

592276 This is actually the lamp head of a foldable LED desk lamp. One day, I accidentally dropped the desk lamp on the ...

May 26th Xinye & ON Semiconductor live broadcast review: ON Semiconductor image sensors help the automotive, machine vision and artificial intelligence fields...

Live broadcast time: May 26, 10:00-11:30 Live broadcast topic: ON Semiconductor image sensors, promoting the developmen ...

Embedded Qt-Simple Network Surveillance Camera

This article uses Qt to implement a network camera function, which includes a server and a client. The server is used ...

Is it possible to perform socket communication without IP and port number?

When using socket communication, whether it is internal communication within the local machine or communication betwee ...

What are the functions of the two NMOS in the charging chip?

What are the functions of the two NMOS in the charging chip? 729752

What is the reason why the neutral point of a TN system with multiple power supplies is not directly grounded at the power supply end?

For systems with multiple TN power supplies, why is the neutral point of the power supply not directly grounded at the p ...

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list