#avr Logs

Oct 13 2018

#avr Calendar

05:03 AM nabil_ is now known as nabil
05:09 AM gruetzko- is now known as gruetzkopf
09:40 AM gruetzkopf is now known as gruetze_
11:33 AM MarcinWieczorek_ is now known as MarcinWieczorek
11:36 AM [1]MrMobius is now known as MrMobius
12:10 PM rue_bed: --
02:25 PM gruetze_ is now known as gruetzkopf
02:42 PM guanche: hi
02:45 PM guanche: is it possible, with discrete components, to make an xor somehow? I'd like to use an external pullup to control whether vcc goes one way or the other depending on the state of a gpio pin in particular
02:56 PM rue_mohr: yes
02:56 PM rue_mohr: guanche, still there?
02:59 PM guanche: yes rue_mohr
02:59 PM rue_mohr: your looking for an xor?
02:59 PM guanche: yes, with a single gpio pin
02:59 PM rue_mohr: hu?
02:59 PM rue_mohr: xor gates dont ahve gpio pins
03:00 PM guanche: no, I want to make one for an atmega circuit
03:00 PM rue_mohr: or you mean for input
03:00 PM rue_mohr: you have to tell me more, what your asking for dosn't make sense
03:00 PM guanche: such that, when in a default state vcc goes one way, and when the pin is high it gets diverted
03:00 PM rue_mohr: still dosnt' add up
03:01 PM rue_mohr: you have two inputs right?
03:01 PM rue_mohr: and their either 0V or 5V
03:01 PM rue_mohr: and you want to do something with them
03:01 PM guanche: no, I want to wire an xor function using a single gpio pin
03:01 PM guanche: say, that when the mcu boots (power is given)
03:01 PM rue_mohr: so you want an xor gate with 1 input and 1 output
03:02 PM rue_mohr: you have to tell me what you want to do, not how you want to do it
03:02 PM guanche: vcc is going to a suucircuit, and when I take control of that pin, I can divert vcc to another subcircuit, but there's always one function running
03:02 PM rue_mohr: aka, stop saying xor and tell me what you want to do that your trying to use an xor for
03:03 PM rue_mohr: your getting closer
03:03 PM rue_mohr: make up a drawing!
03:03 PM guanche: ok, that would be easier hehe, I'm make it and give you a shout
03:10 PM guanche: https://imgur.com/pNGgkqU
03:10 PM guanche: that's the most I can simplify it
03:10 PM guanche: I have two subcircuits, denoted with a led and a resistor each, and I want either of one to be on the full time depending on the state of GPIO PIN
03:10 PM guanche: rue_mohr:
03:11 PM Thrashbarg: do you want one LED on and the other off, and when you switch the state of the GPIO pin it switches the LED's?
03:12 PM guanche: yes, so at boot, one is on, and when I take control of the gpios, I can switch to the other, if wanted, much like an "enable" pin
03:12 PM Thrashbarg: you can do that with a simple transistor inverter
03:12 PM Thrashbarg: the first LED is connected to the GPIO pin, along with the transistor, and the second LED is connected to the transistor
03:13 PM guanche: but I'd like to have both under transistors, so that I can handle a bit more current than using the gpio pin
03:14 PM Thrashbarg: sure
03:18 PM guanche: so, how would it be then?
03:23 PM Thrashbarg: https://www.dropbox.com/s/c9ju6k4yfmock2u/LED_inverter.png?dl=0
03:23 PM Thrashbarg: I believe that will do it
03:27 PM guanche: thanks, I'l try it
03:29 PM Thrashbarg: though change the 10k's to 1k
03:30 PM Thrashbarg: there won't be enough current through the transistor to drive it if 10k's are used
03:41 PM guanche: thanks a lot, that works like a charm!
03:42 PM Thrashbarg: nice
03:42 PM guanche: have been pulling my hairs out with this one, I could do it as you first said, which is with the first led being driven by the gpio, and the second one behind an npn, but couldn't think of this way
03:43 PM Thrashbarg: it's made more tricky because of the way BJT's work
03:43 PM Thrashbarg: they amplify current, not voltage
03:46 PM guanche: I'll try and see if I can improve it at all tomorrow, to reduce consumption
03:46 PM guanche: thanks so much, bye!
05:09 PM rue_mohr: where did I use a compressed state machine?
05:26 PM rue_mohr: // address compressed LUT, see the excel spreadsheet.
05:26 PM rue_mohr: uint8_t table[] = { 0, 0, 0, 0, 41, 0, 10, 1, 1, 1, 16, 2, 28, 35, 2, 16, 3, 24, 3, 3, 16, 4, 4, 32, 4};
05:26 PM rue_mohr:
05:26 PM rue_mohr: idx = state*5+eventCode; // thats address compression for ya.
05:26 PM rue_mohr: state = table[ idx ] & 0x07;
05:26 PM rue_mohr: ok
09:16 PM davor_ is now known as davor
11:53 PM day__ is now known as day