#avr | Logs for 2015-10-22

Back
[04:53:10] <mike_papa> Hello. I have uninstalled Visual Assist extention in my Atmel Studio 7 (don't ask why - I don't know ;). Is there any way to reinstall it? It doesn't show up as available extention, and I have even tried to uninstall and intstall Atmel Studio again - no joy.
[05:34:13] <spillere> whats a good way to convert a hex value to binary?
[06:10:57] <Lambda_Aurigae> spillere, a calculator
[06:11:10] <spillere> i mean, automatically in the code :)
[06:11:26] <Lambda_Aurigae> what format is your hex value in?
[06:11:44] <Lambda_Aurigae> how is it stored?
[06:11:57] <spillere> in a char, with 4 hex values
[06:12:50] <Lambda_Aurigae> https://github.com/thvdburgt/KnR-The-C-Programming-Language-Solutions/blob/master/Chapter%202/2-3/htoi.c
[06:13:16] <Lambda_Aurigae> I believe that is only 2 digits, however.
[06:13:49] <Lambda_Aurigae> you basically take each character, convert it to a 0-15 value and multiply by the requisite number...
[06:14:52] <Lambda_Aurigae> hmm...that one I posted actually is single digit it seems.
[06:15:28] <Lambda_Aurigae> http://johnsantic.com/comp/htoi.html
[06:16:19] <Lambda_Aurigae> nice little loop to do many digits.
[06:19:41] <Lambda_Aurigae> although you will need to change that int value to something larger like uint16_t
[06:29:16] * LeoNerd still upset that gcc can't synthesize a uint24_t
[06:30:26] <Lambda_Aurigae> write an extension for it!
[06:31:24] <apo_> LeoNerd: I thought it could
[06:31:33] <apo_> wasn't it __uint24 or something like that?
[07:02:43] <SM0TVI> As to converting an int (after you've done htoi) to a binary string, rotate left thru carry, followed by an add with carry to a prepared registers with 3 and zero, or a conditional jump.
[07:04:08] <SM0TVI> 0x30 (48), not 3.*
[07:26:29] <Lambda_Aurigae> or use sprintf
[07:26:39] <Lambda_Aurigae> but that's too easy.
[07:35:17] <spillere> Lambda_Aurigae: awesome, thanks!!
[07:39:45] <apo_> LeoNerd: https://gcc.gnu.org/wiki/avr-gcc#Extensions
[07:40:54] <LeoNerd> Ooooh
[07:40:59] <LeoNerd> I see; they're just not named as uint24_t
[07:42:40] <apo_> of course it's not exactly a standard thing, so don't expect it to work with other compilers =P
[07:42:48] <LeoNerd> Well, quite
[07:43:02] <LeoNerd> I do a lot of fairly gcc-specific stuff in my avr code *anyway* :)
[07:43:15] <LeoNerd> I'm still looking for a way to do my microscheduler tasks nicer, also
[07:46:28] <apo_> I used them for a few revisions of my NCO
[07:46:37] <apo_> But determined that I didn't need quite that much precision
[07:46:53] <apo_> (Plus I couldn't do 6 oscillators like that)
[07:47:00] <Lambda_Aurigae> Nose Controlled Oscillator ?
[07:47:05] <apo_> numerically
[07:47:29] <LeoNerd> I need a 24bit counter for slower timers, because 30 seconds for me is just over 2^16
[07:47:36] <apo_> https://github.com/Cat-Ion/atmega328-midi-synthesizer/blob/master/nco.h#L64 :p
[07:57:07] <SM0TVI> Lambda_Aurigae: Well, I'm thinking in terms of being frugal with the AVRs flash and RAM :3
[07:57:28] <LeoNerd> Anyone any idea what OS_main and OS_task attributes are for?
[07:58:19] <LeoNerd> Ah.. https://gcc.gnu.org/onlinedocs/gcc/AVR-Function-Attributes.html
[08:02:05] <day> LeoNerd: why not count up a variable on counter overflow?
[08:02:33] <LeoNerd> day: Because detecting that counter overflow *in C* is awkwardly annoying
[08:02:45] <LeoNerd> C doesn't give us an add-with-carry
[08:02:45] <day> no its not?
[08:02:57] <day> you can just use the interrupt for that
[08:03:00] <LeoNerd> Hrm?
[08:03:10] <LeoNerd> Ah, no.. I don't mean the AVR timer hardware
[08:03:24] <LeoNerd> I mean I keep myself a counter, and I tick it on various things, and I needed more than 2^16 in that counter
[08:04:08] <apo_> LeoNerd: It's not that bad
[08:04:18] <apo_> LeoNerd: Just check SREG for the carry bit =P
[08:04:38] <apo_> but of course even then it'll compile to utter shit
[08:04:52] <LeoNerd> Mhmm
[08:04:54] <apo_> with asm you can do that with one instruction
[08:05:10] <LeoNerd> Hence, my using __uint24
[08:05:49] <apo_> day: there's no overflow interrupt
[08:29:25] <day> apo_: yes there is. ISR(TIMERX_OVF_vect)
[08:30:25] <day> i assume you were talking about avr hardware, because that what ever LeoNerd was talking about didnt have one was already stated
[08:38:35] <LeoNerd> DAHH
[08:38:54] <LeoNerd> day: I am talking about a program I am running on an AVR chip, yes. But the counter variable I am talking about is just some member of a struct in my code
[08:39:01] <LeoNerd> Not the counter register of the AVR timer peripheral
[08:46:38] <day> LeoNerd: i know you explained that already
[09:18:30] <apo_> day: That's for timers >_>
[09:20:13] <day> apo_: no shit
[09:20:44] <apo_> day: No shit. We're not talking about timers.
[09:21:26] <day> sigh... 24bit counter for slower timers
[09:21:29] <day> this is fruitless
[13:00:51] <Krampus> Does anyone know how I can use avr-gcov / avr-gprof to generate coverage/profiling data?
[13:01:30] <Krampus> (Specifically for AVR; I know how to use the tools, although I'm not sure if there's a way to do that with simulavr or something)
[13:10:39] <Krampus> (Alternate plan is to stub out AVR stuff and have unit tests run built for the host, but the existance of avr-gcov makes me think there's an easier solution)
[15:00:29] <mike_papa> Good evening. I need help with Atmel Studio. I have removed Visual Assist from extensions (don't ask why). Now I'm trying to get it back to work. It's not available in extension manager, so I've uninstalled Studio, installed that again, And... VAssistX menu is there, and VA is enabled, I can change settings, but it doesn't seem to work at all. Only things like "int" "#define", comments are collored. All others are black.
[15:00:53] <mike_papa> No syntax coloring from VA at all.
[15:49:33] <PinkTieGuy> Hey there. Not sure if this is the appropriate place for this (apologies if not.) I'm playing around with a rotary encoder (https://www.sparkfun.com/products/10790 ) and I hooked it up as the datasheet specifies. I took a look to see the pulses on a scope and ended up with this: http://imgur.com/kGt72aN Could anyone maybe suggest why that's what I'm seeing?
[15:51:48] <apo_> My first guess is still gonna be 'not hooked up correctly'
[15:54:19] <PinkTieGuy> I checked a few times... unless there's something basic I'm missing. (Which is very likely lol).
[15:54:54] <Casper> PinkTieGuy: what were you expecting? this seems to be what I'ld expect if you turn it by hand
[15:54:58] <apo_> With a datasheet in Chinese? I wouldn't be surprised
[15:55:13] <apo_> Casper: both lines should move
[15:55:44] <Casper> ah a 2 bit encoder
[15:55:53] <PinkTieGuy> ya
[15:55:55] <Casper> then yeah, miswired or defective
[16:03:27] <PinkTieGuy> Cool - thanks! Also, is there a "proper" method to read encoders? I've heard some say that you only use one output as a clock and then check the status of the other one when the first triggers an interrupt. I've also heard two interrupts and a lookup table... is there a standard that's just "the best choice" lol ?
[16:05:42] <apo_> PinkTieGuy: Don't use one as a clock
[16:05:49] <apo_> PinkTieGuy: you have to trigger on both changes
[16:08:35] <apo_> PinkTieGuy: it'll change 00 -> 01 -> 11 -> 10, and if you use the high bit as clock it can toggle between 00 and 01 without getting anything (which isn't /that/ bad), or between 01 and 11 - and then you'll always detect a 1 on the data pin, and go in one direction
[16:09:59] <apo_> PinkTieGuy: you can use two interrupts, or a third pin and a xor gate and one interrupt
[16:10:58] <PinkTieGuy> Cool, thanks
[16:27:10] <PinkTieGuy> Would anyone know what "output Z" is for?
[17:35:01] <Tom_itx> PinkTieGuy, as in what?
[17:35:03] <Tom_itx> the encoder?
[17:35:10] <Tom_itx> that is probably the index pulse
[17:35:20] <Tom_itx> A B for quad and Z etc for index
[17:35:38] <PinkTieGuy> Yeah... index being what? AB give you direction and Z is used for speed?
[17:35:56] <Tom_itx> z is on pulse per rev
[17:36:01] <Tom_itx> the 'index'
[17:36:37] <Tom_itx> http://tom-itx.no-ip.biz:81/~webpage/avr/atmega328/PCINT0/quadrature/
[17:36:39] <Tom_itx> quad code
[17:37:38] <Tom_itx> not all encoders have the index pulse
[17:39:44] <PinkTieGuy> ah I see. thanks
[17:40:17] <PinkTieGuy> Wow. And thanks for the link, that's awesome
[18:17:50] <gorroth> mmmmmmmm, avr MCUs
[18:18:19] <gorroth> tonight's gonna be a long night with tea and stuff, because i have to finish up my hex uploader and get the full e2e testing done on the bootloader
[18:18:22] <Lambda_Aurigae> nice little 8bit processors...my favorite overall in the 8bit world.
[18:18:28] <gorroth> yeah
[18:18:34] <gorroth> i don't have any point of comparison, but i do love htem
[18:18:47] <gorroth> they're so fun to work on
[18:18:57] <Lambda_Aurigae> there are two things missing that would make them perfect.
[18:19:06] <Lambda_Aurigae> #1 hardware usb in a dip package
[18:19:09] <gorroth> more 16-bit PWMs being one of them? :)
[18:19:14] <Lambda_Aurigae> #2 execute code from sram or external memroy.
[18:19:17] <gorroth> ahh
[18:19:26] <gorroth> that would help, but i'd also like one more 16-bit PWM added
[18:19:38] <Lambda_Aurigae> i do very little pwm so not a big deal for me.
[18:21:09] <gorroth> i understand
[18:21:20] <gorroth> i just want more of them to make it easier to control servo signals
[18:21:30] <gorroth> but i'm going to work on some code at some point to get the 8-bit PWMs to the precision i need
[18:21:35] <gorroth> just have a lot of other things i have to do first
[18:37:13] <Lambda_Aurigae> my latest projects have been with on the fly software changes so have been working with small microcontrollers that can execute from sram.
[19:22:32] <gorroth> my life is different in the MCU world. sometimes i start thinking 8 KB of flash is a lot
[19:27:19] <Lambda_Aurigae> hehe.
[19:27:26] <Lambda_Aurigae> you need to get together with Jartza
[19:27:36] <Lambda_Aurigae> and his attiny85 vga generator.
[20:15:18] <gorroth> Lambda_Aurigae: that's quite a bit smaller than i'd like :) plus, i don't want to build vga comonents, hehe
[20:15:41] <gorroth> i'm getting into robotics and making machines do thingies :)
[20:15:47] <gorroth> that's also my official term, "thingies"
[20:18:04] <Lambda_Aurigae> coined a long time ago.
[20:18:23] <Lambda_Aurigae> but, if you want to see some sweet code, talk to Jartza about his tinyvga thingies.
[20:18:54] <Lambda_Aurigae> 3 attiny85 chips and he gets 8bit vga..mostly text but some graphics ability,,albeit low resolution.
[20:19:34] <Lambda_Aurigae> I've been playing with self-modifying code on pic32 chips the last week or three.
[20:23:00] <Lambda_Aurigae> not entirely successfully, mind you, but playing nonetheless.
[20:45:27] <Lambda_Aurigae> off to bedzies here.
[22:04:24] <gorroth> i was lucky to get avrbots.com
[22:04:30] <gorroth> unf unf
[22:22:25] <PinkTieGuy> Would anyone in here be familiar with the AVR plugin for Sublime Text 3? I've got it installed but I can't seem to Create/Update Project....
[22:33:03] <gorroth> no, sorry. i only use emacs and qtcreator