#avr | Logs for 2015-12-21

Back
[05:30:28] <Martin90> Hey! I am using Atmega16, can I set output pin to operate as either push-pull or open drain ?
[05:44:28] <twnqx> not "really"
[05:44:52] <twnqx> but you can toggle between output 0 and input with or without pull-up to emulate
[05:52:21] <Martin90> so in which configuration atmega pins are ?
[05:52:46] <twnqx> push-pull if set to output
[05:52:53] <twnqx> (cmos totem pole)
[05:52:57] <Jartza> push-pull or hi-Z
[05:53:02] <twnqx> or hi-z if input
[05:53:38] <Martin90> mhm
[05:53:57] <Martin90> but for input those transistors are also push pull right ?
[05:54:28] <Martin90> I mean, either for input or output there are always two transistor which drive the state
[05:55:52] <Martin90> if one is ON and other OFF we get INPUT and conversely OUTPUT, right ?
[05:56:06] <sabor> when it's set to output either the upper or the lower transistor is switched on, when set to input both are off
[05:56:43] <Martin90> ok, thanks
[06:46:49] <Haohmaru> Martin90 you can configure that stuff pretty extensively per pin on xmega
[06:46:58] <Haohmaru> just sayin'
[06:47:19] <Haohmaru> i'm liking them xmegas more and more
[06:47:36] <Martin90> Hmm, what about those older ones like Atmega16a ?
[06:48:08] <Haohmaru> what you were already told there
[06:48:47] <Martin90> so it's always push pull behind the scene
[06:49:52] <Lambda_Aurigae> Lets say we want PB0 as open drain, with an external pull-up resistor.
[06:49:52] <Lambda_Aurigae> To send a logic 1 (or let the line float), clear PortB bit 0, and clear DDRB bit 0, to set PB0 as input-no-pull-up.
[06:49:52] <Lambda_Aurigae> To send a logic 0 (or pull the line low), keep PortB bit 0 clear, then set bit DDRB bit 0,to make PB0 output-low.
[06:54:32] <Jartza> hallo
[06:59:57] <Lambda_Aurigae> olleH
[07:26:10] <Tom_itx> 07734
[07:27:09] <Lambda_Aurigae> 7734
[07:27:24] <Lambda_Aurigae> 71077345
[07:27:51] <LeoNerd> Put more simply: Leave the PORTx bit at 0, and use the corresponding DDRx bit to flip between drive-low and hiZ
[07:28:04] <LeoNerd> (Such as a float-high I²C-style bus)
[07:28:30] <Lambda_Aurigae> LeoNerd, yup...or,,,use a pic.
[07:28:55] <Lambda_Aurigae> yes, yes, I know, I'm going straight to hell, do not pass go, do not collect 72 virgins.
[07:30:28] <LeoNerd> Hah
[07:30:29] <LeoNerd> PIC
[07:30:50] <LeoNerd> Let me know when I can 'apt-get install' an entire PIC dev environment.. :P
[07:30:51] <Lambda_Aurigae> I've grown rather fond of certain pic32 chips.
[07:31:00] <LeoNerd> Well, the 32s are their own beastie sure
[07:31:13] <Lambda_Aurigae> can't use apt-get...but mplabX and xc compilers are available free for windows, mac, and linux.
[07:31:15] <LeoNerd> I have a bagful of 16F84s, and an F887 at home.. not sure what to do with...
[07:31:26] <Lambda_Aurigae> xc compilers aren't optimized for the free version though.
[07:31:31] <Lambda_Aurigae> but they do work.
[07:31:38] * LeoNerd hugs avr-gcc
[07:31:48] * LeoNerd would hug it more if it could emit anywhere near sane code on ATtiny for x * 3
[07:31:50] <Lambda_Aurigae> and if you like pain you can compile the xc32 compiler from scratch with full optimization..
[07:32:35] <LeoNerd> I ordered myself an ATmega128 devboard this weekend... shall see what happens when it arrives
[07:32:44] <Lambda_Aurigae> have had one of those for years.
[07:32:44] <LeoNerd> I wanted more IOs than I could get out of my usual 328 target
[07:32:54] <Lambda_Aurigae> mostly I play with the atmega1284p though these days.
[07:33:11] <Lambda_Aurigae> 128 is nice for the external sram interface.
[07:33:16] <Lambda_Aurigae> and/or memory mapped peripherals.
[07:33:22] <LeoNerd> I decided to go all out extreme and forget having a separate MAX7219 chip just to drive an LED matrix... I'll put that on the 128 as well :)
[07:33:28] <Lambda_Aurigae> I've connected a 6522 to one.
[07:33:34] <LeoNerd> I just wanted loads of IOs
[07:33:46] <Lambda_Aurigae> pcf8574 chips! expensive but fun.
[07:33:53] <LeoNerd> I don't need anywhere near 128Ki of program space, or... prettymuch any of the other periphs
[07:33:55] <Lambda_Aurigae> i2c 8bit port expander.
[07:33:58] <LeoNerd> Heh.. I have some MCP23S17s
[07:34:04] <LeoNerd> Yeah; I'm aware of those. that was my other thought
[07:34:14] <LeoNerd> But they're big and expensive, as compared just getting a single MCU
[07:34:17] <Lambda_Aurigae> wish they weren't so expensive though...
[07:34:50] <LeoNerd> ATtiny841 + MCP27S17 + MAX7219 == about £4 in chips, taking quite a lot of board space.. and lots of pins to solder that are just interconnects
[07:35:00] <Lambda_Aurigae> I did switch over and use atmega88 chips for i2c port expanders as they were cheaper than the other dedicated port expanders.
[07:35:08] <LeoNerd> ATmega128 == £2 in chip, if that... about half the board space of the above, and no wasted interconnect lines
[07:35:28] <LeoNerd> Oh I dislike I²C also; I'd use SPI given the choice - hence the 23S17 rather than the 23017
[07:35:48] <LeoNerd> MCP23x17 == 16bit thing, it's like the PCF but bigger, fancier... does a few nicer things
[07:35:51] <LeoNerd> like interrupts :)
[07:35:58] <Lambda_Aurigae> yup.
[07:36:02] <Lambda_Aurigae> pcf does interrupt.
[07:36:11] <Lambda_Aurigae> and is open collector outputs too.
[07:36:13] <LeoNerd> But only on change since last read, I think?
[07:36:21] <Lambda_Aurigae> yup.
[07:36:28] <LeoNerd> Ahyes; the MCP can do opencollector or pushpull, configurable per pin
[07:36:32] <Lambda_Aurigae> is a very simple chip to use.
[07:36:44] <LeoNerd> The MCP also has configurable interrupts; can do pinchange or deviation-from-normal, per pin.
[07:36:50] <Lambda_Aurigae> yup.
[07:36:53] <Lambda_Aurigae> I have some of those too.
[07:37:20] <Lambda_Aurigae> HAHAHAHAHA...miss universe was mis-crowned.
[07:37:39] <Lambda_Aurigae> numb nuts steve harvey announced the wrong winner.
[07:37:39] <LeoNerd> The only thing I really dislike about it is the stupid "SPI" port on the SPI version.. It isn't as nice as a "real" SPI device would be
[07:38:19] <Lambda_Aurigae> ok..time for going to worky.
[08:54:31] <Jartza> I had an idea for my VGA thingamabob
[08:54:35] <Jartza> (again)
[08:54:42] <Jartza> especially for the graphics-mode
[08:54:55] <Jartza> maybe special escape code, after which you could send 3 bytes
[08:55:00] <Jartza> R, G and B separately
[08:55:44] <Jartza> so you could enable any combination of colors in single 2x4 pixel block :o
[08:56:11] <Jartza> of course, transferring picture would take about 4 times as much data as before, but still
[08:57:33] <Jartza> the same would of course work for characters, though I'm not sure how useful it would be to print red K and blue P in the same character space
[16:27:13] <Jartza> wadsup
[16:31:17] <Casper> TIL: tig welding: contaminated electrode is really, REALLY bad!
[16:34:08] <Jartza> ohg
[16:34:26] <Jartza> contaminated with what?
[16:35:28] <Casper> steel
[16:37:51] <Jartza> ouch
[16:38:09] <Jartza> plasma ouch
[16:38:44] <Casper> why ouch?
[16:40:09] <Jartza> doesn't sound like a winning combination
[16:40:57] <Casper> need to learn to control the arc, but so far I love it
[16:43:59] <Jartza> yeaj, tig welding os nice
[16:44:18] <Jartza> luckily you can grind the electrode
[16:44:30] <Jartza> to get rid of nasties
[16:49:20] <Casper> still need to find a good video about the technics
[16:49:44] <Jartza> yea, takes practice and practice
[16:49:51] <Casper> and... I think I did well to install a 240V outlet for my welder
[16:56:01] <cehteh> Jartza: you mean to create nasties? .. tungsten dust is poisonous
[16:56:55] <Jartza> adequate protection needed
[16:57:36] <cehteh> what did you weld? aluminium?
[17:02:18] <Jartza> how about 64*64 pixels with any of the 8 colors for any pixel?
[17:02:23] <Jartza> yea. would be cool.
[17:03:02] <Xark> Jartza: Run-length graphics mode? :)
[17:03:26] <Jartza> https://drive.google.com/file/d/0B2dTzW9TMeBxRDhYenFkdjI5bWs/view
[17:04:10] <Jartza> well, like that. currently only supports one color per 2*4 pixel block
[17:04:15] <Xark> Hehe, very VIC-20 worthy. :)
[17:04:21] <Jartza> also split-screen
[17:04:48] <Jartza> there's escape code to tell what row text mode starts from
[17:05:19] <Jartza> 0=full text, 16=full graphics and anything in between is split-screen
[17:05:20] <cehteh> Jartza: should work .. you can load different font sets (aka pixel fonts) on each avr
[17:06:51] <Jartza> like, 64*32 pixels graphics + 32*8 characters text
[17:07:13] <Jartza> or 64*48 and 32*4 or... configurable
[17:07:28] <cehteh> when do you add turtle graphics? :)
[17:07:32] <Jartza> hehe
[17:07:34] <Jartza> never
[17:07:39] <Jartza> :D
[17:10:13] <cehteh> you have some time in vblank, you have some flash left, it doesnt need much state, maybe you find some bits somewhere
[17:11:02] <cehteh> 2 bytes state should suffice for x:y and color
[17:14:45] <cehteh> haha you use external OSC. do you use OSCCAL already as register?
[17:16:07] <Jartza> nope
[17:17:10] <Jartza> internal clock is not stable enough for vga
[17:17:57] <cehteh> yes .. i meant when you have external clock, you can abuse it as normal data register
[17:18:12] <Martin90> hmm how does xmega change push pull configuration to open drain ?
[17:18:16] <Jartza> I still have GPIOR2 free :)
[17:18:36] <Martin90> I have heard that this is possible from soft..
[17:19:06] <Jartza> Martin90: it doesn't. output = push-pull, input = hi-z
[17:19:36] <Martin90> so where is that open drain conf ?
[17:19:40] <cehteh> wow :) so you have 2 bytes for spare
[17:23:17] <Xark> Jartza: There might even be a few other bits in various HW regs you can re-purpose. :)
[17:23:39] <Jartza> yes
[17:23:43] <Jartza> like eeprom
[17:24:02] <Jartza> Martin90: why you need open-drsin?
[17:24:04] <Jartza> drain
[17:24:35] <Jartza> except I might use eeprom still
[17:24:45] <Jartza> as screen save/restore :)
[17:24:52] <Martin90> Jartza, my question is not about any practical needs, I just wanted to know how output and input pin are configured inside
[17:25:17] <Martin90> I've heard that there are two configurations namely: push-pull and open drain
[17:25:37] <Jartza> Martin90: datasheet has exact schematic equivalent of gpio pins
[17:25:41] <Martin90> so I want to know where is each of them used
[17:26:13] <Jartza> output is hi-z
[17:26:15] <Jartza> :)
[17:26:30] <Jartza> with optional internal pull-up
[17:26:37] <Martin90> high impedance right ?
[17:26:40] <Jartza> oops. input of course
[17:26:42] <Jartza> yes
[17:26:48] <Jartza> output is push-pull
[17:26:56] <Martin90> but how is internal transistor configured,
[17:27:11] <Martin90> how can it be once push pull and other time something else
[17:27:22] <Jartza> each general pin can be set either as input/output and pullup enabled/disabled
[17:27:34] <Jartza> check datasheet
[17:27:46] <Jartza> there's schematic of io pins
[17:28:22] <Martin90> hmm
[17:28:25] <Martin90> I cna't find it
[17:28:36] <Martin90> I am riding atmega16a doc now
[17:28:42] <Martin90> reading*
[17:31:21] <cehteh> what do you want to do? switch between high-z and open collector?
[17:32:14] <Jartza> http://imgur.com/shqFmfI
[17:32:49] <Jartza> http://imgur.com/Rg8TCT1
[17:33:10] <Jartza> found them in few minutes even with phone
[17:34:35] <Martin90> heh, thanks but from first pic you posted, this is not push pull, it's single transistor
[17:35:46] <cehteh> the driving transistors are nowhere in the graphics :D
[17:36:27] <cehteh> but its quite simple, for digital io the state of a port is defined by 2 bits one in DDRx and one in PORTx
[17:36:55] <cehteh> there you get 4 states .. high, low, highz, pulled up
[17:38:01] <Martin90> cehteh, yes thanks
[17:38:40] <cehteh> (and the global PUD flag .. )
[17:38:49] <Martin90> cehteh, the driving transistors are always in push-pull configuration ?
[17:39:18] <cehteh> what else?
[17:39:55] <Martin90> I have heard that it also may be configured as open drain
[17:40:01] <Martin90> single transistor...
[17:40:11] <Martin90> that's what I am asking from start...
[17:41:04] <cehteh> thats just using one of them and switch betwen input/output (DDR) and not switch the outputs high/low (PORTx) bit
[17:43:29] <Martin90> cehteh, thank you, in open drain conf, we can't really set output as high right ?
[17:43:53] <cehteh> that would be push-pull :D
[17:44:23] <Jartza> well the pics + text in those images tell all
[17:44:24] <Martin90> sure, thanks ;)
[17:44:31] <cehteh> as shown earlier you can swithc the outputs between the 4 states
[17:44:36] <cehteh> err pins
[17:45:14] <cehteh> some changes may require 2 instructions, which usually doesnt harm just consider in what order you do it
[17:45:51] <cehteh> pulled up to open drain , or highz to high
[17:45:56] <cehteh> and vice versa
[17:46:33] <Martin90> ok, thanks ;)
[19:58:08] <d25af6e2a> Hey all, so I'm trying to set-up external interrupts on my m328p, but I can't understand why the external interrupt is firing when nothing is even connected to the pin
[19:58:29] <LeoNerd> Is it floating?
[19:58:45] <d25af6e2a> LeoNerd: you may have just saved the day
[19:58:54] <d25af6e2a> it didn't occur to me to check that, thank you!
[19:58:57] <LeoNerd> Unless you've specifically enabled the pullup,... :)
[20:00:23] <d25af6e2a> .... and it seems that that was the problem
[20:00:35] <d25af6e2a> wow, thank you, I don't think I ever would have checked that
[20:01:25] <d25af6e2a> to be sure though, just in case, does this MWE look about right? http://ix.io/mVn
[20:02:29] <d25af6e2a> (for getting rising edge interrupt on INT0)
[20:03:27] <LeoNerd> Mm. :) It's always something simple you forget about
[20:05:19] <d25af6e2a> LeoNerd: thank you, have an internet cookie. I'm off to do more building stuff!
[20:05:32] <LeoNerd> :) goodluck
[20:11:53] <rue_house> #define OUTPUT 1
[20:11:53] <rue_house> #define INPUT 0
[20:11:53] <rue_house> DDRA = (OUTPUT << PA0 | OUTPUT << PA1 |OUTPUT << PA2 |OUTPUT << PA3 |OUTPUT << PA4 |INPUT << PA5 |INPUT << PA6 |INPUT << PA7);
[20:12:55] <Casper> hmmm not bad
[20:15:45] <rue_house> now lets see yours
[20:30:06] <rue_house> cmon, someone post a code snippet
[20:30:17] <rue_house> one that could be even semi usefull
[20:31:41] <cehteh> http://git.pipapo.org/?p=dinoheat;a=blob;f=Dino.h#l16 :D
[20:31:52] <rue_house> bah
[20:32:04] <rue_house> something small that fits in channel
[20:32:30] <cehteh> ;
[20:32:55] <cehteh> most useful snippet .. forget one semicolon and you are doomed
[20:34:00] <rue_house> thats crazy
[20:37:05] <osteri> (c) 20013 from future?
[20:40:42] <Casper> uint8_t buffer[7]; uint16_t i = 16300; char j; utoa(i, buffer, 10); uart_puts(buffer);
[20:40:46] <Casper> happy rue_house ?
[20:41:58] <rue_house> I'm trying to stay awake
[20:42:11] <rue_house> my math program can convert from ascii but not to it
[20:42:49] * Casper looks at rue_house, grinds, and bring closer his powered up tig torch
[20:42:53] <Casper> 150A shall do the trick
[20:45:19] <rue_house> calc "16300(ResultBase=16)"
[20:45:20] <rue_house> 16300(ResultBase=16) -->> 0x3FAC
[20:45:34] <Casper> atol
[20:46:22] <Casper> now.... can I secure this argon bottle in the storage area... or must I absolutelly install hooks... hmmm
[20:46:42] <rue_house> its really suggested to cahin it upright
[20:47:10] <rue_house> its got like 3000psi in it, if it falls over and the top breaks off, unpleasant things usually happen
[21:24:50] <Casper> rue_house: yeah I found 2 piece of wood where I can screw some hook
[21:24:55] <Casper> and it's some baby bottles
[21:25:04] <Casper> about 28" with the cap
[21:25:19] <Casper> but I don't understand...
[21:25:41] <Casper> why do they say to store upright and also use upright when it's just gas and no liquid?
[21:27:23] <Casper> but I want to see the unit work on 240V on flux core mig
[21:27:59] <Casper> the unit seems wayyyyy more happier on 240V with tig than it was on 120V with mig... however, different process mean different stuff
[21:59:20] <rue_house> ok
[22:11:40] <Casper> rue_house: http://i.imgur.com/ICsmatn.jpg :D
[22:11:56] <Casper> and don't mind the floor...
[23:07:14] <rue_house> thats a kit!
[23:07:20] <rue_house> good show
[23:07:42] <rue_house> carefull of the duty limits
[23:19:35] <Casper> quite high actually
[23:21:33] <Casper> on mig, 100% at 19.5V, that's good for like 1/8"
[23:23:07] <Casper> on tig, 100% at 100A, that's about 1/8 too
[23:23:23] <Casper> on stick, also 100% 100A
[23:23:56] <Casper> so yeah, the duty is high enought