/*==============================================================================
stepper_motor.h (tested on MINIANGLE STEPPER MOTOR 5V/1A and L298 IC)
Bidirectional Stepper Motor Driver for Small Device C Compiler
Written by Ervin Jung (2010)/*==============================================================================
rf12.h
HOPE RF12 FSK Transceiver Library
Written by Ervin Jung (2010)
Based on: HOPE RF, RF12B programming guide
--------------------------------------------------------------------------------
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, or (at your option) any
later version.main.c
//============================================================================== // example: Led flasher by Interrupts // Written by Ervin Jung (2010) //============================================================================== #include "main.h" #include <simple_delay.h> char led2_state = 0; char led1_state = 0; // 5,461 ms SIGHANDLER(timer0_handler) { LATDbits.LATD3 = led2_state; led2_state = !led2_state; INTCONbits.TMR0IF = 0; } // 5,461 ms SIGHANDLER(timer2_handler) { LATDbits.LATD2 = led1_state; led1_state = !led1_state;
A bootloader használatához szükségesek a megfelelően előkészített startup kódok, attól függően melyiket kívánjuk használni. Ezek a kódok a crt0.c, crt0i.c és a crt0iz.c fájlokban vannak. Illetve szükséges még a megfelelően megszerkesztett Linker Script és a megfelelő compiler és linker opciók beállítása is.
Példaként nézzük a crt0i.c tartalmának egy döntő részletét, ami alapesetben a reset vektort a 0x0000 címre helyezi:
/* * entry function, placed at interrupt vector 0 (RESET) */ void _entry (void) __naked __interrupt 0 { __asm goto __startup
Példaprogram egyéni karakterek létrehozására és használatra.
/*============================================================================== Custom Charcters Written by Ervin Jung (2010) You can find more infromations in the lcd.h ==============================================================================*/ #include <pic18fregs.h> #define FOSC 48000000 // because PPL5 #define LCD_USE_DEFAULTS #include <simple_delay.h> #include <lcd.h> #include <math.h> #include <stdlib.h>
Elkészült az ADC-átalakító támogatása, illetve az Usart Terminálba bekerült egy ADC monitor, amivel feldogozható két ADC érték.
Egy példaprogram a használathoz:
/*==============================================================================
analog.h optimized for IDE for PIC18F
devices: pic18f2455, pic18f2550,pic18f4455, pic18f4550
Written by Ervin Jung (2010)
--------------------------------------------------------------------------------
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, or (at your option) any
later version.
/*==============================================================================
timers.h optimized for IDE for PIC18F
Written by Ervin Jung (2010)
--------------------------------------------------------------------------------
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, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,#define FOSC 48000000 code char at __CONFIG1L config1l = 0xff & _PLLDIV_DIVIDE_BY_5__20MHZ_INPUT__1L & _CPUDIV__OSC1_OSC2_SRC___1__96MHZ_PLL_SRC___2__1L & _USBPLL_CLOCK_SRC_FROM_96MHZ_PLL_2_1L; code char at __CONFIG1H config1h = 0xff & _OSC_HS__HS_PLL__USB_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H; code char at __CONFIG2L config2l = 0xff & _PUT_ON_2L & _BODEN_ON_2L & _BODENV_2_0V_2L & _VREGEN_ON_2L; code char at __CONFIG2H config2h = 0xff & _WDT_DISABLED_CONTROLLED_2H & _WDTPS_1_32768_2H;
/*==============================================================================
simple_delay.h
simple delay functions
Written by Ervin Jung (2010)
--------------------------------------------------------------------------------
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, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,