#avr | Logs for 2015-12-12

Back
[09:51:27] <slidercrank> I've got a question. I set fuse flags using http://www.engbedded.com/fusecalc/ (using its default values). It says "Int RC Osc 9.6Mhz" and there is a checkbox [x] Divide clock by 8". So what is the frequency of the CPU? That is what should I specify in -DF_CPU= : 9.6Mhz or 1.2Mhz? (9.6 divided by 8)?
[09:52:11] <slidercrank> my uC is atiny13 if that matters
[09:52:37] <slidercrank> -U lfuse:w:0x6a:m -U hfuse:w:0xff:m
[09:52:52] <slidercrank> what is the real frequence of the uC?
[09:52:55] <slidercrank> *frequency
[10:03:33] <Lambda_Aurigae> 9.6/8
[10:03:42] <slidercrank> Lambda_Aurigae: thanks
[10:03:49] <Lambda_Aurigae> it's called....math.
[10:04:07] <Lambda_Aurigae> what is the actual internal RC oscillator frequency on your chip?
[10:04:19] <slidercrank> I know how to divide. I was not sure about the meaning of settings.
[10:04:59] <Lambda_Aurigae> they are very self explanatory in my mind.
[10:05:11] <Lambda_Aurigae> internal oscillator at 9.6MHz
[10:05:15] <Lambda_Aurigae> divided by 8
[10:05:40] <Lambda_Aurigae> I recommend reading the datasheet...it explains all the fuses in detail.
[10:06:08] <slidercrank> I will. I had no time. That's why I asked here to save some time
[10:06:58] <Lambda_Aurigae> glub...what did people do before IRC?
[10:07:06] <Lambda_Aurigae> hehe
[10:08:18] <slidercrank> what's the point of this channel if not getting help? are you accusing me of using this channel?
[10:09:15] <Lambda_Aurigae> no..
[10:09:21] <Lambda_Aurigae> I'm just an old grumpy man.
[10:09:57] <Lambda_Aurigae> and teach kids how to use microcontrollers...and one of the first things I teach them to do is read and understand the datasheets.
[10:10:28] <Lambda_Aurigae> reading comprehension is a must in all things, specially in electronics....
[10:10:34] <slidercrank> believe me, I can and I do read them. I spent a day reading them.
[10:10:54] <slidercrank> it's just that I started running out of time to read the datasheet on attiny13
[10:11:11] <Lambda_Aurigae> yeah,,no worries.
[10:29:17] <|DM|> "Are you accusing me of using this channel?" grade A 10/10 golden keks
[10:41:49] <Lambda_Aurigae> huh?
[10:46:07] <Tom_itx> troll
[10:49:28] <Jartza> heh
[10:49:39] <Jartza> my two leds are still blinking seemingly at the same tie
[10:49:40] <Jartza> time
[10:50:06] <Tom_itx> are they supposed to?
[10:50:29] <Jartza> sort of yes, made this stupid little test of context-switching multitasking for attiny85
[10:50:47] <Jartza> just two "tasks" running simultaneously, both blinking led at same speed
[10:51:04] <Jartza> https://gist.github.com/Jartza/3b869fa4b6a4afcc19b2
[10:51:05] <Jartza> this
[10:53:00] <Lambda_Aurigae> Jartza, bloat time...the ability to adjust the number of clock cycles each process gets per roundrobin.
[10:53:12] <Jartza> hehe
[10:53:12] <Jartza> https://drive.google.com/drive/folders/0B2dTzW9TMeBxSEdleHNpMm5SaDg
[10:53:14] <Jartza> yeah
[10:53:35] <Jartza> if I really want to bloat that, it should have a way to start and stop a task and selection of stack size etc.
[10:55:42] <Lambda_Aurigae> need a 3rd task!
[10:56:01] <Lambda_Aurigae> one that talks on the usart and is the overlord.
[10:56:20] <Jartza> that was more or less just an educative sample for another person who was interested what the context-switching meant
[10:56:36] <Jartza> no usart on attiny85
[10:56:37] <Jartza> :P
[10:57:34] <Jartza> although attiny85 was selected just because I had one already on breadboard, with leds :)
[10:57:47] <Jartza> it was a lazy-man-choise
[10:57:53] <Lambda_Aurigae> hehe.
[11:01:01] <|DM|> I wasnt trolling just noting on the absurdist humor I found in it
[11:04:37] <Jartza> it seems the switching speed I chose is about 4kHz
[11:08:38] <Lambda_Aurigae> |DM|, I just don't understand the "grade A 10/10 golden keks"
[11:08:43] <Lambda_Aurigae> specially the "keks" part.
[11:12:39] <Jartza> I started to think of it, I can't figure out any really good scenario where I would need context-switching on attiny85 :)
[11:13:12] <Jartza> ...except for teaching what context-switch is
[11:14:20] <Lambda_Aurigae> yeah.
[11:14:34] <Lambda_Aurigae> there are a couple of "os" implementations that do that.
[11:14:43] <Jartza> true
[11:14:52] <Jartza> http://www.femtoos.org/
[11:14:54] <Jartza> like that :)
[11:15:05] <Lambda_Aurigae> freertos too maybe?
[11:15:27] <Jartza> for attiny85? :)
[11:15:30] <Jartza> I guess not
[11:16:17] <Lambda_Aurigae> femtoos runs on attiny85.
[11:16:32] <Jartza> I once looked at the source code of femto os but it was painful
[11:17:15] <cehteh> Jartza: i'll put some into my scheduler as well
[11:17:15] <Lambda_Aurigae> yeah..it is.
[11:18:56] <cehteh> but having real tasks sounds like a pain
[11:19:01] <Jartza> https://i.imgur.com/xzc3DPO.png
[11:19:06] <Jartza> I won't bother you more with that code :D
[11:20:04] <cehteh> haha
[11:31:42] <rue_house> // for linear remapping of number ranges, see arduino map()
[11:31:44] <rue_house> // think of a line, between Il,Ol and Ih,Oh, this solves the y for given x position
[11:31:50] <rue_house> #define RangeRemap(v,Il,Ih,Ol,Oh) (((((v)-(Il))*((Oh)-(Ol)))/((Ih)-(Il)))+(Ol))
[11:33:14] <rue_house> if you make x time, and y a 1 axis position, its an interpolator.
[13:26:53] <cousteau> Hi
[13:27:27] <cousteau> a PWM value of X means that the pin will have a duty cycle of X/255, right?
[13:27:58] <cousteau> i.e. 0 will be "always off" and 255 will be "on for 255/256 of a cycle, off for 1/256"
[13:30:28] <cousteau> or is it 0 = 1/256 and 255 = 256/256?
[13:39:14] <|DM|> if the resolution is y
[13:39:17] <|DM|> and pwm value is x
[13:39:22] <|DM|> then duty cycle is x/y
[13:40:18] <cousteau> ok, so with a PWM I will never be able to achieve a 100% duty cycle, correct?
[13:41:21] <cousteau> but a PWM of 0 would be equivalent to having the pin as a regular output of 0
[14:58:51] <wondiws> hi, I've got an ATmega32, it has got 1 ADC, but 8 input pins (port A). What is the purpose of this? Can I read 8 analog devices?
[14:59:07] <Lambda_Aurigae> yes.
[14:59:09] <Lambda_Aurigae> one at a time.
[14:59:26] <Lambda_Aurigae> you select which pin is connected to the ADC then do an ADC read.
[14:59:33] <Lambda_Aurigae> then switch to the next and read
[14:59:43] <Lambda_Aurigae> wash, rinse, repeat as necessary
[14:59:51] <wondiws> Lambda_Aurigae, I can't dp free running mode I guess?
[15:00:14] <Lambda_Aurigae> not if you need to read multiple inputs, probably not....
[15:00:33] <Lambda_Aurigae> I suppose you could, really.
[15:00:36] <Lambda_Aurigae> nothing stopping you.
[15:00:53] <Lambda_Aurigae> just be careful when you read...you have to know which pin it's connected to when you read it
[15:01:01] <wondiws> Lambda_Aurigae, exactly
[15:02:05] <Lambda_Aurigae> most microcontrollers I've worked with use the same scheme....a 1-of-n analog switch hooked to a single ADC.
[15:03:37] <|DM|> I think the ADC has a small sampling capacitator that it uses as it multiplexes over the inputs
[15:04:00] <|DM|> so free running multiple inputs should be ok
[15:04:26] <|DM|> well, multiple small sampling caps
[15:04:27] <Lambda_Aurigae> never really looked into that.
[22:01:57] <Casper> So, I have a stream of bits, 4x 36 bits, sent as a 0.5/0.5ms pulse for 0 and 0.5/1.5 for 1... what would be the easiest way to grab all?
[22:12:49] <DKordic`> Casper: SPI master started by GPIO INT?
[22:16:31] <Casper> it's an IR remote
[22:19:38] <DKordic`> I don't see the whole question.
[22:20:08] <Casper> http://i.imgur.com/qxAi7hw.png <=== that is the signal
[22:20:13] <Casper> well, part of it
[22:20:52] <Casper> I want to make something to decode that...
[22:23:46] <Casper> (btw, the decoded should be 11010000110000000000011000011 and who knows what else...
[22:32:08] <DKordic`> I see no time information there. Where does the signal come from?
[22:40:57] <Casper> IR remote
[22:41:11] <Casper> with carrier removed
[22:41:51] <DKordic`> Casper: If pulses are 5ms, then use Timer with Input Capture triggered by Analog Comparator.
[22:42:18] <DKordic`> Carrier is removed by some IC?
[22:42:37] <Casper> pulses are of varying length, start bit is 8+5, 0 is 0.5+0.5 and 1 is 0.5+1.5
[22:42:47] <Casper> nope, removed the dirty way
[22:43:03] <Casper> will need to actually use a better way in the final stuff...
[22:43:09] <Casper> currently, it's dirty
[22:43:44] <DKordic`> How :) ? What is the base frequency?
[22:43:44] <Casper> IR led in parallel with 20nF cap, fed to a 3904, that feed another 3904
[22:43:51] <Casper> 38kHz
[22:44:35] <DKordic`> Casper: Lambda_Aurigae mentioned a 3 terminal IC. Why not that?
[22:44:57] <Casper> none on hand
[22:45:54] <Casper> http://i.imgur.com/IKJE6I1.jpg <=== that dirty for now...
[22:52:21] <DKordic`> So that is exactly for a Timer.
[22:59:54] <Casper> how would you decode and store that to be able then to send it via uart?
[23:28:19] <Casper> hmmm timer... on pin change, if high, reset timer, if low check timer, if total time is 10-15ms then "this is a start bit", if 2ms then 1, if 1ms then 0
[23:28:37] <Casper> yeah could work...
[23:52:14] <sabor> Casper: you could use an input capture and change the edge each time it's triggered
[23:58:34] <Casper> sabor: ?