#avr | Logs for 2014-08-30

Back
[02:48:34] <xrlk> avr!
[02:48:56] <Jartza> !
[02:49:02] <gjm> ¡
[02:49:12] <Jartza> ¿
[06:31:30] <hetii> Is there some nice library for avr that will act avr as a rfid reader ?
[08:13:43] <hetii> I create such schamtickased on towitek rfid reader https://www.sharecad.org/#103e7971-af53-450d-98f7-15b1f9b1eefc
[08:13:59] <hetii> How do you think is it possible to port it to avr?
[08:16:27] <nhere1> i have picked attiny87 for my project, in Atmel Microcontroller Selector page i have checked that it has 9 PWM channels, but a guy who is writing a code for it said it only has 3 PWM channels, could anyone suggest where should i look in the datasheet to find the number of available PWM channels on this uC?
[09:09:04] <nhere2> anyone? any hints how to check that?
[09:13:04] <Lambda_Auriga_> nhere2, under,,,pwm maybe?
[09:13:17] <Lambda_Auriga_> pwm is handled by the timers so look there.
[09:13:53] <Tom_itx> 2 output compare units each driving up to 4 outputs
[09:14:37] <Tom_itx> right on page one of the #%$#%$@%$# data sheet!
[09:14:45] <nhere2> i have searched for "PWM" and there is like 1000 entries of that word
[09:16:17] <nhere2> Tom_itx, so does this mean a total of 8 PWM channels?
[09:16:30] <Tom_itx> 8 pwm pins
[09:16:39] <Tom_itx> 2 different signals
[09:16:48] <nhere2> i mean independent 8 PWMs?
[09:18:01] <nhere2> hmm, so if i understand correctly, this sucks big time, i can only set two different frequencies, right?
[09:18:06] <Lambda_Auriga_> start at page 109 and read up on the timer/counter 1.
[09:18:14] <Lambda_Auriga_> nhere2, right.
[09:19:37] <Lambda_Auriga_> generally when doing pwm within a system I have all my pwm frequencies the same and just vary the pulse width to adjust things...hence the pulse width modulation thing.
[09:21:38] <Tom_itx> atmega1280 has 15
[09:21:49] <nhere2> Lambda_Auriga_, but you can set only two different pulse widths in my case
[09:22:23] <Lambda_Auriga_> I already closed the datasheet but I saw where each of the 8 was independent.
[09:25:13] <Tom_itx> atmega162 has 6
[09:28:44] <nhere2> Tom_itx, 6 different PWM signals?
[09:28:58] <Tom_itx> that's what the parametric search table says
[09:29:53] <Tom_itx> and the data sheet confirms six pwm channels
[09:29:56] <nhere2> http://i.snag.gy/0qYf3.jpg i don't trust it anymore
[09:30:33] <nhere2> instead of 9 i get only 2 independent PWMs
[09:32:24] <Tom_itx> you need 9 independent pwm channels?
[09:32:46] <Tom_itx> maybe you should be looking at their pwm chips
[09:35:33] <nhere2> i am looking for 6 PWM channels (i want to independently control pulse width for those, frequency could be the same) and small package (like TSSOP-20)
[09:37:05] <nhere2> 6 PWMs + 7 GPIOs + UART
[09:37:11] <Tom_itx> mega167 has 20 pins and 9 pwm
[09:37:24] <Tom_itx> attiny87 has 20 pins and 9 pwm
[09:37:55] <Tom_itx> GPIO is any unused pin
[09:38:03] <Tom_itx> UART you need to specify
[09:38:27] <Tom_itx> ^^ both of those chips have 1 UART
[09:39:20] <Tom_itx> first indications... those would be my choices for the job
[09:39:53] <Tom_itx> 2nd step would be to verify it in the data sheet
[09:39:59] <Tom_itx> but since it's not my project...
[09:40:51] <Tom_itx> err i meant tiny167 not mega
[09:42:28] <Tom_itx> data sheet says no
[09:42:49] * Tom_itx reverts back to the selector table...
[09:42:53] <Tom_itx> you get the idea?
[09:42:58] <nhere2> i was choosing between mega168 and attiny87/167; those attiny are in smaller packages, so i have picked them, but apparently they do not have 9 independent PWMs
[09:43:13] <mux_> you can do what you want to do with the tiny87
[09:43:14] <Tom_itx> correct
[09:43:20] <Tom_itx> so you need to search more
[09:43:24] <mux_> no wait
[09:43:28] <Tom_itx> i suggest using a pwm chip
[09:43:35] <mux_> nhere2 doesn't need independent frequencies, only independent pwm duty cycle
[09:43:50] <mux_> nhere2: what is your required pwm frequency?
[09:43:51] <nhere2> yes, that correct
[09:43:55] <Tom_itx> so maybe they would work
[09:44:05] <Tom_itx> i didn't read the whole data sheet in the last 5 min
[09:44:10] <nhere2> 1k
[09:44:24] <mux_> you don't need any dedicated pwm channels for that, you can just do that with a timer interrupt and GPIOs
[09:44:27] <Tom_itx> servo controller?
[09:44:41] <mux_> that will work on literally any MCU with enough pins and one timer
[09:44:45] <Tom_itx> what's the application?
[09:45:06] <Tom_itx> i might suggest you talk to rue_mohr2
[09:45:34] <Tom_itx> he wrote 12bit glitch free pwm functions
[09:45:50] <nhere2> i don't want any laughs out there, so i better not talk about my project/application :)
[09:46:01] <Tom_itx> then you won't get much help here
[09:47:27] <nhere2> i think there is no big difference what will be controlled as long as frequency is 1k and i need to vary duty cycles from 0 to 100%
[09:47:48] <Tom_itx> instead of saying 'i need a small chip with 9 pwm' you could tell us more about it so we could narrow down what you actually need
[09:49:21] * Tom_itx puts the brain in sleep mode and wanders off
[09:49:21] <evil_dan2wik> I need an AVR with 2 serial ports and at least 16kb program space
[09:49:32] <evil_dan2wik> DIP package preferably
[09:49:41] <Tom_itx> dude you're on your own!
[09:49:42] <Tom_itx> :)
[09:51:53] <nhere2> mux_, can you elaborate a bit more about independent PWM duty cycles? can i set one fixed frequency and adjust duty cycles for each of 6 pins?
[09:52:14] <mux_> yes, that's the idea
[09:52:17] <Tom_itx> OCRx registers
[09:52:30] <Tom_itx> look for that
[09:52:30] <mux_> PWM works like this:
[09:52:53] <mux_> every clock cycle the register CNT gets incremented by one
[09:53:01] <Tom_itx> and if they're OCR0a & b generally they're complimentary
[09:53:39] <Tom_itx> or i could just be spewing out nonsense...
[09:53:51] <mux_> then when CNT equals a compare value, stored in OCRxx, the timer peripheral either raises an interrupt or flips a pin, whichever you specify
[09:54:12] * Tom_itx 's brain _is_ in sleep mode after all
[09:54:14] <mux_> one timer may have many OCR registers and thus many PWM outputs even though it only has one CNT register and thus one frequency
[09:54:38] <Lambda_Auriga_> evil_dan2wik, easy....atmega1284p.
[09:54:40] <Tom_itx> but you already stated you want 1khz frequency
[09:54:46] <Tom_itx> iirc
[09:54:52] <evil_dan2wik> Lambda_Auriga_, ok, thanks
[09:55:13] <Tom_itx> evil_dan2wik, there are likely smaller chips though
[09:55:15] <Lambda_Auriga_> 128K program space, 16K sram, 2 usarts, lots of other toys.
[09:55:18] <Lambda_Auriga_> 40 pin dip.
[09:55:41] * Tom_itx smacks Lambda_Auriga_ for not trying harder :D
[09:56:00] <Lambda_Auriga_> it's the largest avr in dip package.
[09:56:35] <Tom_itx> yeah, it may be overkill though
[09:56:43] <mux_> I wonder, isn't there anyone making DIP packages from modern QFN/BGA AVRs so you're not limited to those few DIPs left for breadboarding?
[09:56:43] <Lambda_Auriga_> only if it catches fire.
[09:56:45] <Tom_itx> i suppose it's for him to decide
[09:56:58] <nhere2> mux_, ok, i think i understand it now
[09:57:00] <Lambda_Auriga_> mux_, there are adapter boards, yeah.
[09:57:30] <Tom_itx> i got some such adapter boards sent to me free on a couple board orders i did
[09:58:28] <mux_> seems like the way to go tbh, the only purpose for DIP is breadboarding anyway, and at least I wouldn't want to let go of those sweet, sweet xmegas just because my fingers are sausages
[09:58:30] <Lambda_Auriga_> http://linuxgizmos.com/mips-tempts-hackers-with-raspbery-pi-like-dev-board/ side note here....fun toy looks like!
[09:59:03] <Lambda_Auriga_> mux_, I have trouble soldering fine pitch stuff but have done it in the past.
[09:59:18] <mux_> just use paste and hot air or an oven
[09:59:27] <Lambda_Auriga_> I do like the schmartboards though...even though they are expensive.
[09:59:34] <twnqx> pah, 0.4mm still is possible with an iron
[09:59:45] <mux_> you can literally just slap the paste on with a spoon and it will still reflow without errors
[09:59:46] <Lambda_Auriga_> no hot air rework station here.
[09:59:56] <mux_> get one! it's cheap
[09:59:59] <Tom_itx> tqfp48-dip qfn48-dip soic-dip tssop24-dip ssop24-dip
[10:00:01] <Tom_itx> any takers?
[10:00:04] <Lambda_Auriga_> under 10 dollars?
[10:00:25] <Lambda_Auriga_> I'm trying to scrape the money together to get a couple of RPIs
[10:00:27] <Tom_itx> mux_, it'll puddle if you get too much
[10:00:46] <mux_> well yeah, I wouldn't recommend actually using a spoon :P
[10:01:24] <mux_> but I'm doing ridiculously fine pitch stuff now with paste, great-looking results and few defects even though I'm shaking like somebody with parkinson's
[10:01:36] <mux_> the right tool for the job
[10:01:51] <mux_> I wouldn't try it with a traditional soldering iron, that's hell
[10:02:17] <Tom_itx> qfn?
[10:02:17] <Georg> could anybody help me to port some code for iar to avr?
[10:02:37] <mux_> Georg: as in, IAR to GCC?
[10:02:40] <Lambda_Auriga_> schmartboards build up the soldermask between pins then put solder on the pins for you...you just lay the chip in the slot and heat the pins down onto the board.
[10:02:44] <Tom_itx> i tried qfn with my oven and had several bridges
[10:03:06] <Lambda_Auriga_> Georg, I'm sure someone can. it can't be that difficult.
[10:03:15] <mux_> yeah I saw the schmartboard things, they're supposed to be pretty cool but fairly expensive IMO
[10:03:41] <mux_> and most PCB services nowadays can do soldermask between QFN pads, even 0.4mm
[10:03:49] <mux_> I recently used the new tiny841? I think...
[10:03:53] <mux_> ridiculous package
[10:04:16] <mux_> but iteadstudio made it with soldermask in between 0.4mm pitch pads... awesome
[10:04:23] <Georg> how to move that to avr: volatile __io uint16_t blabla @0x0a; ?
[10:04:50] <mux_> Gerog: pretty sure you do that with _SFR_MEM8(address)
[10:05:47] <mux_> oh spelled your name wrong there...
[10:05:53] <Georg> mux_: thank you
[10:05:58] <Georg> no problem :)
[10:06:59] <Georg> and how should that look for this example: volatile __io uint16_t blabla @0x0a;
[10:07:00] <Georg> ?
[10:07:08] <Georg> sorry
[10:07:36] <mux_> I'm a bit rusty on that, but I assume this is a lower-memory mapping for a register?
[10:07:46] <Georg> volatile __io PMSMflag_t fastFlags @0x0a;
[10:07:48] <Georg> this
[10:08:05] <mux_> oh it's a typedef
[10:08:33] <Georg> This variable contains all the flags used for motor control.
[10:08:38] <Georg> GPIOR0 register
[10:08:59] <mux_> yeah it's a struct type
[10:10:01] <mux_> there is actually an avrfreaks topic on this
[10:10:07] <mux_> http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=120525&start=0
[10:10:12] <Georg> oh
[10:10:46] <mux_> somebody else tried to do exactly the same as you :P
[10:11:38] <Georg> thank you
[10:11:41] <Georg> I will check that
[10:41:24] <Georg_1> sorry, my internet connection crashed...
[10:49:34] <rue_mohr2> nhere2,
[10:49:47] <nhere2> yes
[10:50:16] <rue_mohr2> the tcl5940 is a chip that you supply with your own pwm osc and it gives you up to 12 bit pwm for 16 channels
[10:50:45] <rue_mohr2> its designed for leds, but dosn't have to be used for them
[10:51:09] <rue_mohr2> and they are plentifull from china
[10:52:06] <rue_mohr2> er tlc5940 :)
[10:53:06] <nhere2> and how do you control that chip? how do you set up duty cycles?
[10:53:56] <NicoHood1> is there an easy way to setup 38khz on a pwm pin of choice without using timers? otherwise i'd go for simple bitbanging
[11:03:05] <Georg_1> does anybody know how to modify "__delay_cycles(value)" to gcc-avr?
[11:03:31] <Tom_shop> delay()
[11:03:46] <Tom_shop> dunno about single cycles
[11:04:11] <Georg_1> thx :)
[11:04:34] <Tom_shop> there's another but i forget the syntax
[11:04:52] <Georg_1> I'll try delay()
[11:04:58] <Tom_shop> it's ms
[11:05:05] <Tom_shop> iirc there may be a us one
[11:06:24] <Georg_1> good to know
[11:06:37] <Tom_shop> http://tom-itx.ddns01.com:81/~webpage/how_to/atmega168/mega168_led_blink_delay_index.php
[11:06:42] <Tom_shop> look at that delay
[11:06:46] <Tom_shop> you can write your own
[11:09:03] <Georg_1> ok, I'll have a try
[11:09:09] <Georg_1> thx again
[11:15:54] <rue_mohr2> nhere2, its serial
[11:16:20] <rue_mohr2> NicoHood1, no, you have to do math.
[11:20:15] <NicoHood1> rue_mohr2: i mean the "standard" ir library use time 2 for this. sure i have to calculate the timings but i want the user to choose his pwm pin at least
[11:20:22] <NicoHood1> is this possible or more complicated
[11:20:44] <NicoHood1> i got a perfect 38,4khz bitbang *g* http://i.minus.com/iGdeg5JyOTYou.png
[11:21:30] <rue_mohr2> easy if you use the right clock rate
[11:21:52] <rue_mohr2> I think if you use the 14.somethingMhz its an even divisor
[11:21:52] <tpw_rules> NicoHood1: how do you like your saleae? i have a logic pro 8 on order?
[11:23:10] <NicoHood1> tpw_rules: its a clone but it works perfectly. so usefull and only 7€
[11:23:18] <tpw_rules> incidentally i'm still trying to h4x together a high voltage programmer
[11:23:30] <tpw_rules> heh
[11:23:46] <rue_mohr2> 14.7456Mhz
[11:24:01] <NicoHood1> rue_mohr2: well i have no idea about timers. and it seems complicated. i need 38,4 khz and 37khz for now
[11:24:29] <rue_mohr2> divisor of 384
[11:24:38] <rue_mohr2> hmm
[11:24:52] <rue_mohr2> dont think thats a valid pwm clock rate divisor
[11:25:08] <NicoHood1> i dont know why this guy fixed the pwm of the infrared to timer 2 but he must had a reason. and i guess its more complicated to look up what timer is for what pin and how to set it instead of just using a fixed pin
[11:25:22] <rue_mohr2> your trying to modulate IR aren't you?
[11:25:25] <NicoHood1> ye
[11:25:35] <rue_mohr2> hmm
[11:25:49] <NicoHood1> at the moment i am bitbanging this thing
[11:26:49] <rue_mohr2> I wonder if you can skew the internal RC enough to use /256 or /128 for it
[11:27:01] <rue_mohr2> I dont recall how many trim bits there are
[11:27:23] <NicoHood1> i have no idea what you are talking about to be honest :S
[11:27:40] <rue_mohr2> the avr has an internal 8Mhz RC oscillator
[11:27:47] <NicoHood1> i want that the user can do writeIR(pwmPin);
[11:27:57] <rue_mohr2> its got a register for tweeking the freq
[11:28:18] <rue_mohr2> if you can trim it from...
[11:28:18] <NicoHood1> so you want to use both, intern and extern and the intern for IR?
[11:28:26] <rue_mohr2> no, just the internal
[11:28:40] <rue_mohr2> so you can tweek the whole processor freq to get your results
[11:28:42] <NicoHood1> yeah and the extern for normal use. the 16mhz
[11:28:47] <NicoHood1> and the intern for IR, right?
[11:28:59] <rue_mohr2> no, you always run on the same clock
[11:29:09] <NicoHood1> why should i use the intern then?
[11:29:11] <rue_mohr2> your processing speed dosn't matter, you care about pwm freq
[11:29:16] <NicoHood1> the extern is 16mhz
[11:29:28] <rue_mohr2> because its how you get your 38.4 or 37Khz
[11:29:47] <NicoHood1> no i dont want to change fuses for this. just a normal arduino with 8 or 16 mhz
[11:29:55] <NicoHood1> i want to keep it variable
[11:29:58] <rue_mohr2> oh well fine
[11:30:15] <rue_mohr2> yes it can be done, it requires sitting down and working it out
[11:30:20] <rue_mohr2> I dont want to do that for you now
[11:30:22] <rue_mohr2> :)
[11:30:27] <NicoHood1> sure
[11:32:15] <NicoHood1> i just want to know how complicated it would be. the user inputs a pwm pin and the function has to find the right timer and set it to the desired frequency. will this work? or DO i need a free timer like timer 2 to do these things. i dont understand why the timers are connected with 2pwm pins each and why you cant use timer 0 because it controls millis but it still can control pwm
[11:32:52] <NicoHood1> idk if this makes sense. i just dont get why he uses timer 2. cant you use any pwm for 38khz and still be able to use PWM and other timer function like millis?
[11:36:17] <rue_mohr2> dont use the pwm
[11:36:32] <rue_mohr2> use the output compare on a timer, and use it in toggle pin mode
[11:36:45] <rue_mohr2> tho, you wont be able to just direct it to any pin you want
[11:37:15] <rue_mohr2> you can use the timer with a compare match, that can toggle whatever pin you want
[11:42:08] <NicoHood1> is this complicated?
[11:45:37] <nhere2> atmega168 has these 6 registers: OCR0A, OCR0B, OCR1A, OCR1B, OCR2A, OCR2B; hence i can have 6 different duty cycles
[11:46:02] <nhere2> attiny87 has these registers: OCR0A, OCR1A (OCR1AH, OCR1AL), OCR1B (OCR1BH, OCR1BL)
[11:46:57] <nhere2> i still cannot see where it is 9 (8) channels in attiny87
[11:51:50] <nomis> nhere2: apparently two timers, where the 16 bit timers has 2 output compare units, each capable of driving up to 4 pins. --> 1 + 2 * 4 pins.
[11:52:52] <rue_mohr2> odd
[11:53:12] <rue_mohr2> usually it will be 4 timers with 2 compare and another timer with 1 compare
[11:55:27] <nhere2> nomis can you explain how do you get 4? can you give an example how would you set 4 different duty cycles?
[11:56:17] <nomis> nhere2: I am not sure if it is possible to get different duty cycles.
[11:56:34] <nomis> nhere2: just glancing over the datasheet btw. have never worked with this µC.
[11:57:56] <nomis> the diagram on page 120 seems to indicate that four pins share the same generated waveform and can individually be en-/disabled.
[12:01:06] <nhere2> that diagram is not easy to understand
[12:01:31] <nomis> well, it shows the logical structure of the timer block.
[12:05:01] <nhere2> so from that diagram i see it is possible to set 2 different frequencies, and only one duty cycle per frequency, then i can direct that wave to selected pins; so, to sum up, i can have no more than 3 different duty cycles in this uC
[12:07:46] <nomis> yeah.
[12:12:07] <Steffanx> no.. the duty cycle is set using the OCRx registers.
[12:14:19] <nhere2> Steffanx, and there are only three of them
[12:15:24] <nomis> Steffanx: OCR0A, OCR1A[HL], OCR1B[HL].
[12:15:28] <nhere2> so you can get no more than 3 different square waves
[12:15:57] <Steffanx> ah yes, i missed that part :P
[13:17:59] <megal0maniac> I <3 class D
[13:18:23] <vsync_> i <3 DD
[13:18:44] <megal0maniac> Well...
[13:18:49] <megal0maniac> Yes
[13:18:54] <vsync_> Yes
[13:20:00] <megal0maniac> But it's not like I've just discovered that :P
[13:20:25] <vsync_> i will not delve deeper into this
[13:20:33] <vsync_> i will merely insult you
[13:20:37] <vsync_> if i would, that is
[13:44:36] * sebus o/
[13:46:20] <sebus> Has someone experienced a problem with avrisp mkII and AS 6.2? I mean... I set ISP clock frequency to 125kHz and program itself changes it to 1MHz and cannot program my M644
[13:47:18] <sebus> Already tried to update firmware of my programmer - still same problem
[13:47:55] <NicoHood1> can anyone help me with structuring my classes? i have a main Infrared class. it should decode and send different protocols, but only compile the once used. so i pass a protocol class pointer to this infrared class. for example i call the write function, then it calls the protocol write function. problem with that is that this write function needs to acces the main write38khz function. so how do i design this? i never used templates, just
[16:51:27] <rue_mohr2> I'd suggest pairing down your method for running that on an avr
[16:51:39] <rue_mohr2> sounds like your trying to code a microcontroller like a PC
[16:51:54] <rue_mohr2> are you writing n arduino library?
[16:55:41] <Lambda_Auriga_> rue_mohr2, are you saying he should,,,umm,,,drop the class act?
[17:09:12] * Xark notes static class methods are fine [e.g., MyClass::MyFunc(x); ] the same as regular functions but class methods with "this" are not that efficient on AVR. Also for Arduino, consider putting your whole class in a header (then it can generally optimize better).
[17:11:22] <Lambda_Auriga_> for me I just don't see any advantage to C++ and classes and all...I've done the OO and non-OO programming thing..it just seems to complicate things to me...but I also got really hooked on C long before C++ existed.
[17:15:21] <Xark> Well, static class members are just "decorative" e.g., MyClass::Foo(); vs MyClass_Foo(); :) However, some C++ features are handy for MCUs (templates can generate efficient code without messy #if's e.g.).
[17:16:30] <hmw> Where can I find a full description of the instruction set, especially including the machine codes? E.g. when I want to write my own assembler?
[17:16:36] <Xark> However, "desktop" C++ (with heavy std lib and stl have little place on MCUs).
[17:16:52] <Lambda_Auriga_> hmw, try the avr instruction set pdf from atmel.
[17:17:22] <Xark> hmw: Yeah, Atmel has a nice document (but you also want the instruction set summary from your specific chip - as not all AVR instructions are on all parts).
[17:17:33] <Lambda_Auriga_> http://www.atmel.com/images/doc0856.pdf
[17:17:47] <hmw> What I found is incomplete. The detailed descriptions of about 50% of the opcodes are missing.
[17:17:54] <Lambda_Auriga_> then get, as Xark said, the specific datasheet for your chip.
[17:17:56] <Xark> hmw: www.atmel.com/images/doc0856.pdf ?
[17:18:05] <hmw> cheking, i believe, it is what I already have
[17:18:18] <Xark> hmw: Give an example of a "missing" instruction...
[17:18:26] <Lambda_Auriga_> that doc has every avr instruction in it, in rather good detail.
[17:18:49] <aandrew> hmw: how did you figure out that half the opcodes were missing from that?
[17:21:55] <hmw> Oh my. I think the printer just didn't print a bunch of the pages. Thanks for your help.
[17:22:05] <Xark> hmw: No problem. :)
[17:22:14] <Lambda_Auriga_> it's a printing device conspiracy I tell ya!
[17:22:40] <hmw> Indeed. I am in my local hack space, where everything is broken. Especially the network. What a joke *grins*
[17:22:50] <Lambda_Auriga_> so hack it and fix it!
[17:23:44] <hmw> *sigh*
[17:24:21] <hmw> Its probably broken, because too many people tried to fix it.
[17:24:30] <Lambda_Auriga_> or not enough of the right people.
[17:24:42] <Lambda_Auriga_> I know the local hackerspaces near me are serious jokes though.
[17:26:02] <Lambda_Auriga_> I had a truckload of computers, electronic gadgets, printers, cables, and STUFF...neither wanted it even if I delivered it....I called a buddy of mine 4 hour drive away and his hackerspace guys drove up here to get it.
[17:27:42] <Lambda_Auriga_> I tried teaching an AVR class at the des moines hackerspace and got 2 guys who were more interested in how many arduino shields they could buy than actually learning anything about microcontrollers
[18:50:57] <megal0maniac> Lambda_Auriga_: That's quite an upsetting tale
[18:51:14] <Lambda_Auriga_> is life I suppose.
[18:51:47] <megal0maniac> My sad story is that I can't pull a TTL line low and light up an LED with it at the same time :P
[18:52:03] <megal0maniac> Best I get is 1.7V with red with Vcc at 5V
[18:52:30] <megal0maniac> But I need <0.8 and >2.0 so 1.7V is an iffy high, which is not what I need
[18:53:21] <N1njaneer> megal0maniac: Add transistor for LED.
[18:54:00] <megal0maniac> I suppose
[18:54:18] <N1njaneer> Or possibly a schottky diode or two in series with the LED to increase the forward voltage drop across the diode.
[18:54:23] <megal0maniac> Nooooo
[18:54:29] <megal0maniac> Now it's too complicated :P
[18:54:49] <N1njaneer> All of this shit is too complicated. That's why it's fun. :)
[18:55:42] <megal0maniac> I'm adding intelligence to an amplifier. Soft-start, a pushbutton for gain, etc. So I'm overcomplicating things as it is :)
[18:56:16] <N1njaneer> You could also try a green, blue, or white LED instead of the red and see if that fixes it. Bigger forward voltage drop.
[18:56:19] <megal0maniac> I forget. How do I find what base current I need to switch?
[18:56:32] <megal0maniac> N1njaneer: I did. Red was best
[18:57:07] <N1njaneer> If you're adding a generic NPN, just stick a 1K on the base. You'll be pushing the transistor in to saturation anyhow, you just want to limit current flow on the base.
[18:57:34] <N1njaneer> NPN's emitter to ground, and collector to LED cathode.
[18:58:15] <megal0maniac> Collector to cathode?
[18:58:24] <megal0maniac> Why does that seem backwards?
[18:58:43] <N1njaneer> LED anode goes to a resistor, resistor to +VCC
[18:58:53] <N1njaneer> Running it in a sink configuration.
[18:58:56] <megal0maniac> Ah
[18:59:03] <N1njaneer> In an NPN, current flows in the collector and goes out the emitter.
[18:59:07] <megal0maniac> Okay that makes sense :)
[18:59:24] <N1njaneer> You want to tie the emitter to ground so the base-emitter voltage is with respect to ground.
[18:59:49] <N1njaneer> So the base needs to only go up a little bit to get it in to saturation.
[19:01:53] <megal0maniac> One sec. Want to draw this out quick
[19:07:35] <megal0maniac> http://i.imgur.com/jZu9lIw.png
[19:07:46] <megal0maniac> Imagine Vcc is there
[19:08:04] <megal0maniac> Microcontroller pin toggles between High Z and GND
[19:09:07] <megal0maniac> Am I on the right track?
[19:10:01] <megal0maniac> N1njaneer: (Also, the transistor would be a 2n2222, I forgot to change it)
[19:13:02] <N1njaneer> With this arrangement you may be able to drop the 1K on the base if you are biasing to VCC through the 10K and doing open-collector to pull it low.
[19:14:06] <N1njaneer> You MIGHT have to change the 10K to something smaller like a 4.7K or so if the LED doesn't light bright enough, but try it. Even through the 10K it should be enough to kick the transistor on.
[19:15:23] <megal0maniac> Was just about to say I might need a 4K7 pullup :) That's my first option. Low component count wins
[19:16:09] <N1njaneer> Else try using a FET instead of a transistor if all else fails.
[19:16:29] <megal0maniac> It WILL work :P
[19:16:45] <megal0maniac> Also, class D amplifiers are magic
[19:18:25] <megal0maniac> I'm amazed at how powerful and efficient they are. It's mind boggling
[19:19:15] <megal0maniac> Cool, well I shall attempt this tomorrow. Thanks for the help! Goodnight all
[19:23:54] <rue_mohr2> megal0maniac,
[19:24:05] <rue_mohr2> I have a link for ya
[19:24:31] <rue_mohr2> http://ruemohr.org/~ircjunk/tutorials/elex/qwhathow.html
[19:24:38] <rue_mohr2> ^^ the bipolar transistor howto
[19:36:26] <aandrew> I don't like the conversation way it's presented but I like how you led him through the steps over and over with different configurations
[19:37:15] <aandrew> I *do* like how you took the pragmatic approach and not just jump into depletion zones, carriers and other crap that's not necessary for a good 99% of transistor circuit analysis
[19:46:14] <nhere> what is the difference between ATmega168, ATmega168A, ATmega168P and ATmega168PA? ATmega168 is 2x more expensive than ATmega168A
[19:51:24] <tpw_rules> okay, so now i am questioning if i burned out my chip with my shiny new high voltage programmer. it seems ready is high whenever there is 12v. it doesn't unlatch if i disconnect 12v
[19:51:31] <tpw_rules> it comes out at 5v so i haven't quite melted it
[20:02:44] -rajaniemi.freenode.net:#avr- [freenode-info] if you're at a conference and other people are having trouble connecting, please mention it to staff: http://freenode.net/faq.shtml#gettinghelp
[20:07:02] <wolfrage> I have a problem i do not understand. On my desktop When i try to get only 8 bits from a 16bit int it works fine but on my ATmega168 it just ignores the operation and makes a 1 for 1 copy of the 16bit int.
[20:07:17] <wolfrage> Using this command: low8bits = DS_T_CMD_READROM & ((1<<8)-1);
[20:07:29] <wolfrage> Relevant: #define DS_T_CMD_READROM 0xFF80
[20:07:50] <wolfrage> On the desktop it works and I get only 8 bits but on the AVR I get all 16 still.
[20:09:14] <wolfrage> Any help as to why would be appreciated.
[20:16:57] <Casper> I think I know why
[20:17:27] <Casper> why not low8bits = DS_T_CMD_READROM >> 8; ?
[20:17:38] <tpw_rules> becuase those are the high 8 bits?
[20:17:54] <Casper> oh you want just the lower 8?
[20:17:59] <tpw_rules> try anding with 0xff?
[20:18:56] <tpw_rules> wolfrage: i suggest & 0xFF instead.
[20:34:08] <wolfrage> OK will do
[20:36:53] <wolfrage> odd still happens
[20:37:49] <wolfrage> Any other suggestions or ways to force it to work right, it works fine in C on desktop, but the AVR seems to just copy
[20:38:01] <wolfrage> the whole 16bit int that is
[20:38:02] <tpw_rules> how are you sure it's copying?
[20:38:06] <tpw_rules> do you have some context?
[20:38:24] <tpw_rules> paste more than one line of code on pastie.org or something
[20:38:45] <wolfrage> I am not sure, but I am doing a printf to serial of the bytes and some are 16bit well the others are 8bit; and yes I will
[20:39:37] <wolfrage> http://pastie.org/9516257
[20:39:53] <wolfrage> Specifically line # 135
[20:40:35] <wolfrage> example output from printf = ScratchPAD DATA = 10 9 FFFF 7F 46 4B 1 FF87
[20:40:51] <tpw_rules> oh
[20:41:44] <wolfrage> I am very new to C (although I did use it almost 20 years ago) but i normally program in Python.
[20:41:51] <tpw_rules> try doing it like %2X or %X.hh
[20:41:56] <wolfrage> So please excuse my poor code.
[20:41:59] <tpw_rules> that means unsigned char
[20:42:16] <wolfrage> OK
[20:42:27] <tpw_rules> actually
[20:42:31] <tpw_rules> your data array is only regular char
[20:42:37] <tpw_rules> make it an array of uint8_t or unsigned char
[20:43:27] <tpw_rules> do that before mucking about with printf
[20:43:34] <wolfrage> OK changed get to uint8_t
[20:43:42] <tpw_rules> %2X will make it so that you will have 0A instead of A or such
[20:43:46] <wolfrage> Ok left printf
[20:43:49] <wolfrage> one moment
[20:44:01] <tpw_rules> and .hh means cast to unsigned char
[20:45:52] <wolfrage> OK that seems to have worked, but the temp is still off I will have to trouble shoot that on my own
[20:46:07] <wolfrage> Thanks
[20:46:41] <wolfrage> the temp is right by the way if I don't get those extra bits, but for some reason it happens when the tempature is above 75
[20:46:43] <wolfrage> F
[20:47:25] <wolfrage> I may have messed up some of the working code though trying so hard to just get 8bits
[20:50:53] <wolfrage> yup the code is still good below 75. Must be doing something wrong in the protcol. Thanks for helping me solve that problem.
[23:07:54] <tpw_rules> anybody have experience with high voltage programming? trying to build my own and i think i blew up my chip
[23:14:40] <rue_shop3> Tom_itx, has lots
[23:17:17] <tpw_rules> ah good
[23:17:44] <tpw_rules> Tom_itx: i need your assistance. please pm me. i'll be going to bed soon so don't worry if i don't respomnd
[23:56:30] <Casper> tpw_rules: might want to share the issue too
[23:57:31] <twnqx> taking an afternoon nap?
[23:58:01] <rue_shop3> I cannot find garden hose caps from china
[23:58:08] <rue_shop3> they are $2.50 ea here
[23:58:15] <rue_shop3> thats insane for a plastic cap