summaryrefslogtreecommitdiff
path: root/2582/CH6/EX6.4/Ex6_4.sce
blob: b7aa3c0f847d4af626b3c8e831e0c204beee81e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//Ex 6.4
clc;clear;close;
format('v',5);
Range=0:10;//range
//(i)2-bit DAC
n=2;//no. of bits
step=max(Range)/2^n;//V
reading='10';//input in binary
Vo=step*bin2dec(reading);//V
disp(Vo,"(i) Output Voltage(V)");
//(ii)4-bit DAC
n=4;//no. of bits
step=max(Range)/2^n;//V
reading='0110';//input in binary
Vo=step*bin2dec(reading);//V
disp(Vo,"(ii) Output Voltage(V)");
//(i)8-bit DAC
n=8;//no. of bits
step=max(Range)/2^n;//V
reading='10111100';//input in binary
Vo=step*bin2dec(reading);//V
disp(Vo,"(iii) Output Voltage(V)");