#avr | Logs for 2015-04-20

Back
[02:52:59] <Elec_A> Hello, I have a 'char' Variable and I want to assign it to high bits of PORTB. how can i do that ?
[02:53:35] <DO9XE> Elec_A, which one exactly?
[02:55:17] <Thrashbarg> Elec_A: I figure you're after the bit-shift operation?
[02:56:00] <Elec_A> yes
[02:56:01] <DO9XE> or he just wants to write 3 of 8 pins
[02:56:21] <Elec_A> something like 0x(char)A
[02:56:30] <Elec_A> or 0x(char)0
[02:56:38] <Thrashbarg> Elec_A: right so you're shifting by four bits?
[02:56:42] <Elec_A> yes
[02:56:56] <Thrashbarg> PORTB = (char<<4)|0x0A;
[02:57:13] <DO9XE> Thrashbarg, damn you were faster ;D
[02:57:20] <Thrashbarg> heh
[02:57:42] <Thrashbarg> i.e. shift char left by four bits and logically OR 0x0A to the bottom four bits
[02:58:06] <DO9XE> PORTB = ((char<<4)&0xF0)|0x0A; <- how i would do it, just to make save :)
[02:58:09] <Elec_A> and if i want to keep lower bits of PORTB , is it correct : PORTB = (char << 4) | PORTB ?
[02:58:42] <Thrashbarg> DO9XE: that's one option but the shift operations are arithmetic shifts, they insert 0's into the register
[02:58:50] <Elec_A> or PORTB = (char << 4) | PINB ?
[02:58:54] <Thrashbarg> Elec_A: not quite ...
[02:59:08] <Thrashbarg> PORTB = (char<<4) | (PORTB & 0x0F);
[02:59:16] <Thrashbarg> mask off the top four bits of PORTB
[02:59:36] <Elec_A> Why did you do that ?
[02:59:52] <Elec_A> why PORTB = (char << 4) | PORTB is wrong ?
[03:00:06] <Thrashbarg> because if the four left bits already contain 1's they'll be ORed too
[03:00:10] <Thrashbarg> so mask them out
[03:00:14] <Thrashbarg> and OR the new bits in
[03:00:58] <Elec_A> Thrashbarg: I didn't get it
[03:01:57] <Thrashbarg> e.g. if PORTB is already 10011010 (0x9A) and you OR 0x20 it'll become 0x20=0010000 | 10011010 = 10111010
[03:02:37] <Thrashbarg> but if you set the top four to zero first, then OR it in you'll get the correct value of 00101010
[03:02:50] <Elec_A> Thrashbarg: oh thank you !
[03:02:55] <Thrashbarg> np
[04:55:17] <EI24> hi, if i increment a register that is full(0xFF), will overflow to 0x00?
[05:37:12] <Ad0> has anyone set atmel stuff up in visual studio 2012 or 2013?
[05:40:18] <Xark> Ad0: Why bother with Atmel studio (same deal with nice custom extras and free Visual Assist)?
[05:42:10] <Ad0> I just wondered
[05:42:15] <Ad0> if there's any advantage
[08:58:34] <Ad0> I have a 200 ms delay and it's blinking almost randomly
[08:58:42] <Ad0> is there some clock speed problems maybe?
[10:42:38] <abferm> Is there a good XMEGA library for I2C eeproms and RTCs? I'm trying to work with a CAT24C256 and a DS1307 on the same bus.
[10:43:33] <LeoNerd> Ah you bought one of those boards, eh? ;)
[10:43:49] <LeoNerd> It seems every single DS1307 comes with a 24Cx chip attached
[10:43:53] <LeoNerd> I've no idea why...
[10:49:22] <abferm> Nope, designed my own. It is an expansion board for the BBB, but we are doing testing using an XMEGA. 24C is to store board identifiers, etc.
[10:49:51] <LeoNerd> huh.. .weird.
[10:50:05] <LeoNerd> I still wonder why most boards do that
[10:51:24] <abferm> As an example of having more than one device on the I2C bus?
[10:51:45] <LeoNerd> Perhaps... but it seems you just can't buy a DS1307 board on its own without one of those
[10:52:03] <LeoNerd> And it's not as if the DS doesn't *already* have some battery-backed bytes of RAM
[11:00:11] <abferm> I'm finding a bunch of atmega drivers, but I'd prefer not to spend a bunch of time porting if I don't have to.
[11:01:15] <LeoNerd> I seem to recall both are pretty trivially simple, no?
[11:01:33] <LeoNerd> Perform a write-then-read request writing the register number, then reading some bytes
[11:36:51] <markm> got a problem here, customer came in with a sensor board they produce. my boss says "We can read data from any device" and now they are saying "prove it"
[11:37:12] <markm> well. all i know about this device is its an Atmel Usb Device: EFM32 Vendor Unique Device
[11:37:21] <markm> it does not show as a CDC device so no com port
[11:37:31] <xrlk> nice
[11:37:32] <markm> how would i communicate with this ? $^*$Y^(!
[12:13:23] <Tom_itx> markm, ask your boss?
[13:35:15] <Steffanx> EFM32 .. sounds more like silabs (or energy micro)
[15:13:01] <LeoNerd> Anyone tried talking DMX *and* WS2812 LEDs at the same time?
[15:13:08] <LeoNerd> Both seem to have annoyingly precise timing requirements
[16:56:43] <twnqx> LeoNerd: only ws2812b and pl<whatever they are>
[16:56:45] <twnqx> painful enough
[18:06:09] <Ad0> LeoNerd: I got the nf
[18:57:56] <LeoNerd> Ad0: the nf?
[18:58:31] <Lambda_Aurigae> nano farad
[18:59:50] <LeoNerd> I'm not sure I understand,,,
[19:00:13] <Lambda_Aurigae> nf = nanofarad
[19:00:27] <LeoNerd> Yesyes
[19:00:43] <LeoNerd> <Ad0> LeoNerd: I got the nf <=== ??
[19:01:01] <Lambda_Aurigae> he saying he has a little bitty farad?