#avr Logs

Jun 20 2019

#avr Calendar

02:13 AM gsi__ is now known as gsi_
05:15 AM day__ is now known as day
06:24 AM janco_ is now known as janco
07:07 AM cehteh: https://www.youtube.com/watch?v=1BB6wj6RyKo mwhahahaha
11:06 AM Arch-TK is now known as atk
11:10 AM aidos_ is now known as aidos
01:03 PM atk is now known as tk-
01:03 PM tk- is now known as atk
01:36 PM [1]MrMobius is now known as MrMobius
02:59 PM Non-ICE: string stored i char array to float? how to?
02:59 PM Non-ICE: trying strtof but no go...
02:59 PM Non-ICE: stdlib.h is included
02:59 PM Non-ICE: afaik... but its not syntax highlighting?
04:02 PM cehteh: Non-ICE: just do not use floats, done
04:04 PM Non-ICE: dont use String
04:04 PM Non-ICE: dont use floats
04:04 PM cehteh: yeah :)
04:05 PM Non-ICE: you know i solved it by using string class to make it a float?
04:05 PM Non-ICE: what to use then?
04:05 PM cehteh: char[] char*, integers
04:06 PM Non-ICE: my value is 5.23647283
04:06 PM cehteh: thats not a float
04:06 PM Non-ICE: why would i want to intger that?
04:07 PM cehteh: because its more exact
04:07 PM Non-ICE: i could make it a double
04:07 PM cehteh: avr's dont have float support in hardware
04:07 PM LeoNerd: Ohgod, floats on an AVR. I only ever did it once, and that was just because I needed to convert µV into dBµV
04:07 PM cehteh: you need truckloads of slow software emulation for floats
04:07 PM Non-ICE: im doing the calculations on the float once every 10 seconds,, speed is not an issue
04:08 PM LeoNerd: Yeah; mine's just a few per second for a voltmeter display, so it's fine
04:08 PM cehteh: still floats is not about decimal pount and the fractional part behind
04:08 PM Non-ICE: and if i wansnt a lazy coder i could do the float math just once every 2 hours
04:08 PM Non-ICE: it is for a display
04:08 PM cehteh: just store in an fixed point integer
04:09 PM cehteh: 523647283
04:09 PM Non-ICE: i hear ya, just not on the current issue
04:09 PM LeoNerd: There's some algorithms for doing log that might port nicely to scaled integer maths
04:09 PM cehteh: yeah but will bite you someday
04:09 PM Non-ICE: err current project
04:09 PM LeoNerd: They mosly involve a lookup table with a few rounds of successive approximation
04:54 PM Kliment: LeoNerd: multiplying a softfloat by a constant<1.0 is often faster on the AVR than integer division
04:54 PM LeoNerd: Hrmreally?
04:55 PM Kliment: Yeah - no hardware divider, iterative subtraction is slow
04:55 PM LeoNerd: If it's an integer constant division then gcc will handle that
04:55 PM Kliment: Whereas the softfloat multiply is slow, but constant time
04:56 PM Kliment: No, I mean variable divided by constant
04:56 PM LeoNerd: y = x / A ==> y = (x * B) >> C for some chosen B and C from A
04:56 PM LeoNerd: Yah
04:56 PM LeoNerd: I believe gcc does that now
04:56 PM cehteh: wost of all is float division
04:56 PM LeoNerd: For example the classic case of int8 x / 10 becomes (x * 204) >> 11
04:56 PM LeoNerd: er.. 205
04:56 PM Kliment: float division can often be optimized to float multiplication
04:57 PM cehteh: if one side is ocnstant
04:57 PM Kliment: LeoNerd: Multiplication on the avr is also pretty slow
04:57 PM cehteh: if not you lost
04:57 PM LeoNerd: It's fast enough on AVRs with real multiply unit
04:58 PM Kliment: LeoNerd: Am I remembering correctly that only some of them have that?
04:58 PM LeoNerd: Most these days. apart from old Attinies
05:29 PM cehteh: unfortunally attinys have some cool features on their own not (or not often) seen in atmega
05:30 PM cehteh: differential adc, 64Mhz PLL and counter (making them run at 16mhz from internal OSC, take that atmega)
11:54 PM rue_mohr: hmm 0.996, not bad