View previous topic :: View next topic |
Author |
Message |
Henrik
Joined: 14 Jul 2005 Posts: 13
|
Posted: Tue Oct 25, 2005 8:59 pm Post subject: Tiny45 and Multiplication |
|
|
Hello Friends,
let me report a little bug with the Tiny45:
Multiplication with a variabe as operand only works when the variable is dimensioned as LONG.
Example:
Dim test as word
test = 3*2 ...works
test = 2
test = test*3 ...doesnt work - result is 0
As soon as test is dim'ed as long that works correcctly. It's tricky to find such bugs, because the own programm is obviously flawless and works with other Megas and Tinys quite fine.
I would suggest to publish a list of known bugs for the new processors respectivly their Bascom regfiles.
M168 as a further example does not handle timers correctly and the clock function is out of order.
Best regards
Henrik |
|
Back to top |
|
|
oe9vfj
Joined: 17 Jun 2004 Posts: 269 Location: Austria, Hard
|
Posted: Wed Oct 26, 2005 8:37 am Post subject: |
|
|
Hi Henrik,
Tiny45 has no HW-Multiplyer, but in Dat-File this Parameter HWMUL is set to 1. Supporting of HW-Multiplying of a chip from BASCOM is now implemented for Byte and Word/Integer. So for this variable-types you get a wrong result.
Change the Line with HWMUL to
HWMUL=0
in the Dat-File.
I have no Tiny45 to try it and I haven't checked the other entries in the Dat-File.
Good Luck. _________________ regards Josef
DOS - File System for BASCOM-AVR on http://members.aon.at/voegel |
|
Back to top |
|
|
Henrik
Joined: 14 Jul 2005 Posts: 13
|
Posted: Wed Oct 26, 2005 5:58 pm Post subject: |
|
|
Hello Josef,
oe9vfj wrote: | Hi Henrik,
Tiny45 has no HW-Multiplyer, |
first of all thank you for the hint. I thought about that myself first, checked the datasheet and found there remarked that the Tiny45 has HW-multiplicaron support. So I set this idea aside.
Anyway, I changed HWMUL to 0, with the outcome, that the results are correct, but eating 82 additonal bytes flash per multiplication.
Funny enough: As soon as I changed again to a LONG type (instead of WORD), the result was still correct and the used flash despite the deactivatet WM-muktiplication back to normal.
Now one has the choice: Either wasting flash or wasting ram. In the current application I'm working on, I'm better off with wasting ram .
Not a big matter, but I'm shure that it's not only me, who would appreaciate some notes from Mark on this.
Best regards
Henrik |
|
Back to top |
|
|
oe9vfj
Joined: 17 Jun 2004 Posts: 269 Location: Austria, Hard
|
Posted: Wed Oct 26, 2005 8:07 pm Post subject: |
|
|
Hello Henrik,
I made some tests of Flash Usage and found following values.
- The MUL-Routine itself for Word/Integer needs 104 Bytes (52 Words)
- One Calling of the Mul-Routine with loading the two Word/Integers to the CPU-Registers and storing the Result back to the SRAM needs 26 Bytes (13 Words)
So use Mul needs for
1 time = 130 Bytes
2 times = 156 Bytes
3 times = 182 Bytes
and so on.
Each MUL more needs 26 Bytes.
Can you please provide a code example which give you your mentioned code usage of 82 Bytes for each MUL. _________________ regards Josef
DOS - File System for BASCOM-AVR on http://members.aon.at/voegel |
|
Back to top |
|
|
|