Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Variable conversion uint16_t to int

Status
Not open for further replies.

eebhoi01

Advanced Member level 4
Joined
Feb 22, 2012
Messages
116
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
2,347
Hello,

I wish to convert my ADC data (uint16_t, 10bit data) to "int" so I can perform mathematical operations. Basically my goal is to make my version of "map" function in Arduino IDE, ex. int Value = map(ADC, 0, 1024, 0, 255);

So how can I convert uint16_t to int? Thank you in advance.
 

uint is converted to int automatically when making an assignment. This is a feature of the C language. Sized data types used in some libraries like uint16_t are just aliases of the generic C data types and should also undergo automatic conversion.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top