1 /* This example compiles right out of the box for TINI after you did a
2 make install of sdcc (latest revision :).
4 Just do a "make" which compiles and compresses it a little.
5 Than use JavaKit to load clock390.hex (it goes into bank 1, see Makefile)
6 Type 'E' in JavaKit and enjoy :) */
8 /* if you are using the (default) interrupt scheme for serial i/o,
9 you need to include this in the main program, so the vector will
11 #include <serial390.h>
17 volatile unsigned long milliSeconds=0;
19 #define RELOAD_VALUE 18432000/2/1000 // appr. 1ms
21 void Timer2Handler (void) interrupt 5 using 1 {
22 TF2=0; // reset overflow flag
24 // that's all for now :)
27 // we can't just use milliSeconds
28 unsigned long GetMilliSeconds(void) {
37 unsigned long ms, seconds, oldSeconds=-1;
39 printf ("\n\rStarting timer 2 test.\n\r");
42 ET2=0; // disable timer interrupts initially
43 T2CON=0; // stop, timer mode, autoreload
46 TL2=RTL2=(-RELOAD_VALUE)&0xff;
47 TH2=RTH2=(-RELOAD_VALUE)>>8;
50 ET2=1; // enable timer interrupts
54 LcdLPutString(0, "Testing timer2");
55 LcdLPutString(2, "ms: ");
59 LcdLPrintf (2 + (4<<8), "%ld", ms);
60 if (seconds!=oldSeconds) {
61 printf ("%02d:%02d.%02d\n\r", (int)seconds/3600,