#avr Logs

Jul 11 2017

#avr Calendar

12:25 AM day is now known as daey
03:13 AM AndreeeCZ: hello all! I have an atmega2560. Is it possible to use UART pins but if they are not connected, they would not give random noise signal? A pulldown/up on uart pins or something
03:53 AM Thrashbarg: AndreeeCZ: I believe if you set the relevant bits in the PINx register to 1 it'll enable the pullups
03:54 AM Thrashbarg: er PORTx
04:29 AM Emil: Hmm
04:29 AM Thrashbarg: hmm?
04:30 AM Emil: I remember reading that if you enable usart it disables port and so on registers
04:30 AM Emil: but I might be wrong
04:30 AM Thrashbarg: yes I remember that, but I *think* the pullup registers work outside that??
05:41 AM Emil: Probably
05:41 AM LeoNerd: Ohman the rules are comlpex and differ per chip and per periph
05:42 AM LeoNerd: Some peripherals sometimes override just output value and you have to set DDR, sometimes they do both
05:42 AM LeoNerd: Also some chips have a dedicated PUE register separate from the PORT
06:05 AM Emil: pwm is notorious for having to set ddr
06:05 AM Emil: PUE?
06:06 AM Emil: Pin Update Enable?
06:06 AM NoHitWonder^: pull up enable?
06:06 AM Emil: ah
08:11 AM Emil: Hey ho
08:11 AM Emil: My thermocouples arrived, too
08:12 AM Emil: They do look nice
08:12 AM Emil: And feel <3
08:12 AM Emil: Absolutely kawaii
08:12 AM Emil: :3
08:15 AM kre10s: I need to use the ROR instruction. anyone know how to make the inline assembly thingy in C?
08:34 AM kre10s: I want to use asm ( "ROR %0" : "=r" (x) : "0" (x)); Does that look ok?
08:34 AM kre10s: What happens to the carry flag etc. does gcc know that those get clobbered?
08:36 AM Emil: It's all detailed in the instruction set datasheet
08:38 AM Emil: What did you use for k type thermocouples?
08:38 AM Emil: Hmm
08:39 AM Emil: these amplifiers are expensive
08:39 AM kre10s: I doubt the instruction set datasheet will tell me how gcc works.
08:39 AM Emil: ...
08:40 AM Emil: The carry flag is hardware
08:40 AM Emil: it's detailed in the datasheet
08:41 AM kre10s: yes and it says Z,C,N,V get modified. so the real question is, how do I tell gcc that.
08:41 AM Emil: Why should you?
08:42 AM kre10s: Cus if i tell gcc to use asm("ROR ..."); I need to make sure it knows the flags might change
08:43 AM kre10s: http://www.nongnu.org/avr-libc/user-manual/inline_asm.html conveniently has an example for SWAP, but swap doesn't touch the flags...
08:44 AM Emil: kre10s: ...
08:44 AM Emil: kre10s: don't write code that goes in the middle of checking for flags :D
08:47 AM kre10s: Why gee Emil. I didn't think of that!
09:47 AM day_ is now known as daey
10:46 AM xentrac: Emil: you can't tell what code GCC is going to generate around your inline assembly; you have to tell it what registers and flags you're clobbering
10:46 AM xentrac: unfortunately I don't know the answer either
10:47 AM twnqx: kre10s: generally speaking, changing flags doesn't matter
10:47 AM twnqx: unless it's the interrupt enable flag or somethng like that.
10:54 AM JanC is now known as Guest50617
10:54 AM JanC_ is now known as JanC
11:19 AM Emil: xentrac: it doesn't break the order of execution
11:37 AM xentrac: Emil: generally speaking, GCC reorders instructions to a very surprising degree on amd64. I haven't ever noticed it doing that on AVR
11:37 AM xentrac: but that doesn't mean it never will
11:54 AM Emil: xentrac: it does, but the intended order remains
12:42 PM day_ is now known as daey
12:48 PM cehteh: avr's doesnt need reordering, they dont have (long) pipelining and multiple ALUs
12:49 PM cehteh: not much reordering i meant, some may benefit
01:03 PM xentrac: cehteh: what kinds of assembly would benefit from reordering?
01:03 PM cehteh: on what processor?
01:03 PM xentrac: on any AVR
01:04 PM Emil: When you have existing values in registers
01:04 PM cehteh: you can optimize register usage by reordering
01:05 PM Emil: Especially if they are calculated values
01:05 PM cehteh: yes
01:05 PM Emil: xentrac: you know fft?
01:05 PM xentrac: I haven't implemented the FFT, no
01:05 PM Emil: but you know it
01:05 PM xentrac: just the FWT
01:05 PM xentrac: yeah
01:05 PM Emil: fwt?
01:05 PM Emil: Anycase
01:06 PM Emil: you know why fft is fast
01:06 PM Emil: ?
01:06 PM xentrac: compared to the brute-force DFT? because it only needs lg N passes instead of N passes
01:07 PM xentrac: the Fast Walsh Transform has the same property but gives you a decomposition onto Hadamard/Walsh basis functions instead
01:07 PM Emil: It's because you don't have to calculate the same things over and over again
01:09 PM Emil: Hmm
01:10 PM Emil: I wonder if, given smart enough compilers, they could figure out FFT on their own
01:10 PM xentrac: the DFT doesn't calculate the same things over and over again in any obvious way
01:10 PM xentrac: the brute-force one, I mean
01:11 PM xentrac: I mean, each dot product is with a different basis function. They're even orthogonal basis functions, so you can't even linearly combine them to get another value
01:12 PM Emil: yes it does
01:13 PM xentrac: Well, in a very subtle way, yes; but not in any obvious way
01:13 PM xentrac: It's not like the wavelet transform
02:19 PM Mali- is now known as Mali
02:28 PM pwillard is now known as pwizard
04:35 PM Jartza: Emil: ha, got my thermocouples, and max31855k chips
04:35 PM Jartza: I have shitload of these 16x2 LCDs, so probably gonna use those with it
04:38 PM cehteh: not opv?
04:38 PM Emil: Jartza: donate me a few :3
04:38 PM Emil: Or just one
04:58 PM Jartza: cehteh: probably not, at least not for the first version
04:58 PM Jartza: Emil: just got 3 of the max-chips as they seem to be expensive as hell :(
04:59 PM Jartza: hoping not to waste them, as you need one for each thermocouple
05:05 PM twnqx: hope they match the type of your thermocouples then :P
05:05 PM Jartza: yes
05:06 PM Jartza: they are max31855k and I have k-type thermocouples :)
05:50 PM Tom_itx: why not use pt100 or pt1000?
05:55 PM Jartza: thermocouples are better
05:55 PM Jartza: also my kamado goes up to 400°C
05:55 PM Tom_itx: what application?
05:55 PM Tom_itx: so do pt sensors
05:57 PM Jartza: sure, but calibrating them is sometimes pain
05:57 PM Jartza: and I wanted to try thermocouples
05:57 PM Jartza: and the thermocouple probes I have seem to be pretty nice quality-wise
05:58 PM Jartza: also, quick test of reading them with arduino seems to work
06:00 PM Jartza: so why not
06:27 PM Jartza: oh well
06:27 PM Jartza: those other types of thermocouples might not be that good
06:27 PM Jartza: but the "meat probe" type seem to be pretty nice
06:28 PM Jartza: the other ones give negative values for some reason, haha
07:18 PM Jartza: ah lol... it just had plug colors reverse marked
08:01 PM JanC_ is now known as JanC