From c14fd2b1e51bfd12bb06faac6edcb092d94b48f0 Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Wed, 14 Jun 2017 19:56:23 +0000 Subject: [PATCH] Another test file. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7715 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/fsk4hf/extractmessage174.f90 | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 lib/fsk4hf/extractmessage174.f90 diff --git a/lib/fsk4hf/extractmessage174.f90 b/lib/fsk4hf/extractmessage174.f90 new file mode 100644 index 000000000..43823507a --- /dev/null +++ b/lib/fsk4hf/extractmessage174.f90 @@ -0,0 +1,51 @@ +subroutine extractmessage174(decoded,msgreceived,ncrcflag,recent_calls,nrecent) + use iso_c_binding, only: c_loc,c_size_t + use crc + use packjt + + character*22 msgreceived + character*12 call1,call2 + character*12 recent_calls(nrecent) + integer*1 decoded(87) + integer*1, target:: i1Dec8BitBytes(11) + integer*4 i4Dec6BitWords(12) + +! Collapse 87 decoded bits to 11 bytes. Bytes 1-9 are the message, byte 10 and first half of byte 11 is the crc + do ibyte=1,9 + itmp=0 + do ibit=1,8 + itmp=ishft(itmp,1)+iand(1,decoded((ibyte-1)*8+ibit)) + enddo + i1Dec8BitBytes(ibyte)=itmp + enddo +! Need to pack the crc into bytes 10 and 11 for crc12_check +! i1Dec8BitBytes(10)=decoded(73)*8+decoded(74)*4+decoded(75)*2+decoded(76) +! i1Dec8BitBytes(11)=decoded(77)*128+decoded(78)*64+decoded(79)*2*32+decoded(80)*16 +! i1Dec8BitBytes(11)=i1Dec8BitBytes(11)+decoded(81)*8+decoded(82)*4+decoded(83)*2+decoded(84) + i1Dec8BitBytes(10)=decoded(76)*8+decoded(77)*4+decoded(78)*2+decoded(79) + i1Dec8BitBytes(11)=decoded(80)*128+decoded(81)*64+decoded(82)*2*32+decoded(83)*16 + i1Dec8BitBytes(11)=i1Dec8BitBytes(11)+decoded(84)*8+decoded(85)*4+decoded(86)*2+decoded(87) + + if( crc12_check(c_loc (i1Dec8BitBytes), 11) ) then +! CRC12 checks out --- unpack 72-bit message + do ibyte=1,12 + itmp=0 + do ibit=1,6 + itmp=ishft(itmp,1)+iand(1,decoded((ibyte-1)*6+ibit)) + enddo + i4Dec6BitWords(ibyte)=itmp + enddo + call unpackmsg144(i4Dec6BitWords,msgreceived,call1,call2) + ncrcflag=1 + if( call1(1:2) .ne. 'CQ' .and. call1(1:2) .ne. ' ' ) then + call update_recent_calls(call1,recent_calls,nrecent) + endif + if( call2(1:2) .ne. ' ' ) then + call update_recent_calls(call2,recent_calls,nrecent) + endif + else + msgreceived=' ' + ncrcflag=-1 + endif + return + end subroutine extractmessage174