/*********************************************************************
* FileName: adsbin.c
* Dependencies: See INCLUDES section below
* Processor: PIC18
* Compiler: C18 2.30.01+
* Company: sprut
* Copyright: 2007-2010 Joerg Bredendiek (sprut)
*
*
********************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/** I N C L U D E S **********************************************************/
#include <p18cxxx.h>
#include <usart.h>
#include "system\typedefs.h"
#include "system\usb\usb.h"
#include "io_cfg.h" // I/O pin mapping
#include "delays.h"
//#include "system\interrupt\interrupt.h"
#include "user\user.h"
#include "user\adsbin.h"
/** V A R I A B L E S ********************************************************/
#pragma udata
/** D E C L A R A T I O N S **************************************************/
#pragma code
// AAA0 ... AAA6 ...AAA11 ... AAA13
// Warten und finden eines Datenblocks
// wenn er gefunden wird, dann
// Einschreiben in adsb[0..13]
// 56Bit:Lang=0 / 112Bit:Lang=1
// Rueckkehr mit w=0
// wenn er NICHT gefunden wird, dann
// Rueckkehr mit w=1
// Anzahl der Suchschleifen: adsbLoopH-adsbLoopL
// 25600 Schleifen in 15 ms => 0.6 us pro Schleife ~ 7 Befehle
//
// das ist eine der unelegantesten routinen die denkbar ist
// aber sie funktioniert
// never touch a running system!
char adsb_in(void)
{
_asm
BCF INTCON, GIEH, A
BCF PORTC, 1, A // HDR_OUT
BRA Start_Hdr
// Fehler im Datenblock
Error_Data:
// Einstieg:
// Fehler im Header
Error_Hdr:
DECFSZ adsbLoopL, F, 1 // 255 erfolglose Leseversuche, outer loop
BRA Start_Hdr // neuer Versuch kurze Schleife: 7 Zyklen = 0.5833 us
DECFSZ adsbLoopH, F, 1
BRA Start_Hdr // neuer Versuch lange Schleife: 9 Zyklen = 0.75 us, Durchschnitt = 0.58398 us
BSF INTCON, GIEH, A
MOVLW 1 // true, Fehler, nichts empfangen
RETURN 0
// Einlesen : ist das ein Header ?
Start_Hdr:
BTFSC PORTC, 0, A // 1
BTFSS PORTC, 0, A // 0,166 us lang
BRA Error_Hdr
NOP
NOP
NOP
BTFSS PORTC, 0, A // 0
BTFSC PORTC, 0, A
BRA Error_Hdr
NOP
NOP
NOP
BTFSC PORTC, 0, A // 1
BTFSS PORTC, 0, A
BRA _Skip_Pulse // es wurde erst der 2. Puls gefunden, deshalb vorspringen
NOP
NOP
NOP
BTFSS PORTC, 0, A // 0
BTFSC PORTC, 0, A
BRA Error_Hdr
NOP
NOP
NOP
BTFSS PORTC, 0, A // 0
BTFSC PORTC, 0, A
BRA Error_Hdr
NOP
_Skip_Pulse:
// ab hier kann man auch die TOA bestimmen
movf TMR0L,W,A //NOP 0xFD6 RAM location in Access RAM (BSR register is ignored)
movwf Time0,1 //NOP RAM bank is specified by BSR register
BTFSS PORTC, 0, A // 0
BTFSC PORTC, 0, A
BRA Error_Hdr
movf TMR0H,W,A //NOP 0xFD7 RAM location in Access RAM (BSR register is ignored)
movwf Time1,1 //NOP RAM bank is specified by BSR register
NOP
BTFSS PORTC, 0, A // 0
BTFSC PORTC, 0, A
BRA Error_Hdr
NOP
NOP
NOP
BTFSC PORTC, 0, A // 1
BTFSS PORTC, 0, A
BRA Error_Hdr
NOP
NOP
NOP
BTFSS PORTC, 0, A // 0
BTFSC PORTC, 0, A
BRA Error_Hdr
NOP
NOP
NOP
BTFSC PORTC, 0, A // 1
BTFSS PORTC, 0, A
BRA Error_Hdr
NOP
NOP
NOP
BTFSS PORTC, 0, A // 0
BTFSC PORTC, 0, A
BRA Error_Hdr
NOP
NOP
NOP
BTFSS PORTC, 0, A // 0
BTFSC PORTC, 0, A
BRA Error_Hdr
NOP
NOP
NOP
BTFSS PORTC, 0, A // 0
BTFSC PORTC, 0, A
BRA Error_Hdr
NOP
NOP
NOP
BTFSS PORTC, 0, A // 0
BTFSC PORTC, 0, A
BRA Error_Hdr
NOP
NOP
NOP
BTFSS PORTC, 0, A // 0
BTFSC PORTC, 0, A
BRA Error_Hdr
NOP
NOP
NOP
BTFSS PORTC, 0, A // 0
BTFSC PORTC, 0, A
BRA Error_Hdr
NOP
BCF PORTC, 2, A // altes frame nun ungueltig
BSF PORTC, 1, A
// es folgt der Datenblock
// 5 Bit Format-Number
//Lang = 0
// DF00 00000 56 bit
// DF04 00100 56 bit
// DF05 00101 56 bit
// DF11 01011 56 bit
// Lang = 1
// DF16 10000 112 bit
// DF17 10001 112 bit
// DF19 10011 112 bit
// DF20 10100 112 bit
// DF21 10101 112 bit
// DF22 10110 112 bit
// DF24 11000 112 bit
//
// das erste Bit unterscheidet zwischen 56 und 112 bit
RRCF PORTC, W, A
RLCF AAA0, F, 1
CLRF Lang, 1 // 56 oder 112 bit noch unbekannt
BTFSC AAA0, 0, 1 // Test 56 oder 112 Bit ?
INCF Lang, F, 1 // 112 Bit : Lang = 1
NOP
MOVF PORTC, W, A
XORWF AAA0, W, 1
ANDLW 0x01
BZ Error_Data // Fehler im Datenblock
NOP
NOP
RRCF PORTC, W, A
RLCF AAA0, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA0, W, 1
ANDLW 0x01
BNZ BIT02_ok
BRA Error_Data
BIT02_ok:
NOP
RRCF PORTC, W, A
RLCF AAA0, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA0, W, 1
ANDLW 0x01
BNZ BIT03_ok
BRA Error_Data
BIT03_ok:
NOP
RRCF PORTC, W, A
RLCF AAA0, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA0, W, 1
ANDLW 0x01
BNZ BIT04_ok
BRA Error_Data
BIT04_ok:
NOP
RRCF PORTC, W, A
RLCF AAA0, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA0, W, 1
ANDLW 0x01
BNZ BIT05_ok
BRA Error_Data
BIT05_ok:
NOP
RRCF PORTC, W, A
RLCF AAA0, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA0, W, 1
ANDLW 0x01
BNZ BIT06_ok
BRA Error_Data
BIT06_ok:
NOP
RRCF PORTC, W, A
RLCF AAA0, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA0, W, 1
ANDLW 0x01
BNZ BIT07_ok
BRA Error_Data
BIT07_ok:
NOP
RRCF PORTC, W, A
RLCF AAA0, F, 1
NOP
NOP
NOP
BSF ADCON0, 1, A
MOVF PORTC, W, A
XORWF AAA0, W, 1
ANDLW 0x01
BNZ BIT08_ok
BRA Error_Data
BIT08_ok:
NOP
// byte 2
RRCF PORTC, W, A
RLCF AAA1, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA1, W, 1
ANDLW 0x01
BNZ BIT09_ok
BRA Error_Data
BIT09_ok:
NOP
RRCF PORTC, W, A
RLCF AAA1, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA1, W, 1
ANDLW 0x01
BNZ BIT10_ok
BRA Error_Data
BIT10_ok:
NOP
RRCF PORTC, W, A
RLCF AAA1, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA1, W, 1
ANDLW 0x01
BNZ BIT11_ok
BRA Error_Data
BIT11_ok:
NOP
RRCF PORTC, W, A
RLCF AAA1, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA1, W, 1
ANDLW 0x01
BNZ BIT12_ok
BRA Error_Data
BIT12_ok:
NOP
RRCF PORTC, W, A
RLCF AAA1, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA1, W, 1
ANDLW 0x01
BNZ BIT13_ok
BRA Error_Data
BIT13_ok:
NOP
RRCF PORTC, W, A
RLCF AAA1, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA1, W, 1
ANDLW 0x01
BNZ BIT14_ok
BRA Error_Data
BIT14_ok:
NOP
RRCF PORTC, W, A
RLCF AAA1, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA1, W, 1
ANDLW 0x01
BNZ BIT15_ok
BRA Error_Data
BIT15_ok:
NOP
RRCF PORTC, W, A
RLCF AAA1, F, 1
NOP
NOP
NOP
NOP
MOVF PORTC, W, A
XORWF AAA1, W, 1
ANDLW
没有合适的资源?快使用搜索试试~ 我知道了~
ADS-B-demodulated-code.rar_ADS-B DF17_ADS-B DF17_ADS_b_df17_民航
共54个文件
h:24个
c:18个
lkr:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 3 下载量 142 浏览量
2022-07-15
16:35:51
上传
评论 3
收藏 135KB RAR 举报
温馨提示
国际民航组织通用 ADS-B 解码器代码 for DF17 iframe
资源推荐
资源详情
资源评论
收起资源包目录
ADS-B-demodulated-code.rar (54个子文件)
firmware
adsb_03.hex 35KB
source
03
adsb_03.mcp 3KB
adsb_03.mcs 14KB
rm18f2455.lkr 2KB
18f87j50.lkr 2KB
main.c 12KB
io_cfg.h 5KB
adsb_03.mcw 113KB
system
usb
usb9
usb9.c 12KB
usb9.h 4KB
class
cdc
cdc.c 20KB
cdc.h 12KB
usbdrv
usbdrv.c 28KB
usbdrv.h 9KB
usb_compile_time_validation.h 3KB
usbmmap.h 7KB
usbctrltrf
usbctrltrf.c 27KB
usbctrltrf.h 4KB
usbmmap.c 12KB
usb.h 2KB
usbdefs
usbdefs_std_dsc.h 6KB
usbdefs_ep0_buff.h 7KB
interrupt
interrupt.c 2KB
interrupt.h 811B
typedefs.h 4KB
user
user.c 22KB
back_090610
HyperTerminal.lnk 786B
user.c 16KB
adsbin.c 24KB
adsbin.h 2KB
user.h 4KB
adsbin.c 31KB
agc.h 2KB
agc.c 4KB
adsbin.h 3KB
back_100610
HyperTerminal.lnk 786B
user.c 17KB
adsbin.c 23KB
adsbin.h 2KB
user.h 4KB
back_110610
user.c 17KB
adsbin.c 31KB
agc.h 2KB
agc.c 3KB
adsbin.h 3KB
user.h 4KB
user.h 4KB
CleanUp.bat 1KB
rm18f4550.lkr 1KB
inf
win2k_xp_vista32_64
mchpcdc.cat 7KB
mchpcdc.inf 3KB
autofiles
usbdsc.h 3KB
usbdsc.c 13KB
usbcfg.h 3KB
共 54 条
- 1
资源评论
- m0_749767662023-06-19这个资源内容超赞,对我来说很有价值,很实用,感谢大佬分享~
- m0_744752842023-06-19实在是宝藏资源、宝藏分享者!感谢大佬~
- jf07462023-09-15感谢资源主分享的资源解决了我当下的问题,非常有用的资源。
weixin_42651887
- 粉丝: 75
- 资源: 1万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功