2 * Simulator of microcontrollers (timer1.cc)
4 * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
6 * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
10 /* This file is part of microcontroller simulator: ucsim.
12 UCSIM is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 UCSIM is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with UCSIM; see the file COPYING. If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
32 cl_timer1::cl_timer1(class cl_uc *auc):
33 cl_hw(auc, HW_TIMER, 1, "timer1")
43 cl_timer1::print_info(class cl_console *con)
45 char *modes[]= { "13 bit", "16 bit", "8 bit autoreload", "stop" };
46 int tmod= uc->get_mem(MEM_SFR, TMOD);
49 con->dd_printf("%s[%d] 0x%04x", id_string, id,
50 256*uc->get_mem(MEM_SFR, TH1)+uc->get_mem(MEM_SFR, TL1));
51 int mode= (tmod & (bmM11|bmM01)) >> 4;
52 con->dd_printf(" %s", modes[mode]);
53 con->dd_printf(" %s", (tmod&bmC_T1)?"counter":"timer");
56 con->dd_printf(" gated");
57 on= uc->get_mem(MEM_SFR, P3) & uc->port_pins[3] & bm_INT0;
60 on= uc->get_mem(MEM_SFR, TCON) & bmTR1;
61 con->dd_printf(" %s", on?"ON":"OFF");
62 con->dd_printf(" irq=%c", (uc->get_mem(MEM_SFR, TCON)&bmTF1)?'1':'0');
63 con->dd_printf(" %s", (uc->get_mem(MEM_SFR, IE)&bmET1)?"en":"dis");
64 con->dd_printf(" prio=%d", uc->it_priority(bmPT1));
69 /* End of timer1.cc */