summaryrefslogtreecommitdiff
path: root/lib/ft8/chkcrc14a.f90
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
committerChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
commite0737c56c1e384e05064a0c6e1ac46979371041b (patch)
treea0123d694a2d36c43dabdf0a3907392fce11d457 /lib/ft8/chkcrc14a.f90
parentb4aebf2d137b892f53503b13785ecae900062ff7 (diff)
New upstream version 2.0.0+repackupstream/2.0.0+repack
Diffstat (limited to 'lib/ft8/chkcrc14a.f90')
-rw-r--r--lib/ft8/chkcrc14a.f9024
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/ft8/chkcrc14a.f90 b/lib/ft8/chkcrc14a.f90
new file mode 100644
index 00000000..d9d3d7a4
--- /dev/null
+++ b/lib/ft8/chkcrc14a.f90
@@ -0,0 +1,24 @@
+subroutine chkcrc14a(decoded,nbadcrc)
+
+ use crc
+ integer*1 decoded(91)
+ integer*1, target:: i1Dec8BitBytes(12)
+ character*91 cbits
+
+! Write decoded bits into cbits: 77-bit message plus 14-bit CRC
+ write(cbits,1000) decoded
+1000 format(91i1)
+ read(cbits,1001) i1Dec8BitBytes
+1001 format(12b8)
+ read(cbits,1002) ncrc14 !Received CRC14
+1002 format(77x,b14)
+
+ i1Dec8BitBytes(10)=iand(i1Dec8BitBytes(10),128+64+32+16+8)
+ i1Dec8BitBytes(11:12)=0
+ icrc14=crc14(c_loc(i1Dec8BitBytes),12) !CRC14 computed from 77 msg bits
+
+ nbadcrc=1
+ if(ncrc14.eq.icrc14) nbadcrc=0
+
+ return
+end subroutine chkcrc14a