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.

[General] using 10bits ADC result with 16bits timer result

Status
Not open for further replies.

Issak Sdu

Member level 1
Joined
Nov 7, 2014
Messages
37
Helped
4
Reputation
8
Reaction score
4
Trophy points
8
Activity points
229
Problem statement

i'm using 10bit ADC to measure the voltage on potentiometer (real angle of rotation of a DC motor, which varies from -45° to +45° or 0° to 90°).

i'm using 16bit Timer to measure the width of a square signal (desired angle of rotation of the DC motor, which varies from 1ms to 2ms like RC servos).

i want use integer calclations in order to avoid converting my results of ADC and Timer into real numbers.

Question

How can i rescale the 10bit result from ADC to its corresponding 16bit result from Timer ?
 

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,428
Helped
290
Reputation
580
Reaction score
275
Trophy points
1,363
Location
France 01800
Activity points
10,017
hello

There is no direct link between timer and adc !

timer depends of
FOSC MCU
prescaler value
and your software ...

at least you can use long integer for calculation
and scaleing all your physical measures .

your request is not so clear:
is the potentiometer used as position measure of Angle DC motor ?
if yes , why do you want the correspondance with timer ?
do you have allready some code to propose ?
 

Issak Sdu

Member level 1
Joined
Nov 7, 2014
Messages
37
Helped
4
Reputation
8
Reaction score
4
Trophy points
8
Activity points
229
your request is not so clear:
is the potentiometer used as position measure of Angle DC motor ?
if yes , why do you want the correspondance with timer ?
do you have allready some code to propose ?

Actually i'm trying to make an RC Servo controller (position regulation) by implementing different different control laws and compare with available Rc servos based on PID control.
 

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,428
Helped
290
Reputation
580
Reaction score
275
Trophy points
1,363
Location
France 01800
Activity points
10,017
hello


so, something like this

One (rotative) potentiometer to give the position target
A linear potentiometer to get the position
A DC moteur mechanical coupled to the linear potentimeter..

Algorythm control use Proportional + integral
error positioning * Gain + time loop until error near zero
Nota: power supply of DC motor controller (PMW) is a big parameter too ! act as a super-Gain.
 

Issak Sdu

Member level 1
Joined
Nov 7, 2014
Messages
37
Helped
4
Reputation
8
Reaction score
4
Trophy points
8
Activity points
229
One (rotative) potentiometer to give the position target
A linear potentiometer to get the position
A DC moteur mechanical coupled to the linear potentimeter..

you are not too far.

One potentiometer is coupled to the last gear set to give the real position
The target position is given by a square signal just like RC servos do.

And yes, i will implement PID, fuzzy logic, and other control methods
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top