#avr | Logs for 2016-03-12

Back
[02:37:57] <Emil> How can I minimize interrupt latency while coding in C?
[03:38:10] <julius> would i see such problems with a multimeter or do they happen quicker?
[03:38:54] <julius> Emil, example code would be nice, pastebin.ca - unckeck run code before pasting
[03:40:26] <julius> Casper, but thats a good tip, never thought about a minimum load. i also got a older 12v car bulb lying around...will try it later
[03:40:55] <julius> althoug i guess the water pump wouldnt mind about a few volts more or less
[04:46:55] <Jartza> Emil: use as few variables you can. if you're really adventurous, use naked ISR, but most often you can only then handle IO registers in your ISR. also if you use naked ISR, make sure to check out the disassemby and push manually all registers you might need. won't recommend this path, though
[05:45:54] <Emil> julius: it is a general question, a problem with default settings saving pretty much every temporary register, used or not, when an interrupt happens
[05:46:44] <Emil> Jartza: interesting points
[06:27:28] <Jartza> yea. naked interrupt doesn't push anything by default
[09:58:56] <lorenzo> unsigned char i2c_rep_start(unsigned char address)
[09:58:57] <lorenzo> {
[09:58:57] <lorenzo> return i2c_start( address );
[09:58:57] <lorenzo> }
[09:58:58] <lorenzo> ha
[09:59:05] <lorenzo> so I take a repeated start is just .. send start again :D
[11:11:52] <cehteh> are there any avr's with 6-12 io pins? as far i see there is some gap, smalö tinys have 4 to 6 ios, bigger ones have 16 ios
[11:13:43] <cehteh> ah nevermind fund them
[11:14:14] <lorenzo> there's 14 too iirc
[11:14:15] <lorenzo> the 741
[11:14:23] <lorenzo> *841
[11:14:59] <Casper> julius: the water pump may not care, but the psu undervoltage protection may care
[11:16:00] <Casper> julius: most psu are mostly regulating from the 5V line, no load on it, no regulation. Load the 12V? it can drop to 8V or even lower
[11:16:00] <cehteh> tiny84
[11:21:07] <Jartza> cehteh: attiny85
[11:21:09] <Jartza> oops
[11:21:19] <Jartza> never mind, seems I was lagging a bit
[11:21:23] <Jartza> attiny84 was what I meant
[11:21:27] <cehteh> yes
[11:21:31] <Jartza> and 841, if you need real uart
[11:21:32] <cehteh> found that :D nice lag
[11:21:59] <Jartza> cehteh: well, I started writing and then 5 line of text came to screen as a burst :)
[11:22:37] <cehteh> you implemented IRC oon a tiny6? :D
[11:22:43] <Jartza> heh
[11:22:54] <Jartza> could implement one on attiny85
[11:23:00] <Jartza> irc-client
[11:23:11] <Jartza> 16x2 LCD and ... no, wait. stop.
[11:23:13] <Jartza> :D
[11:23:22] <cehteh> 841 ... then you can add vga
[11:24:49] <lorenzo> 841 has fairly low memory iirc
[11:25:05] <lorenzo> 128 Bytes
[11:25:32] <cehteh> oh ok
[11:25:36] <cehteh> low res then
[11:29:40] <Jartza> wut
[11:30:01] <Jartza> attiny841 is like attiny84 but with UART and I2C slave
[11:30:31] <Jartza> oh. another bug in atmel website
[11:30:44] <Jartza> datasheet says 512 Bytes Internal SRAM
[11:30:54] <Jartza> 8K Bytes of In-System Programmable Flash Program Memory
[11:31:01] <PoppaVic> remember now, it's "usart"
[11:31:33] <Jartza> seems so. I remembered 841 had only UART, but you're right
[11:31:47] <cehteh> http://www.flightradar24.com/data/airplanes/d-efhn/#91270ae lol
[11:38:43] <Jartza> heh. someone is having fun
[11:59:26] <julius> Casper, i see
[12:06:13] <julius> so P=U*I I=P/U I=55w/12v=4.5a R=U/I=12v/4.5a=2.666 does this mean my car bulb got a resistance of 2.6ohm? how do you get from there to what the bulb uses with 5v? it barely lits up at 5v
[12:10:22] <julius> is it P=U^2/R=5^2/2.666=9.6w
[13:04:11] <cehteh> julius: lightbulbs have varying resistance, when the filament heats up resistance increases
[14:34:46] <julius> great
[14:56:13] <julius> https://www.mikrocontroller.net/wikifiles/0/01/Motor_PWM1_real.gif <- wouldnt Q2 always be on in this ciŕcuit?
[15:04:47] <Thrashbarg> looks like it's an active load for a Baker Clamp
[15:04:50] <Thrashbarg> https://en.wikipedia.org/wiki/Baker_clamp
[15:17:41] <julius> ah thats how that part is called
[15:17:54] <julius> i was more worried about why Q2 is off when Q1 is on
[15:18:07] <julius> but i guess speedevil in #electronics cleared that up
[15:27:05] <Casper> julius: Q2 is in voltage foillower mode, emitter = base - 0.7V
[15:30:38] <cehteh> julius: huh
[15:30:52] <cehteh> it is inverting
[15:45:20] <julius> when Q1 is on, all the voltage drops over R1 - is that right?
[15:49:48] <Casper> yes, basically 0V at Q1:B
[15:49:55] <Casper> so Q2:E is 0V out
[15:50:03] <Casper> also
[15:50:30] <Casper> Q3:G now get grounded via D1 and Q1:C
[15:53:58] <julius> yeah i see that the gate gets pulled to 0v when q1 is on
[15:55:36] <Casper> it's a kinda crappy driver, but for a motor it's fine
[15:55:52] <Casper> I wouln't use that for a smps, too slow :D
[16:08:10] <julius> i already ordered a half bridge driver, but i still want to understand this
[16:09:04] <julius> now theres a baker clamp in that circuit, like here: http://home.mira.net/~gnb/audio/bakerclamp.html
[16:12:43] <Casper> c'mon! come here and party! :D
[16:13:37] <Casper> for once I'm alone... so home theater ampli is at -3.5db, 700WRMS + 350W sub, so must be in the 500-600W range, everything shake :D
[16:14:28] <julius> sounds good
[16:14:36] <julius> try something from ensiferum
[16:14:56] <julius> heavy/power metal
[16:15:04] <julius> let me look for the right track
[16:15:38] <julius> ensiferum - iron - into battle
[16:15:48] <julius> nice deep bass in the beginning
[16:16:38] <Casper> can't be as bassy as Basotronic - Bass I Love You
[16:16:51] <Casper> the cone want to fly out :D
[16:19:07] <julius> sure there are better sons
[16:19:08] <julius> songs
[16:19:17] <julius> that one is only good if you like guitars
[16:20:06] <julius> what kind of music do you listen to?
[16:22:59] <Casper> a bit of everything
[16:23:08] <Casper> right now, X-Japan: the last live
[16:26:54] <Casper> the room acoustic is the worst possible... but I love my HT :D
[16:28:02] <julius> what kind of music is that
[16:32:00] <Casper> metal, double basedrum
[16:32:20] <Casper> and a dead member, found hung on his hotel door knob...
[16:36:22] <Casper> NAS -> router -> wifi -> cellphone -> slimport to hdmi -> HT ampli -> TV and it work fine :D
[16:45:42] <Casper> julius: switched to greenday
[16:45:52] <julius> good luck with that ;)
[16:45:54] <Casper> julius: http://i.imgur.com/G0JKYUt.jpg
[16:46:19] <julius> what kind of metal? i just recently got primal fear - rulebreaker
[16:46:21] <julius> very nice
[16:46:42] <Casper> there is 2 of those side speakers in the back too
[16:46:58] <julius> na, thats way to clean for me
[16:47:12] <Casper> what too clean?
[16:47:26] <Casper> no wire? :D
[16:47:37] <julius> but i believe you that the wood must be feeling like theres a earthquake
[16:48:24] <Casper> basement
[16:48:34] <julius> http://www.kalimu.de/catalog/images/233890.jpg how do you call that?
[16:49:00] <Casper> plastic electric junction box?
[16:51:13] <julius> ah yes
[16:54:09] <Casper> so, floor is concrete, felt submembrane then that laminated 10mm floor...
[16:54:54] <Tom_itx> felt?
[16:54:58] <Tom_itx> really?
[16:55:11] <Casper> walls... concrete, 1" white styrofoam (the ball kind), presswood "studs", prefinished wall (1/8")
[16:55:49] <Casper> the felt is basically to cover the small imperfection in the concrete. it have a vapor barrier too
[16:57:04] <Tom_itx> they use that thin whiteish packing material down here for that
[16:57:28] <Casper> there is different type
[16:57:54] <Casper> for wood floor, they use a foam
[16:58:11] <Casper> for concrete, the manufacturer require that kind it seems
[16:59:00] <Casper> so... you can imagine the acoustic...
[16:59:17] <Casper> the ceiling is some stapled 1/4" cardboard like tiles
[17:00:21] <Casper> Tom_itx: actually... it look to be recycled fabric... actually, thinking about it.... it really look like the felt under the car carpet...
[17:13:30] <julius> the next motherfucker who writes happily "i wrote a arduino library for sht21" i will dick slap
[17:13:39] <julius> why cant they just write code for avr
[17:15:51] <Casper> because... what is an avr?
[17:16:04] <Casper> most don't even know that avr is what is on the board
[17:17:18] <julius> you know what i mean
[17:17:27] <julius> they mix up the code with the arduino libs
[17:28:01] <Casper> yup
[17:34:26] <Tom_itx> ardweenie libs are way too bloated
[17:45:34] <julius> so you have two learn the new thing and the arduino libs
[18:38:27] <julius> found two different functions to write to a i2c device: http://pastebin.ca/3399261
[18:38:40] <julius> one uses a target address, the other doesnt....why not?
[18:40:14] <julius> ah wait, my mistake: later on he does: TWIWrite((EEDEVADR)|(uint8_t)((u16addr & 0x0700)>>7));
[18:40:17] <julius> very cryptic
[18:42:27] <lorenzo> julius: I like https://github.com/g4lvanix/I2C-master-lib
[18:52:14] <julius> thanks
[18:52:34] <Lambda-Aurigae> http://homepage.hispeed.ch/peterfleury/avr-software.html
[18:52:37] <Lambda-Aurigae> I use the one from here.
[18:53:07] <lorenzo> yeah, I've tested them both before settling on the former
[18:53:14] <lorenzo> I just like the lowercase naming convention more :D
[18:53:21] <lorenzo> but they're identical code-wise
[18:57:25] <Lambda-Aurigae> I think fleury's is older.
[19:19:42] <julius> i get: /home/julius/code/avr/bluetooth+i2c+sht21-humidity-temperature/atmega32/simple2.c:197: undefined reference to `SHT21ReadData_f32'
[19:20:14] <julius> grep SHT21ReadData_f32 * says: SHT21_Functions.h: f32 SHT21ReadData_f32(u8 TypeOfData_u8);
[19:20:36] <julius> and in my main.c file i got: #include <SHT21_Functions.h>
[19:20:56] <julius> simple2.c i mean
[20:11:51] <julius> ah great, need to compile the source files together
[20:12:22] <PoppaVic> cp file1>file2
[20:34:15] <Lambda-Aurigae> Jartza, a quote for you, “If it ain’t broke, it doesn’t have enough features yet.”
[20:34:49] <PoppaVic> "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
[20:35:09] <Lambda-Aurigae> What's the opposite of debugging?
[20:35:11] <Lambda-Aurigae> Programming!
[20:35:43] <PoppaVic> you forgot... Marketing!
[20:35:55] <PoppaVic> (also Management!)
[20:45:23] <julius> thats a line of code he writes: if (!WriteI2C_b(SHT21_SLAVE_ADDRESS, 1, &TypeOfData_u8)) and he dares to comment it with //read data
[20:46:38] <lorenzo> ugh
[20:53:13] <cehteh> sometimes code comments are problematic :D
[20:53:52] <Lambda-Aurigae> code obfuscation by mis-commenting.
[20:54:07] <PoppaVic> "This walks the dog."
[21:01:08] <cehteh> well !Write... might be reading :)
[21:01:43] <julius> apparently you have to write some data to the i2c device to let it know what you want to read later on
[21:01:52] <julius> but still, that code comment for that line is totally bogus
[21:28:00] <Evidlo> Can you do bitwise OR operations in a #define?
[21:28:46] <PoppaVic> #define(a,b) a|b
[21:29:05] <PoppaVic> sorry
[21:29:10] <PoppaVic> #define FOO(a,b) a|b
[21:29:21] * PoppaVic had a brainfart
[21:29:41] <PoppaVic> senior-moments
[21:37:32] <Xark> PoppaVic: Hello. :)
[21:55:02] <Tom_L> http://tom-itx.no-ip.biz:81/~webpage/avr/c_bits/bits_index.php
[21:55:34] <Tom_L> evidlo, ^^
[21:56:24] <Tom_L> #define bit_get(p,m) ((p) & (m))
[21:56:24] <Tom_L> #define bit_set(p,m) ((p) |= (m))
[21:56:24] <Tom_L> #define bit_clear(p,m) ((p) &= ~(m))
[21:56:24] <Tom_L> #define bit_flip(p,m) ((p) ^= (m))
[21:56:24] <Tom_L> #define bit_write(c,p,m) (c ? bit_set(p,m) : bit_clear(p,m))
[21:56:25] <Tom_L> #define BIT(x) (0x01 << (x))
[21:56:27] <Tom_L> #define LONGBIT(x) ((unsigned long)0x00000001 << (x))
[21:56:49] <Tom_itx> are your common bit macros
[22:01:56] <cehteh> note that AVR's can do bit flips in hardware on I/O registers