> 3068F のタイマー機能を使って、10msec程度の定周期割込みを > かけようと思っているのですが、どこかにサンプルプログラム等 > ないでしょうか? 3067の例ですけど、同じかしらん? // boot.c H8 debbug boot Y2K0601 ob henry // Debbugger - KMC PArtner 2 -10 H8 // ROM BOOT --- rom.bat ,rom.mak ,rom.sub #include <machine.h> #include "3067f.h" #include "netc.h" #include "unix_t.h" void initITU0(void) ; // devider ---sample void initITU1(void) ; // 1ms Timer For TCP/IP Operations. void initITU3(void) ; // blinker-3 --- sample void initITU4(void) ; // blinker-4 --- sample void initIO(void) ; // toggle out 1ms. --- sample void main(void) ; // main loop #pragma stacksize 0x8000 // SET SP STACK + stacksize(32KB) #pragma entry boot // stack ER7 is set automatically. boot() // Entry Function --- set SP. { int a,b,c; unsigned int *s,*d,*l; BSC.ABWCR.BYTE=0xf8; // CS2:16 bus width // CS1:16 // CS0:16 BSC.ASTCR.BYTE=0xfc; // CS0: 2 States CS - wait // CS1: 2 States // CS2: 3 States BSC.WCR.BYTE.H=0xff; // No Wait Conr Ope. BSC.WCR.BYTE.L=0xd0; // CS2:1 // CS1:0 // CS0:0 BSC.BCR.BYTE=0xcf; // RD,WR 1 Idle state at CSn changes. BSC.BRCR.BYTE=0xee; // A21-23 :I/O don't care // BREQ,BACK :I/O BSC.CSCR.BYTE=0x0f; // CSS4-7 Disable P1DDR=0xff; // P1 A 0-A 7 necessary on mode 6 P2DDR=0xff; // P2 A 8-A15 P5DDR=0xff; // P5 A16-A19 P6DDR=0x7E; // P6 CLK,LWR,HWR,RD,AS/-,LED,WAIT P8DDR=0x1c; // P8 /CS0,/CS1,/CS2,/IRQ1,/IRQ0 P9DDR=0x38; // P9 RTS1-o,DTR1-o,/RXD1,/RXD0./TXD1,/TXD0 PADDR=0x94; // PA A20,Ri1-i,DCD1-i,TIOCA1-o,TCLKD-o,TIOCA0-o,CTS1-i,DSR1-i PBDDR=0x0f; // PB -,-,-,-,LED3,LDE2,LED1,LED0 d=__sectop("R"); // R - Data Section on RAM s=__sectop("D"); // D - Data Section on ROM l=__secend("D"); // while(s < l) // Copy DATA into Sram Area { *d++=*s++; // } // d=__sectop("B"); // B- BSS Section l=__secend("B"); // while(d < l) // Clesr BSS DATA as 0x00 { *d++=0; // } // INTC.IPRA.BYTE=0; // INTC.IPRB.BYTE=0; // set_ccr(0) ; // Clear interrupt mask initITU0() ; // Initalize ITU ch0 - System Timer initITU1() ; // Initalize ITU ch1 - Blink main(); while(1) { a=b+c; b=a+c; c=a+b; } } // ------- ----------------------------------------------------- // Base Timer Ch1 1ms timer. // // void initITU0() { ITU0.TCR.BYTE = 0x20 ; // clear GRA comparematch,1/1 clock ITU0.TIOR.BYTE = 3 ; // TIOCA0 Pulse. ITU0.GRA = 18431 ; // 1ms = 18,432,000 / (18431+1) ITU.TSTR.BYTE = (0x01 | ITU.TSTR.BYTE); // Start ITU ch0 ITU.TISRA.BIT.IMIEA0=1; } // ********************************** // * グローバル変数宣言 * // ********************************** unsigned int t1ms,t10ms,t100ms,t1s; // system timer variable static int t1m,t10m,t100m,t1; // not public --- // ------- 1ms timer services ----------------------------------- #pragma interrupt(imia0) // Interrupt Routine. unsigned int multi_timer_int=0; // unsigned int t1mxx=0; // void imia0() // Intr. Service CH1 { unsigned int i; ITU.TISRA.BIT.IMFA0=0; // clear flag t1ms++; time_1ms(); // calender if((0 < t1m)&&(10 > t1m)) t1m++; // 1 -9 -> 2-10 else { t1m=1; t10ms++; if((0 < t10m)&&(10 > t10m)) t10m++; // 1 -9 -> 2-10 else { t10m=1; t100ms++; P6DR.BIT.B1 = ~P6DR.BIT.B1 ; // Reverse P61 pin if((0 < t100m)&&(10 > t100m)) t100m++; // 1 -9 -> 2-10 else { t100m=1; t1s++; } } } if(0 == multi_timer_int) // Busy Now ? { multi_timer_int=1; // Timer Back-Ground Start. set_imask_ccr(0); // Enable interupt. netc_ts(); // Ethernet - IP,ICMP,UDP,TCP multi_timer_int=0; // Timer Back-Ground Exit. } } // ------- ----------------------------------------------------- // set ITU0 as the devider-0 // need external wireing. void initITU1() { ITU1.TCR.BYTE = 0xa7 ; // clear GRA comparematch,CLKD ITU1.TIOR.BYTE = 0x03 ; // use TIOCA1 ITU1.GRA = 299 ; // 300MS ITU.TSTR.BYTE = (0x02 | ITU.TSTR.BYTE); // Start ITU ch0 } 横浜市 緑区 東本郷 6-17-1-602 オンボード Tel: 045-473-7678 URL:www02.so-net.ne.jp/~ob_henry