00001
00002
00003
00004
00005
00006 #include "piccolo_all.h"
00007
00024 volatile char dummy, cFlag = 0;
00025
00026
00027
00029 #pragma interrupt hi_isr
00030 void hi_isr() {
00031 USBDeviceTasks();
00032 }
00034 #pragma interruptlow lo_isr
00035 void lo_isr() {
00036 #if defined(__18F4550)
00037 dummy=PORTB;
00038 INTCONbits.RBIF=0;
00039 #elif defined(__18F14K50)
00040 dummy=PORTA;
00041 INTCONbits.RABIF=0;
00042 #endif
00043 cFlag = 1;
00044 }
00045
00046
00047
00048 void main(void) {
00049 InitializeSystem();
00050 RCONbits.IPEN=1;
00051 INTCONbits.GIEL=1;
00052
00053 while (!usb_cdc_kbhit()) {
00054 ProcessIO();
00055 }
00056 outString("change_test.c program, ");
00057
00058 #if defined(__18F4550)
00059 TRISB=0xFF;
00060 INTCON2bits.RBPU=0;
00061 INTCONbits.RBIF=0;
00062 INTCON2bits.RBIP=0;
00063 INTCONbits.RBIE=1;
00064 outString("PICCOLO-4550 n");
00065 #elif defined(__18F14K50)
00066 IOCAbits.IOCA3=1
00067 INTCONbits.RABIF=0;
00068 INTCON2bits.RABIP=0;
00069 INTCONbits.RABIE=1;
00070 outString("PICCOLO-14K50 n");
00071 #endif
00072 while (1) {
00073 ProcessIO();
00074 if (cFlag) {
00075 delay_ms(20);
00076 cFlag = 0;
00077 outString("SW1 állapota megváltozott! n");
00078 }
00079 }
00080 }