2012-07-03 15:43:26 -04:00
|
|
|
subroutine genjtms3(msg,msgsent,iwave,nwave)
|
|
|
|
|
|
|
|
character*22 msg,msgsent
|
|
|
|
integer*1 chansym(258)
|
|
|
|
integer*2 iwave(30*48000)
|
|
|
|
integer dgen(13)
|
|
|
|
integer*1 data0(13)
|
|
|
|
integer*1 datsym(215)
|
2012-07-05 12:16:03 -04:00
|
|
|
real*8 pi,twopi,f0,dt,phi,dphi
|
|
|
|
real*4 p(-3095:3096)
|
|
|
|
real*4 s(6192)
|
|
|
|
real*4 carrier(6192)
|
|
|
|
logical first
|
2012-07-10 09:43:16 -04:00
|
|
|
integer*1 isync(43)
|
2012-07-05 12:16:03 -04:00
|
|
|
integer indx0(9) !Indices of duplicated symbols
|
2012-07-03 15:43:26 -04:00
|
|
|
data indx0 /16,38,60,82,104,126,148,170,192/
|
2012-07-05 12:16:03 -04:00
|
|
|
data first/.true./
|
2012-07-10 09:43:16 -04:00
|
|
|
data isync/0,1,0,0,1,0,1,0,0,1,1,1,0,1,1,1,1,1,0,0, &
|
|
|
|
0,1,0,1,1,1,0,0,0,0,0,1,0,0,0,1,1,0,1,0, &
|
|
|
|
1,1,0/ !Hadamard-43 sync code
|
2012-07-05 12:16:03 -04:00
|
|
|
save
|
2012-07-10 09:43:16 -04:00
|
|
|
|
2012-07-05 12:16:03 -04:00
|
|
|
sinc(x)=sin(pi*x)/(pi*x)
|
|
|
|
|
|
|
|
if(first) then
|
|
|
|
pi=4.d0*atan(1.d0)
|
|
|
|
twopi=2.d0*pi
|
|
|
|
k=0
|
|
|
|
x=0.
|
|
|
|
dx=1.0/24.0
|
|
|
|
do i=1,3096 !Generate the BPSK pulse shape
|
|
|
|
k=k+1
|
|
|
|
if(k.gt.3096) k=k-6192
|
|
|
|
x=x+dx
|
|
|
|
p(k)=sinc(x) * (sinc(x/2.0))**2
|
|
|
|
if(k.ne.3096) p(-k)=p(k)
|
|
|
|
enddo
|
|
|
|
p(0)=1.0
|
|
|
|
|
|
|
|
f0=193.d0*48000.d0/(258.d0*24.d0)
|
|
|
|
dt=1.d0/48000.d0
|
|
|
|
dphi=twopi*f0*dt
|
|
|
|
phi=0.d0
|
|
|
|
nmax=0.
|
|
|
|
do i=1,6192 !Generate the carrier
|
|
|
|
phi=phi+dphi
|
|
|
|
if(phi.gt.twopi)phi=phi-twopi
|
|
|
|
xphi=phi
|
|
|
|
carrier(i)=sin(xphi)
|
|
|
|
enddo
|
|
|
|
endif
|
2012-07-03 15:43:26 -04:00
|
|
|
|
|
|
|
call packmsg(msg,dgen) !Pack message into 12 six-bit symbols
|
|
|
|
call entail(dgen,data0) !Move from 6-bit to 8-bit symbols, add tail
|
|
|
|
ndat=(72+31)*2
|
|
|
|
call encode232(data0,ndat,datsym) !Convolutional encoding
|
|
|
|
|
|
|
|
do i=1,9 !Duplicate 9 symbols at end of datsym
|
|
|
|
datsym(206+i)=datsym(indx0(i))
|
|
|
|
enddo
|
|
|
|
|
|
|
|
call scr258(isync,datsym,1,chansym) !Insert sync and data into chansym(258)
|
2012-07-04 13:48:57 -04:00
|
|
|
|
2012-07-04 17:30:56 -04:00
|
|
|
if(msg(1:1).eq.'@') chansym=0
|
2012-07-05 12:16:03 -04:00
|
|
|
|
|
|
|
s=0.
|
2012-07-04 13:48:57 -04:00
|
|
|
do j=1,258
|
2012-07-05 12:16:03 -04:00
|
|
|
k1=-3096-24*j
|
|
|
|
if(chansym(j).eq.1) s=s + cshift(p,k1)
|
|
|
|
if(chansym(j).eq.0) s=s - cshift(p,k1)
|
|
|
|
enddo
|
|
|
|
|
|
|
|
nmax=0
|
|
|
|
do i=1,6192
|
|
|
|
n=30000.0*carrier(i)*s(i)
|
|
|
|
nmax=max(nmax,abs(n))
|
|
|
|
if(n.gt.32767) n=32767
|
|
|
|
if(n.lt.-32767) n=-32767
|
|
|
|
iwave(i)=n
|
2012-07-04 13:48:57 -04:00
|
|
|
enddo
|
|
|
|
|
2012-07-10 09:43:16 -04:00
|
|
|
nblk=30*48000/6192
|
|
|
|
do n=2,nblk
|
|
|
|
ib=n*6192
|
|
|
|
ia=ib-6191
|
|
|
|
iwave(ia:ib)=iwave(1:6192)
|
|
|
|
enddo
|
|
|
|
|
|
|
|
nwave=ib
|
2012-07-03 15:43:26 -04:00
|
|
|
msgsent=msg
|
|
|
|
|
|
|
|
return
|
|
|
|
end subroutine genjtms3
|