]>
cloudbase.mooo.com Git - irmp.git/blob - irmp-main-pic-xc8.c
2d783271f35a136a49c49153b7436b3879f838dd
1 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2 * irmp-main-pic-xc8.c - demo main module to test IRMP decoder on PIC18F4520 with XC8 compiler
4 * Copyright (c) 2009-2016 Frank Meyer - frank(at)fli4l.de
6 * $Id: irmp-main-pic-xc8.c,v 1.2 2016/09/09 08:01:11 fm Exp $
8 * This demo module is runnable on PIC18F4520 with XC8 compiler
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *---------------------------------------------------------------------------------------------------------------------------------------------------
23 #define _XTAL_FREQ 32000000UL // 32MHz clock
24 #define FOSC _XTAL_FREQ
25 #define FCY FOSC / 4UL // --> 8MHz
27 #define BAUDRATE 19200UL
28 #define BRG (( FCY 16 BAUDRATE ) -1UL)
38 irmp_init(); // initialize irmp
40 // infinite loop, interrupts will blink PORTD pins and handle UART communications.
43 LATBbits
.LATB0
= ~LATBbits
.LATB0
;
45 if (irmp_get_data (&irmp_data
))
47 // ir signal decoded, do something here...
48 // irmp_data.protocol is the protocol, see irmp.h
49 // irmp_data.address is the address/manufacturer code of ir sender
50 // irmp_data.command is the command code
51 // irmp_protocol_names[irmp_data.protocol] is the protocol name (if enabled, see irmpconfig.h)
52 printf("proto %d addr %d cmd %d\n", irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
);
57 void interrupt high_priority
high_isr(void)
61 TMR2IF
= 0; // clear Timer 0 interrupt flag