Professional Documents
Culture Documents
***********************************************************************
******
; INTERPOLATION
;
***********************************************************************
******
;PROGRAM DESCRIPTION:
; In this program the sampling rate is increased at the input by
;including zeros. The samples are taken at the lower sampling rate and
;since this program uses the interpolation factor of 4, three zeros are
;included after each sample taken from the adc. So the number of
samples
;and thus the sampling rate is also increased.
IN 0,4
NOP
NOP
NOP
NOP
MAR *,AR1
LAR AR1,#0300H
LACC 0
AND #0FFFH
SUB #800H
SACL *
LAR AR1,#333H
MPY #0
ZAC
RPT #33H
MACD 0FF00H,*-
APAC
LAR AR1,#0300H
SACH * ;give as sach *,1 incase of overflow
LACC *
ADD #800H
SFR ;remove if o/p is less amplitude
SACL *
MAR *,AR0
BANZ NO_OUT,*-
MAR *,AR1
OUT *,4
LAR AR0,#4H
NO_OUT:
LACC #0FFH
SACL 0
OUT 0,05
NOP
B ISR
.end
>>pin sequence a=
0 1 1 1
0 0 1 1
0 0 0 1
1 0 0 0
0 1 0 0
0 0 1 0
1 0 0 1
1 1 0 0
0 1 1 0
1 0 1 1
0 1 0 1
1 0 1 0
1 1 0 1
1 1 1 0
1 1 1 1
Columns 1 through 9
14 12 8 1 2 4 9 3 6
Columns 10 through 15
13 10 5 11 7 15
output sequence
1 0 1 0 1 1
Columns 1 through 9
150 130 90 20 10 30 80 20 70
Columns 10 through 18
Columns 19 through 24
20 30 50 100 40 70
1 0 1 0 1 1
N .set 0H
STG .set 1H
STGC .set 3H
GRP .set 4H
GRPC .set 5H
BFLY .set 6H
BFLYC .set 7H
DNS .set 8H
DNSC .set 9H
.MMREGS
.TEXT
LDP #100H
CALL FFT
LAR AR0,#8030H
LAR AR1,#PERIO
LACC 0H
SUB #1H
SACL 75H
LAR AR2,75H
START ZAP
MAR *,AR0
LT *
MPY *+
PAC
BSAR 0CH
SACL 65H
LT *
MPY *+,AR1
PAC
BSAR 0CH
ADD 65H
BSAR 4
AND #0FFFH
CALL 0B400H
MAR *,AR1
SACH *+,AR2
BANZ START,*-
H B H
FFT
LDP #100H
LACC N
CALL 0B000H
LAR AR0,#BIT_REV
LAR AR5,#INPLACE
CALL 0B100H
SPLK #3H,STG
SPLK #1H,BFLY
SPLK #2H,DNS
SPLK #2H,0FH
ZAP
LT 0FH
MPY N
SPL 2H
LT 2H
MPY STG
SPL 2H
LAR AR1,#TWIDLE
MAR *,AR1
RPT 2H
BLPD #TABLE,*+
LAR AR1,#TWIDLE
LACC STG
SUB #1H
SACL STGC
LACC 00
SACL GRP
LAR AR7,STGC
BSAR 1H
SACL GRP
SUB #1H
SACL GRPC
LAR AR6,GRPC
LACC BFLY
SUB #1H
SACL BFLYC
LACC DNS
SUB #1H
SACL DNSC
LAR AR0,#INPLACE
MAR *,AR0
RPT DNSC
LACC *+
CALL 0B200H
MAR *,AR0
RPT DNSC
LACC *-
CALL 0B300H
MAR *,AR0
RPT DNSC
LACC *-
MAR *,AR2
BANZ BFLYLOP,*-
MAR *,AR0
RPT DNSC
LACC *+
MAR *,AR6
BANZ GRPLOP,*-
LT BFLY
MPY #2H
SPL BFLY
LT DNS
MPY #2H
SPL DNS
MAR *,AR7
BANZ STGLOP,*-
RET
TABLE
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 00000H
.word 0FF00H
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 00000H
.word 0FF00H
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 00100H
.word 00000H
.word 000B5H
.word 0FF4BH
.word 00100H
.word 00000H
.word 00000H
.word 0FF00H
.word 00100H
.word 00000H
.word 0FF4BH
.word 0FF4BH
.END
% DIRECT SEQUENCE SPREAD SPECTRUM:
clear;
a=pn;
d=[1 0 1 0 1 1];
ch=4;
h=1;
for i=1:6
for j=1:ch
k=ch*(i-1)+j;
if d(i)==a(1,4)
s(k)=0
else
s(k)=1
end;
h=h+1;
if h>15
h=1;
end;
end;
end;
h=1;
c1=si(-1);
c2=si(1);
len=length(c1);
for i=1:24
if s(i)==0
b1([len*(i-1)+h:i*len])=c1([1:len]);
else
b1([len*(i-1)+h:i*len])=c2([1:len]);
end;
end;
plot(b1);
title('Direct spread spectrum ');
xlabel('Time in seconds');
ylabel('Amplitude in Volts');
% AMPLITUDE MODULATION:
clc;
clear all;
close all;
am=2;
ac=4;
ka=am/ac;
fm=100;
t=0:0.01:50;
wm=(2*(3.14)*fm*t);
fc=1000;
wc=2*3.14*fc*t;
m=am*(sin(wm));
subplot(3,1,1);
plot(t,m);
title('Message Signal');
xlabel('Time in Seconds');
ylabel('Amplitude in volts');
c=ac*(sin(wc));
subplot(3,1,2);
plot(t,c);
title('Carrier Signal');
xlabel('Time in Seconds');
ylabel('Amplitude in volts');
lsb=(ka*ac/2)*(cos(wc-wm));
msb=(ka*ac/2)*(cos(wc+wm));
x=c+lsb-msb;
subplot(3,1,3);
plot(t,x);
title('Modulated Signal');
xlabel('Time in Seconds');
ylabel('Amplitude in volts');
% AMPLITUDE SHIFT KEYING:
E1=5;
E2=3;
f=3000;
t1=1:1:50;
t=100;
res1=sqrt(2*E1/t)*(cos((2*3.14*f*t1)+90));
t2=51:1:100;
res2=sqrt(2*E2/t)*(cos((2*3.14*f*t2)+90));
t=1:1:100;
result(1:50)=res1(1:50);
result(51:100)=res2(1:50);
figure(1);
plot(t,result);
title('AMPLITUDE SHIFT KEYING');
xlabel('Time in Seconds ---->');
ylabel('Amplitude in Volts---->');
grid on;
% FREQUENCY HOPPING SPREAD SPECTRUM:
clc;
clear all;
clear;
disp('pn sequence a = ');
d=[1 0 1 0 1 1];
ch=4;
s=pn;
disp(s);
for i=1:15
f(i)=0;
for j=1:4
f(i)=f(i)+s(i,j)*2^(j-1);
end;
end;
disp(f);
df=10;
k=1;
for i=1:length(d);
for j=1:ch
if d(i)==0
f0((i-1)*ch+j)=10*f(k)-df;
else
f0((i-1)*ch+j)=10*f(k)+df;
end;
k=k+1;
if k>15
k=1;
end;
end;
end;
disp('output sequence');
k=1;
for i=1:length(d)
for j=1:ch
df1(j)=f0((i-1)*ch+j)-10*f(k);
k=k+1;
if (k>15)
k=1;
end;
end;
if df1(1)>0&df1(2)>0
c(i)=1;
else
c(i)=0;
end;
end;
disp(d);
disp(f0);
disp(c);