[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Simulavr-devel] Bug in simulavrxx! tccr mode switch is wrong
From: |
Klaus Rudolph |
Subject: |
[Simulavr-devel] Bug in simulavrxx! tccr mode switch is wrong |
Date: |
Fri, 09 Feb 2007 13:06:47 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.6) Gecko/20040114 |
Hi Radovid, hi all,
after I walked through your program I found a bug in simulavrxx!
in hwmegatimer.cpp you will find to lines :
switch (tccr)
please change to
switch (tccr & 0x07)
After applying the patch the irq vector is called.
I will not send you a patch file, i hope the description is good enough :-)
@Radovid:
I looked into your example code and was a bit confused. Setting multiple
bits in a single registers with an own macro
is not really a good idea. Please look in the output which the compiler
generates. The code is very very long!
One possible solution is to write it like:
TIMSK2 |= 1<<TOIE2;
OCR2A = 0;
DDRB |= 1<<DDB7;
TCCR2A |= (1<<WGM21) | (1<<WGM20) | (1<<COM2A1) | (1<<CS20);
It is much easier to read (for me) and it gives much smaller code!
You use so much macros that one line of code gives 3-5 lines of search
while looking into what is really happened.
I personally do not like this stile, but this is a philosophy :-)
So I give you a nick-name: Makronaut :-)
The bug will be fixed if the verlig patch comes in, but there are a lot
of open questions for the verilog patch.
Best Regards
Klaus