Convert ft8code to 77bit messages.

This commit is contained in:
Steve Franke 2018-10-19 16:36:32 -05:00
parent 6d25c45d9f
commit fffa692ac5
2 changed files with 94 additions and 225 deletions

View File

@ -1,145 +1,51 @@
parameter (MAXTEST=75,NTEST=68) parameter (MAXTEST=75,NTEST=48)
character*40 testmsg(MAXTEST) character*37 testmsg(MAXTEST)
character*40 testmsgchk(MAXTEST) data testmsg(1:NTEST)/ &
! Test msgs should include the extremes for the different types "CQ K1ABC FN42", &
! See pfx.f90 "K1ABC W9XYZ EN37", &
! Type 1 P & A "W9XYZ K1ABC -11", &
! Type 1 1A & E5 "K1ABC W9XYZ R-09", &
data testmsg(1:NTEST)/ & "W9XYZ K1ABC RRR", &
"CQ WB9XYZ EN34", & "K1ABC W9XYZ 73", &
"CQ DX WB9XYZ EN34", & "K1ABC W9XYZ RR73", &
"QRZ WB9XYZ EN34", & "CQ KH1/KH7Z", &
"KA1ABC WB9XYZ EN34", & "K1ABC RR73; W9XYZ <KH1/KH7Z> -08", &
"KA1ABC WB9XYZ RO", & "CQ FD K1ABC FN42", &
"KA1ABC WB9XYZ -21", & "K1ABC W9XYZ 6A WI", &
"KA1ABC WB9XYZ R-19", & "W9XYZ K1ABC R 2B EMA", &
"KA1ABC WB9XYZ RRR", & "CQ TEST K1ABC/R FN42", &
"KA1ABC WB9XYZ 73", & "K1ABC/R W9XYZ EN37", &
"KA1ABC WB9XYZ", & "W9XYZ K1ABC/R R FN42", &
"CQ 000 WB9XYZ EN34", & "K1ABC/R W9XYZ RR73", &
"CQ 999 WB9XYZ EN34", & "CQ TEST K1ABC FN42", &
"CQ EU WB9XYZ EN34", & "K1ABC W9XYZ 579 WI", &
"CQ WY WB9XYZ EN34", & "W9XYZ K1ABC R 589 MA", &
"1A/KA1ABC WB9XYZ", & "K1ABC KA0DEF 559 MO", &
"E5/KA1ABC WB9XYZ", & "TU; KA0DEF K1ABC R 569 MA", &
"KA1ABC 1A/WB9XYZ", & "KA1ABC G3AAA 529 0013", &
"KA1ABC E5/WB9XYZ", & "TU; G3AAA K1ABC R 559 MA", &
"KA1ABC/P WB9XYZ", & "CQ G4ABC/P IO91", &
"KA1ABC/A WB9XYZ", & "G4ABC/P PA9XYZ JO22", &
"KA1ABC WB9XYZ/P", & "PA9XYZ 590003 IO91NP", &
"KA1ABC WB9XYZ/A", & "G4ABC/P R 570007 JO22DB", &
"CQ KA1ABC/P", & "PA9XYZ G4ABC/P RR73", &
"CQ WB9XYZ/A", & "CQ PJ4/K1ABC", &
"QRZ KA1ABC/P", & "PJ4/K1ABC <W9XYZ>", &
"QRZ WB9XYZ/A", & "W9XYZ <PJ4/K1ABC> -11", &
"DE KA1ABC/P", & "<PJ4/K1ABC> W9XYZ R-09", &
"DE WB9XYZ/A", & "<W9XYZ> PJ4/K1ABC RRR", &
"CQ 1A/KA1ABC", & "PJ4/K1ABC <W9XYZ> 73", &
"CQ E5/KA1ABC", & "CQ W9XYZ EN37", &
"DE 1A/KA1ABC", & "<W9XYZ> YW18FIFA", &
"DE E5/KA1ABC", & "<YW18FIFA> W9XYZ -11", &
"QRZ 1A/KA1ABC", & "W9XYZ <YW18FIFA> R-09", &
"QRZ E5/KA1ABC", & "YW18FIFA <W9XYZ> RRR", &
"CQ WB9XYZ/1A", & "<W9XYZ> YW18FIFA 73", &
"CQ WB9XYZ/E5", & "TNX BOB 73 GL", &
"QRZ WB9XYZ/1A", & "CQ YW18FIFA", &
"QRZ WB9XYZ/E5", & "<YW18FIFA> KA1ABC", &
"DE WB9XYZ/1A", & "KA1ABC <YW18FIFA> -11", &
"DE WB9XYZ/E5", & "<YW18FIFA> KA1ABC R-17", &
"CQ A000/KA1ABC FM07", & "<KA1ABC> YW18FIFA RR73", &
"CQ ZZZZ/KA1ABC FM07", & "<YW18FIFA> KA1ABC 73", &
"QRZ W4/KA1ABC FM07", & "123456789ABCDEF012"/
"DE W4/KA1ABC FM07", &
"CQ W4/KA1ABC -22", &
"DE W4/KA1ABC -22", &
"QRZ W4/KA1ABC -22", &
"CQ W4/KA1ABC R-22", &
"DE W4/KA1ABC R-22", &
"QRZ W4/KA1ABC R-22", &
"DE W4/KA1ABC 73", &
"CQ KA1ABC FM07", &
"QRZ KA1ABC FM07", &
"DE KA1ABC/VE6 FM07", &
"CQ KA1ABC/VE6 -22", &
"DE KA1ABC/VE6 -22", &
"QRZ KA1ABC/VE6 -22", &
"CQ KA1ABC/VE6 R-22", &
"DE KA1ABC/VE6 R-22", &
"QRZ KA1ABC/VE6 R-22", &
"DE KA1ABC 73", &
"HELLO WORLD", &
"ZL4/KA1ABC 73", &
"KA1ABC XL/WB9XYZ", &
"KA1ABC WB9XYZ/W4", &
"DE KA1ABC/QRP 2W", &
"KA1ABC/1 WB9XYZ/1", &
"123456789ABCDEFGH"/
data testmsgchk(1:NTEST)/ &
"CQ WB9XYZ EN34", &
"CQ DX WB9XYZ EN34", &
"QRZ WB9XYZ EN34", &
"KA1ABC WB9XYZ EN34", &
"KA1ABC WB9XYZ RO", &
"KA1ABC WB9XYZ -21", &
"KA1ABC WB9XYZ R-19", &
"KA1ABC WB9XYZ RRR", &
"KA1ABC WB9XYZ 73", &
"KA1ABC WB9XYZ", &
"CQ 000 WB9XYZ EN34", &
"CQ 999 WB9XYZ EN34", &
"CQ EU WB9XYZ EN34", &
"CQ WY WB9XYZ EN34", &
"1A/KA1ABC WB9XYZ", &
"E5/KA1ABC WB9XYZ", &
"KA1ABC 1A/WB9XYZ", &
"KA1ABC E5/WB9XYZ", &
"KA1ABC/P WB9XYZ", &
"KA1ABC/A WB9XYZ", &
"KA1ABC WB9XYZ/P", &
"KA1ABC WB9XYZ/A", &
"CQ KA1ABC/P", &
"CQ WB9XYZ/A", &
"QRZ KA1ABC/P", &
"QRZ WB9XYZ/A", &
"DE KA1ABC/P", &
"DE WB9XYZ/A", &
"CQ 1A/KA1ABC", &
"CQ E5/KA1ABC", &
"DE 1A/KA1ABC", &
"DE E5/KA1ABC", &
"QRZ 1A/KA1ABC", &
"QRZ E5/KA1ABC", &
"CQ WB9XYZ/1A", &
"CQ WB9XYZ/E5", &
"QRZ WB9XYZ/1A", &
"QRZ WB9XYZ/E5", &
"DE WB9XYZ/1A", &
"DE WB9XYZ/E5", &
"CQ A000/KA1ABC FM07", &
"CQ ZZZZ/KA1ABC FM07", &
"QRZ W4/KA1ABC FM07", &
"DE W4/KA1ABC FM07", &
"CQ W4/KA1ABC -22", &
"DE W4/KA1ABC -22", &
"QRZ W4/KA1ABC -22", &
"CQ W4/KA1ABC R-22", &
"DE W4/KA1ABC R-22", &
"QRZ W4/KA1ABC R-22", &
"DE W4/KA1ABC 73", &
"CQ KA1ABC FM07", &
"QRZ KA1ABC FM07", &
"DE KA1ABC/VE6 FM07", &
"CQ KA1ABC/VE6 -22", &
"DE KA1ABC/VE6 -22", &
"QRZ KA1ABC/VE6 -22", &
"CQ KA1ABC/VE6 R-22", &
"DE KA1ABC/VE6 R-22", &
"QRZ KA1ABC/VE6 R-22", &
"DE KA1ABC 73", &
"HELLO WORLD", &
"ZL4/KA1ABC 73", &
"KA1ABC XL/WB9", &
"KA1ABC WB9XYZ", &
"DE KA1ABC/QRP", &
"KA1ABC/1 WB9X", &
"123456789ABCD"/

View File

@ -1,31 +1,28 @@
program ft8code program ft8code
! Provides examples of message packing, LDPC(144,87) encoding, bit and ! Provides examples of message packing, LDPC(174,91) encoding, bit and
! symbol ordering, and other details of the FT8 protocol. ! symbol ordering, and other details of the FT8 protocol.
use packjt use packjt77
use crc
include 'ft8_params.f90' !Set various constants include 'ft8_params.f90' !Set various constants
include 'ft8_testmsg.f90' include 'ft8_testmsg.f90'
parameter (NWAVE=NN*NSPS) parameter (NWAVE=NN*NSPS)
character*40 msg,msgchk character*77 c77
character*37 msg37 character*37 msg,msgsent
character*6 c1,c2
character*9 comment character*9 comment
character*22 msgsent,message character bad*1,msgtype*16
character bad*1,msgtype*10 character*91 cbits
character*87 cbits
integer itone(NN) integer itone(NN)
integer dgen(12) integer*1 msgbits(77)
integer*1 msgbits(KK),decoded(KK),decoded0(KK) logical unpk77_success
! Get command-line argument(s) ! Get command-line argument(s)
nargs=iargc() nargs=iargc()
if(nargs.ne.1 .and. nargs.ne.3) then if(nargs.ne.1 .and. nargs.ne.3) then
print* print*
print*,'Program ft8code: Provides examples of message packing, ', & print*,'Program ft8code: Provides examples of message packing, ', &
'LDPC(174,87) encoding,' 'LDPC(174,91) encoding,'
print*,'bit and symbol ordering, and other details of the FT8 protocol.' print*,'bit and symbol ordering, and other details of the FT8 protocol.'
print* print*
print*,'Usage: ft8code [-c grid] "message" # Results for specified message' print*,'Usage: ft8code [-c grid] "message" # Results for specified message'
@ -35,89 +32,55 @@ program ft8code
call getarg(1,msg) !Message to be transmitted call getarg(1,msg) !Message to be transmitted
if(len(trim(msg)).eq.2 .and. msg(1:2).eq.'-t') then if(len(trim(msg)).eq.2 .and. msg(1:2).eq.'-t') then
testmsg(NTEST+1)='KA1ABC RR73; WB9XYZ <KH1/KH7Z> -11' nmsg=NTEST
nmsg=NTEST+1
else else
msgchk=msg call fmtmsg(msg,iz) !To upper case; collapse multiple blanks
call fmtmsg(msgchk,iz) !To upper case; collapse multiple blanks
nmsg=1 nmsg=1
endif endif
write(*,1010) write(*,1010)
1010 format(" Message Decoded Err? Type"/76("-")) 1010 format(4x,'Message',31x,'Decoded',29x,'Err i3.n3'/100('-'))
do imsg=1,nmsg do imsg=1,nmsg
if(nmsg.gt.1) msg=testmsg(imsg) if(nmsg.gt.1) msg=testmsg(imsg)
call fmtmsg(msg,iz) !To upper case, collapse multiple blanks
msgchk=msg
! Generate msgsent, msgbits, and itone ! Generate msgsent, msgbits, and itone
if(index(msg,';').le.0) then i3=-1
call packmsg(msg(1:22),dgen,itype) n3=-1
msgtype="" call genft8_174_91(msg,i3,n3,msgsent,msgbits,itone)
if(itype.eq.1) msgtype="Std Msg" msgtype=""
if(itype.eq.2) msgtype="Type 1 pfx" if(i3.eq.0) then
if(itype.eq.3) msgtype="Type 1 sfx" if(n3.eq.0) msgtype="Free text"
if(itype.eq.4) msgtype="Type 2 pfx" if(n3.eq.1) msgtype="DXpedition mode"
if(itype.eq.5) msgtype="Type 2 sfx" if(n3.eq.2) msgtype="EU VHF Contest"
if(itype.eq.6) msgtype="Free text" if(n3.eq.3) msgtype="ARRL Field Day"
i3bit=0 if(n3.eq.4) msgtype="ARRL Field Day"
call genft8(msg(1:22),i3bit,msgsent,msgbits,itone) if(n3.eq.5) msgtype="Telemetry"
if(n3.ge.6) msgtype="Undefined type"
endif
if(i3.eq.1) msgtype="Standard msg"
if(i3.eq.2) msgtype="EU VHF Contest"
if(i3.eq.3) msgtype="ARRL RTTY Roundup"
if(i3.eq.4) msgtype="Nonstandard calls"
if(i3.ge.5) msgtype="Undefined msg type"
if(i3.ge.1) n3=-1
bad=" "
comment=' '
if(msg.ne.msgsent) bad="*"
if(n3.ge.0) then
write(*,1020) imsg,msg,msgsent,bad,i3,n3,msgtype,comment
1020 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',i1,1x,a16,1x,a9)
else else
call foxgen_wrap(msg,msgbits,itone) write(*,1022) imsg,msg,msgsent,bad,i3,msgtype,comment
i3bit=1 1022 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',1x,1x,a16,1x,a9)
endif endif
decoded=msgbits
i3bit=4*decoded(73) + 2*decoded(74) + decoded(75)
iFreeText=decoded(57)
decoded0=decoded
if(i3bit.eq.1) decoded(57:)=0
call extractmessage174(decoded,message,ncrcflag)
decoded=decoded0
if(i3bit.eq.0) then
bad=" "
comment=' '
if(itype.ne.6 .and. message.ne.msgchk) bad="*"
if(itype.eq.6 .and. message(1:13).ne.msgchk(1:13)) bad="*"
if(itype.eq.6 .and. len(trim(msgchk)).gt.13) comment='truncated'
write(*,1020) imsg,msgchk,message,bad,i3bit,itype,msgtype,comment
1020 format(i2,'.',1x,a22,1x,a22,1x,a1,2i2,1x,a10,1x,a9)
else
write(cbits,1001) decoded
1001 format(87i1)
read(cbits,1002) nrpt
1002 format(66x,b6)
irpt=nrpt-30
i1=index(message,' ')
i2=index(message(i1+1:),' ') + i1
c1=message(1:i1)//' '
c2=message(i1+1:i2)//' '
msg37=c1//' RR73; '//c2//' <...> '
write(msg37(35:37),1003) irpt
1003 format(i3.2)
if(msg37(35:35).ne.'-') msg37(35:35)='+'
iz=len(trim(msg37))
do iter=1,10 !Collapse multiple blanks into one
ib2=index(msg37(1:iz),' ')
if(ib2.lt.1) exit
msg37=msg37(1:ib2)//msg37(ib2+2:)
iz=iz-1
enddo
write(*,1021) imsg,msgchk,msg37
1021 format(i2,'.',1x,a40,1x,a37)
endif
enddo enddo
if(nmsg.eq.1) then if(nmsg.eq.1) then
write(*,1030) msgbits(1:56) write(*,1030) msgbits
1030 format(/'Call1: ',28i1,' Call2: ',28i1) 1030 format(/'Message bits: ',/77i1)
write(*,1032) msgbits(57:72),msgbits(73:75),msgbits(76:87)
1032 format('Grid: ',16i1,' 3Bit: ',3i1,' CRC12: ',12i1)
write(*,1034) itone write(*,1034) itone
1034 format(/'Channel symbols:'/79i1) 1034 format(/'Channel symbols (tones):'/79i1)
endif endif
999 end program ft8code 999 end program ft8code