#ifndef _int_h_ #define _int_h_ #include #include #include #include #include #include #include #include "global.h" #include "util.h" /* TIMER-interrupt --------------- prescale 16, = 1,25 Mhz = 800ns, downward count 125 * 0.8us = 100 us = 0,1 ms 65536 - 125 = 65411 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 T3CON = 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 off 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 on | |_ t3otl high at startup T4CON = 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 reload for t3 any signal of t3otl T3 = TIMERRELOAD T4 = TIMERRELOAD IR IE ILVL GLVL T3IC = 0 0 0 0 0 0 0 0 1 0 1 0 0 1 1 1 off 0xa7 167 T3IC = 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 on 0xe7 231 (int vector 0x8C, trap 0x23, group(3), level(9) ) SERIAL-interrupt ASC0 --------------------- IR IE ILVL GLVL SORIC = 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 off 0x0a 10 SORIC = 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 on 0x4a 74 ( RXD int vector 0xac, trap 0x2b, group(2), level(2) ) SOTIC = 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 off 0x0b 11 SOTIC = 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1 on 0x4b 75 ( TXD int vector 0xa8, trap 0x2a, group(3), level(2) ) S03 S0LB S0BRS SOODD - S0OE S0FE S0PE S0OEN S0FEN S0PEN S0REN S0STP (S0M) SOCON = 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 (0x8011) 8 bit data async. one stopbit 0 = receiver disabled / 1 = enabled Ignore parity Ignore Framing errors Ignore Overrun errors Parity error flag Framing error flag overrun error flag 0 = parity even / 1 = parity odd baudrate generator enabled. SOBG = baudratevalue 0x40 (9600), 0x20 (19200), 0x10 (38400), 0x0a (57600) //ASCO Transmitbuffer int vector 0x11c, trap 47h, currently not used. //ASCO Error int vector 0xb0, trap 0x2c, currently not used. */ #define TIMERRELOAD 65411 #define TIMERSTOP 1025 #define TIMERSTART 1089 #define TIMERSET 39 #define TIMERINTOFF 167 #define TIMERINTON 231 #define SERIALMAXLENGTH 130 #define Baud9600 0x40 #define Baud19k2 0x20 #define Baud38k4 0x10 #define Baud57k6 0x0A sbit TxD = P3^10; sbit DTxD = DP3^10; sbit DRxD = DP3^11; extern unsigned char serinbuf[ SERIALMAXLENGTH + 2 ]; extern unsigned int serinbufct; extern unsigned int serinflag; extern unsigned char seroutbuf[ SERIALMAXLENGTH + 2 ]; extern unsigned int seroutbufct; extern unsigned int seroutflag; extern void init_serial( unsigned int baud ); extern void deinit_serial( void ); extern void serial_receive( int wait ); extern void serial_transmit( int wait ); extern void initTimerInt( void ); extern void startTimerInt( void ); extern void stopTimerInt( void ); /* generally timevariables, used by timer-int, rtc, and for calculation of current startime. */ extern volatile int idata YEAR; extern volatile int idata MONTH; extern volatile int idata DAY; extern volatile int idata HOUR; extern volatile int idata MINUTE; extern volatile int idata SECOND; extern volatile int idata MSECOND; extern volatile int idata TIMER10; extern volatile int idata THISMDAYS; #endif