#avr | Logs for 2015-12-14

Back
[00:05:09] <Casper> so this input capture in the timer...
[00:05:34] <Casper> can it reset the timer on one edge?
[00:05:45] <Casper> or need to do it in software?
[00:35:25] <Casper> hmmm there is no bit array in avr isn't it? (I can always dream, no?)
[00:44:31] <rue_house> #define inBounds(v, l, h) ((v) > (h)) ? (0) : ((v) < (l)) ? (0) : (1)
[00:48:13] <rue_house> hmm I idn't make it inclusive
[00:58:32] <Casper> hmmm the input capture work only on a single edge?!?
[00:58:43] <rue_house> no
[00:58:46] <rue_house> er, no
[00:58:55] <rue_house> you program if its rising, falling or both, iirc
[01:01:34] <Casper> I didn't saw a both option (it's a single bit) but maybe another register have the option...
[01:01:46] <Casper> or maybe I need to flip it in the interrupt
[01:02:44] <Casper> ah found some pseudo code
[01:03:02] <Casper> need to flip the bit
[01:05:07] <Casper> so... on falling edge, reset timer value. on rising edge do stuff
[01:51:23] <Casper> yay! I get some high low on my screen! whoot
[01:58:20] <Casper> now, to mesure the pulses...
[02:43:18] <Casper> ... I'll need a real IR module it seems...
[02:43:29] <Casper> the signal is dirty, and I get corruption :(
[03:21:29] <Jartza> or signal-washer
[06:52:12] <merethan> Hi all
[06:53:39] <merethan> I'm trying to do a reset using CCP = CCP_IOREG_gc; RST.CTRL = RST_SWRST_bm; and wdt_enable(WDTO_15MS); while(1); but both of them don't work. What might be the problem?
[06:54:14] <merethan> (Both methods are preceded by a cli(); to disable interrupts.)
[06:57:03] <Tom_itx> that looks like ardweenie gook
[06:57:53] <Lambda_Aurigae> actually, looks to me to be right out of the datasheet.
[06:59:23] <Haohmaru> looks to me like xmega
[06:59:30] <Lambda_Aurigae> yup.
[06:59:34] <merethan> It is xmega yes.
[06:59:44] <Haohmaru> xmega iz moar mega
[06:59:47] <Lambda_Aurigae> http://www.avrfreaks.net/forum/software-reset-xmgea128a1
[06:59:54] <merethan> xmega has a register to do a reset from software.
[07:00:44] <Lambda_Aurigae> post #6
[07:01:43] <Lambda_Aurigae> I need to get a big xmega to play with one of these days.
[07:02:22] <merethan> Lambda_Aurigae: I believe that's what I posted is it not?
[07:02:45] <merethan> (by posted I mean pasted in my question in this channel)
[07:02:46] <Lambda_Aurigae> did you do the defines at the beginning?
[07:03:56] <Lambda_Aurigae> maybe I don't need to get an xmega...only 32MHz?
[07:03:59] <Lambda_Aurigae> blah.
[07:03:59] <merethan> Those defines are from io256a3bu.h, shipped along with WinAvr / Atmel Studio.
[07:04:18] <merethan> I have those defines yes.
[07:04:26] <Lambda_Aurigae> possibly they are misdefined?
[07:05:06] <merethan> No I checked.
[07:05:30] <merethan> I bet Timothy01 from the forum actually copied those values from the file shipped by Atmel.
[07:45:03] <merethan> In the forum thread Lambda_Aurigae suggested there was also someone poiting out the difference between RST.CTRL = RST_SWRST_bm; and RST.CTRL |= RST_SWRST_bm;
[07:45:18] <merethan> I tried the second one too but no luck.
[07:47:45] <Haohmaru> what about the configuration protection register thing?
[07:48:28] <Haohmaru> no idea about the reset, but you have to deal with that when doing certain things like setting the clock settings
[07:48:57] <Haohmaru> so maybe the reset registers are also protected in that way and you can't just set them without dealing with that other thing
[07:50:36] <Haohmaru> oh duh.. you got that covered.. CCP ..
[07:50:41] <Haohmaru> sorry ;]
[10:55:59] <julius> hi
[10:57:37] <julius> is it possible to use a led strip with a ws2812 controller and have the leds fade in/fade out with a avr? theres a c library for that controller here: https://github.com/cpldcpu/light_ws2812
[10:58:42] <julius> the controller allows you to control each led individually
[10:59:22] <LeoNerd> WS2812 gives each colour channel an 8bit PWM control
[10:59:26] <LeoNerd> So yes, fading should be possible
[12:06:12] <anonnumberanon> Hello if i have an ISR set to fire every 1 ms and in the main program i have a while(counter == 0){}. If in the ISR I make it change the counter to value 1 after a while, does that mean that in the main program, that will effectively break out of the while loop?
[12:07:21] <LeoNerd> What is counter ?
[12:07:34] <anonnumberanon> any variable to use as flag
[12:08:03] <anonnumberanon> boolean let's say
[12:08:07] <LeoNerd> Right. But what kind of variable?
[12:08:19] <anonnumberanon> global variable
[12:08:29] <LeoNerd> What kind of variable?
[12:08:31] <LeoNerd> What type?
[12:08:34] <LeoNerd> Is it volatile?
[12:08:50] <anonnumberanon> sure
[12:08:55] <Tom_itx> it better be if you're using it in an isr
[12:09:11] <anonnumberanon> really?
[12:09:18] <anonnumberanon> else the compiler will ignore it?
[12:09:41] <Tom_itx> it doesn't know when the isr will update it otherwise
[12:16:10] <anonnumberanon> I see.
[12:30:39] <julius> LeoNerd, thx
[14:48:29] <julius> https://github.com/adafruit/Adafruit_NeoPixel/blob/master/examples/strandtest/strandtest.ino looking at this code, wouldnt you need to define your avr cpu / mhz?
[14:58:03] <julius> ok, that code was written for arduino, but should work on a avr
[15:31:42] <Jartza> julius: I think arduino "IDE" does that for you
[15:32:01] <Jartza> but yes, F_CPU needs to be defined
[15:40:09] <julius> i just bought a raspberry, im gonna stick with a simple atmega8/16 for now
[15:40:34] <julius> without using arduino i probably also need MCPU?
[15:40:40] <julius> in the makefile
[15:49:14] <Jartza> yeah
[16:31:42] <Arch-TK> So (pardon my absolutely noobish question, I am not an EE) how exactly do you reliably debounce in-firmware (If that makes any sense)?
[16:38:02] <Krampus> Arch-TK: read the input and then sample until it stabilizes.
[16:38:28] <Krampus> Arch-TK: Instead of "button input going high," it's "button input goes high for 50ms."
[16:38:58] <Arch-TK> That seems like the obvious answer, now I've previously just looped until I got a steady output and then considered that to be the state, I guess that's a sensible approach right?
[16:39:08] <Arch-TK> s/output/input/
[16:44:00] <Arch-TK> I guess I was expecting a less obvious answer, never mind me.
[20:20:40] <anonnumberanon> Arch-TK, so what happens when your program reads a high that is caused by switch bounce and is not really a real high?
[20:23:54] <Lambda_Aurigae> Arch-TK, let me get you a link that I just read.
[20:24:22] <Lambda_Aurigae> http://hackaday.com/2015/12/09/embed-with-elliot-debounce-your-noisy-buttons-part-i/
[20:24:39] <Lambda_Aurigae> http://hackaday.com/2015/12/10/embed-with-elliot-debounce-your-noisy-buttons-part-ii/
[20:25:05] <Lambda_Aurigae> couple of nifty little articles that just came through my rss feeds in the last couple of days.
[20:34:14] <rue_shop2> I wasn't supposed to overwrite the arduino firmware on this avr...
[20:43:43] <Lambda_Aurigae> yes you were.
[20:43:48] <Lambda_Aurigae> arduino firmware is evil.
[20:57:20] <DKordic`> Enter.