diff --git a/libm65/decodemsk.f90 b/libm65/decodemsk.f90 index 52b7b5cf7..9a08edd82 100644 --- a/libm65/decodemsk.f90 +++ b/libm65/decodemsk.f90 @@ -18,7 +18,7 @@ subroutine decodemsk(cdat,npts,cw,i1,nchar,s2,msg) smax=0. do k=0,40 kk=k - if(k.eq.40) kk=57 + if(k.eq.40) kk=44 z=0. do i=1,168 z=z + cdat(ia+i)*conjg(cw(i,kk)) @@ -32,7 +32,7 @@ subroutine decodemsk(cdat,npts,cw,i1,nchar,s2,msg) endif enddo msg(j:j)=cc(kpk+1:kpk+1) - if(kpk.eq.57) msg(j:j)=' ' + if(kpk.eq.44) msg(j:j)=' ' enddo return diff --git a/libm65/genmsk.f90 b/libm65/genmsk.f90 index dac86e81e..a1e8e12ae 100644 --- a/libm65/genmsk.f90 +++ b/libm65/genmsk.f90 @@ -13,9 +13,9 @@ subroutine genmsk(msg28,iwave,nwave) real*8 dt,phi,f,f0,dfgen,dphi,twopi,foffset,samfac integer np(9) data np/5,7,9,11,13,17,19,23,29/ !Permissible message lengths -! 1 2 3 4 5 6 +! 1 2 3 4 5 6 ! 0123456789012345678901234567890123456789012345678901234567890123 - data cc/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ./?- _ @'/ + data cc/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ./?- _ @'/ !### samfac=1.d0 @@ -35,12 +35,14 @@ subroutine genmsk(msg28,iwave,nwave) i=8 2 msglen=np(i) -! Convert message to a bit sequence, 7 bits per character (6 + even parity) +! Convert message to a bit sequence, 7 bits per character (6 + odd parity) +! Use odd parity because then code 44 (from a 0-63 range) is the 7-bit +! Barker code. 3 sent=0 k=0 do j=1,msglen if(msg(j:j).eq.' ') then - i=58 + i=1 + 44 go to 5 else do i=1,64 @@ -54,7 +56,7 @@ subroutine genmsk(msg28,iwave,nwave) m=m+sent(k) enddo k=k+1 - sent(k)=iand(m,1) !Insert parity bit + sent(k) = 1 - iand(m,1) !Insert odd parity bit enddo nsym=k diff --git a/libm65/setupmsk.f90 b/libm65/setupmsk.f90 index 092743dc2..c61d2d92a 100644 --- a/libm65/setupmsk.f90 +++ b/libm65/setupmsk.f90 @@ -7,9 +7,9 @@ subroutine setupmsk(cw,cwb) integer nb(7) ! real*8 twopi,dt,f0,f1 character cc*64 -! 1 2 3 4 5 6 +! 1 2 3 4 5 6 ! 0123456789012345678901234567890123456789012345678901234567890123 - data cc/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ./?- _ @'/ + data cc/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ./?- _ @'/ nsps=24 twopi=8.d0*atan(1.d0) @@ -28,7 +28,7 @@ subroutine setupmsk(cw,cwb) m=m+nb(k) enddo k=k+1 - nb(k)=iand(m,1) !Insert parity bit + nb(k) = 1 - iand(m,1) !Insert odd parity bit phi=0. j=0 @@ -45,7 +45,7 @@ subroutine setupmsk(cw,cwb) enddo enddo enddo - cwb=cw(1:168,57) + cwb=cw(1:168,44) return end subroutine setupmsk