# DMA Scale and Offset

Scale and offset are useful for converting the DMA FIFO value (DFV) to a usable value that corresponds to a real-world measurement.

The following table displays equations that show how scale and offset convert DFV to voltage value (VV) for read channels of different data types, and VV to DFV for write channels of different data types.

Data type Read or Write Equation
I8, U8, I16, U16, I32, U32, I64, U64, Boolean Read
$VV=\left[DFV×\left(\mathrm{scale}÷P\right)\text{\hspace{0.17em}}+\mathrm{offset}\right]$
I8, U8, I16, U16, I32, U32, I64, U64, Boolean Write
$DFV=\left(VV-\mathrm{offset}\right)×\left(P÷\mathrm{scale}\right)$
$VV=\left(FXPV×\mathrm{scale}\text{\hspace{0.17em}}\right)+\mathrm{offset}$
FXPI32, FXPU32,FXPI64, FXPU64 Write
$FXPV=\left(VV-\mathrm{offset}\right)÷\mathrm{scale}\text{\hspace{0.17em}}$
$VV=\left[HT÷\left(LT+HT\right)\text{\hspace{0.17em}}\right]×\left(\mathrm{scale}+\mathrm{offset}\right)$
PWM Write
$HT=\left[\left(VV-\mathrm{offset}\right)÷\mathrm{scale}\right]×PWM\mathrm{period}$
$LT=PWM\mathrm{period}-HT$

$VV$ —Represents voltage value.

$DFV$ —Represents DMA FIFO value.

$P$ —Represents the positive range of the data type.

$FXPV$ —Represents the converted fixed-point value.

$HT$ —Represents high time.

$LT$ —Represents low time.