#avr Logs

Nov 10 2017

#avr Calendar

04:52 AM Jartza: nuxil: octapentaveega is not magic, it's just carefully crafted code to show what the chip is capable of ;)
06:45 AM Jartza: paul_: there is fuse in attiny that allows self programming, but there is no protected areas in tiny so bootloader needs to handle that it's not overwriting itself :)
07:44 AM polprog: lol: https://paste.debian.net/994991/
07:44 AM polprog: messing with pointers in c
07:44 AM nuxil: you have to much spare time :p
07:45 AM polprog: im geting a better understanding of how they work
07:51 AM nuxil: well thats just confusin. pointer to a pointer to a pointer ... :p
07:51 AM polprog: it's pointers all the way down
07:53 AM nuxil: i find using a func best way to understand pointers/referances. example. int whatever(int *x) {*x=1;}; int a=0; whatever(&a);
07:54 AM polprog: yeah
07:55 AM polprog: im reading a copy of K&R's C book
07:57 AM nuxil: i dont have any C books. i got a couple of C++ books.
07:57 AM nuxil: but i dont like C++. its a monster
07:59 AM polprog: nuxil: one of this channel's long term residents has a copy of the C book on his web server
07:59 AM polprog: go search
07:59 AM polprog: ;)
08:00 AM nuxil: lol.. like looking for a needle in a haystack
08:00 AM polprog: it's fun
08:00 AM nuxil: who is this "long term resident" im suppose to goole for ? you ?
08:00 AM nuxil: :åp
08:01 AM polprog: not me
08:01 AM polprog: and not google for ;)
08:01 AM nuxil: og so there is 162 else it could be :p
08:01 AM nuxil: we are 164 in the channel. its not me and you :p
08:23 AM rue_bed: polprog, in order to create a true mess you need a 4d stacked pointer memory array m
08:27 AM Thrashbarg: m
09:57 AM JanC is now known as Guest54856
10:52 AM daey: shouldnt this be enough to trigger an interrupt on input change on PB0 PCINT0 - atmega328p http://dpaste.com/290A54V
10:57 AM daey: correction http://dpaste.com/3EZ3E14 (still not working)
11:13 AM LeoNerd: What's "pull down"?
11:13 AM LeoNerd: There aren't pulldown resistors. There's pullups
11:13 AM daey: yeah
11:13 AM LeoNerd: The usual strategy is you enable the internal pullup resistor, then attach a switch to ground
11:13 AM daey: so not pulling it up leaves it floating?
11:14 AM LeoNerd: Probably
11:14 AM daey: i wasnt sure thats why i made that remark there for future debugging. but i doubt thats my issue as simply reading the pins state works fine
11:14 AM daey: but the interrupts arent triggered no matter what i try
11:15 AM LeoNerd: You almost certainly also want to get into the habit of using _BV(...)
11:15 AM LeoNerd: I find it looks neater, anyway
11:15 AM LeoNerd: But anyhow, that ought to be sufficient. set the bit in PCIMSK0, turn on PCIE0, sei()
11:16 AM daey: yeah ive seen it a few times. wasnt sure if its something the users did themselves or if its predefined in one of the headers
11:16 AM cehteh: some tinys name some ISR's different than other avr's
11:17 AM daey: the isr should be ok i checked the name in the datasheet
11:17 AM daey: urg thanks
11:17 AM daey: its PCINT16 not PCINT0
11:17 AM daey: :')
11:22 AM cehteh: ...
11:23 AM daey: that being said. what is the correct interrupt vector for PCINT16?
11:24 AM daey: ive read that some of them generate a common interrupt. but the only interrupt with a fitting name would be PCINT_vect which only exists on some attinys
11:24 AM cehteh: dunno what part do you have there see datasheet
11:24 AM daey: 328p
11:25 AM cehteh: also you need to set the correct level and not all levels work in all sleep modes iirc (i dont have the datasheet open now)
11:25 AM daey: well im not sleeping
11:26 AM cehteh: just read datasheet again :D, i dont remember the details right now
11:26 AM cehteh: try some loop code polling the pin, does that see the pin change?
11:26 AM daey: yeah that works fine
11:51 AM daey: i moved my wiring to PCINT1 which seems easier to use. but its still not working. http://dpaste.com/0EG481Ahttp://dpaste.com/0EG481A
11:52 AM daey: with the commented part in the while loop instead of the interrupt it works. but with the interrupt the debug led stays off
11:53 AM cehteh: most likely you forgot to set some bit, or doing it wrong (to write to some registers you have to set some bit first to enable that writing and then set the bit within few clock cycles)
11:53 AM cehteh: dunno which ones that where, just refer to the datasheet
12:02 PM daey: im getting closer i think. "The Pin Change Interrupt Request 0 (PCI0) will trigger if any enabled PCINT[7:0] pin toggles."
12:02 PM daey: to bad that there is no PCI0 interrupt :P
01:40 PM daey: got it to work. i set the wrong bits
01:42 PM daey: i've got a design question. i was thinking of using a seperate interrupts.c file in which i put all the interrupts. now i need global volatile variables which i want to set and clear within the ISR's, which in itself isnt an issue. But i need to use these variables in other c files as well. is that even possible?
01:43 PM daey: i guess i could simply include the c-file into other c-files, but that doesn't sound right :')
01:47 PM daey: ah nvm. a simple extern is enough
01:56 PM Jartza: argh
01:56 PM Jartza: my ssh client is bonkers
02:00 PM Jartza: ah
02:00 PM Jartza: putty much better
02:02 PM Tom_itx: puttty and winscp ftw
02:03 PM daey: doesnt putty have its own scp implementation in form of pscp?
02:03 PM polprog: TeraTerm tfw
03:50 PM Ameisen: On AVR, would it be faster, when calculating the difference of two time values (and needing to handle overflow) to use signed integers for the difference (and then abs), or a branch, two's complement, and increment?
04:32 PM Ameisen: I compared the asm output of two ways of getting the time difference
04:32 PM Ameisen: https://pastebin.com/uTddadWJ
04:32 PM Ameisen: using a ternary was 23 cycles best, 28 cycles worst, and 25 bytes
04:33 PM Ameisen: using min/max was 24 cycles best, 28 cycles worst, and 25 bytes
05:06 PM Ameisen: two other formulae
05:06 PM Ameisen: https://pastebin.com/tJ2MPtyY
05:10 PM Ameisen: equivalent to time_new - time_old once resolved
06:43 PM nuxil: http://bisqwit.iki.fi/jutut/kuvat/programming_examples/obfuscated/1986_hague.c
06:43 PM nuxil: :D
11:08 PM Tom_itx is now known as Tom_L
11:30 PM day__ is now known as daey