#avr | Logs for 2013-04-24

Back
[00:36:40] <xelion> Hi guys! I need help converting raw ADC input from a 10k NTC on ATmega8. I want to display the result on an LCD, but I can only see ASCII characters? I program in asm. regards!
[00:38:12] <OndraSter> get a sample
[00:38:16] <OndraSter> turn it into bcd
[00:38:22] <OndraSter> and then add '0'
[00:38:25] <OndraSter> to each character
[00:38:29] <OndraSter> and you have got it in ASCII
[00:40:25] <xelion> OndraSter: I'm not sure I follow? I already have the value displayet as ASCII. I need a way to quantize it. My Vref is 5V in 8-bit ADC mode.
[00:44:43] <xelion> the ASCII's change according to heat on the NTC, so I know I have the right setup and code. I just need to get the raw ADC value converted into something like "(raw_ADC / 5)(255)?
[01:05:58] <OndraSter> do that
[01:06:08] <OndraSter> raw_ADC/256 * 5
[01:06:17] <OndraSter> (or the opposite, to avoid fractional numbers)
[01:21:26] <xelion> OndraSter: I'll try that. Thx.. I'm really getting some strange ASCII characters on the display :/
[02:03:56] <rue_bed> 256?
[02:04:00] <rue_bed> 10 bit adc
[02:04:06] <rue_bed> 1023
[02:04:12] <rue_bed> cause its 0-1023
[02:04:29] <rue_bed> 8 bit mode?!
[02:04:31] <rue_bed> why?!
[06:18:31] <powderhound> Anyone know the minimum baud rate for an xmegaA4? I'm trying to hit 100 (BSEL and BSCALE work out).
[06:34:16] <Horologium> I'm sure it depends on the processor speed.
[06:34:30] <Horologium> I know the mega and tiny chips rely on the main clock speed anyhow.
[07:07:47] <xelion> Horologium: can you point my in the right direction as to how to convert ASCII into DEC in asm?
[07:43:51] <powderhound> Horologium: It appears that as long as the BSEL/BSCALE values are in range, it'll function
[07:44:01] <powderhound> I just got this running at 100 baud
[08:27:17] <hetii> Hi :)
[08:28:37] <hetii> I just dis solder mic37302 LDO, any clue what kind of R1.R2 could be to have output set to 3.3v ? :)
[08:28:59] <r00t|home> rtfdatasheet?
[08:29:10] <hetii> http://circuits.datasheetdir.com/40/MIC37300-circuits.jpg
[08:29:18] <hetii> I read it and i don`t found this informatiomn
[08:29:36] <r00t|home> that is not the datasheet... it's taken FROM the datasheet
[08:29:58] <r00t|home> http://www.google.com/search?q=mic37302+datasheet
[08:31:18] <r00t|home> http://te-epc-lpc.web.cern.ch/te-epc-lpc/components/datasheets/te-epc%20(fgc-dccts)/fgclite/MIC37300-301-302_Voltage%20regulator_Micrel.pdf
[08:31:19] <r00t|home> page 10
[08:32:01] <r00t|home> R1=R2*(Vout/1.240-1)
[08:32:16] <r00t|home> normal people will just connect a pot and adjust it until the output voltage is as desired
[08:32:42] <hetii> yes now i see it, i download some other pdf where i don`t have those information.
[08:33:17] <hetii> I have no space in my case to use a pot.
[08:33:38] <r00t|home> you can still use a pot for testing, and then measure it to get the resistor values
[08:33:53] <hetii> Thats true.
[08:43:31] <OndraSter_> we found a bug at school in PuTTY
[08:43:45] <OndraSter_> well, I found it, but the teacher diagnosed it (because I do not wear a scope with me everywhere I go)
[08:44:13] <OndraSter_> when using serial port, the baudrate is actually a half
[08:44:23] <OndraSter_> so to use 1200 baud I had to enter 2400
[08:51:02] <Grievre> OndraSter_: seems more likely it's a bug in the serial port driver. Or that you were basing the divider in your AVR on half of what the actual clock speed was
[08:59:49] <OndraSter_> Grievre, AVRprog works
[09:00:04] <OndraSter_> it was combination of the board's driver and putty
[09:02:37] <OndraSter_> probably
[09:10:17] * megal0maniac packs PC into a box
[09:10:24] <megal0maniac> Goodbye, PC :'(
[09:11:02] <OndraSter_> why?
[09:11:44] <megal0maniac> I am being a little dramatic I suppose.. The SSD and mobo don't play well. ~5 minutes of uptime and I get unresponsive Windows then BSOD
[09:11:53] <OndraSter_> why are you packing the PC?
[09:11:55] <OndraSter_> throwing it out?
[09:12:24] <megal0maniac> No, sending the mobo, cpu, ram and ssd back to the supplier to be fixed
[09:12:29] <OndraSter_> oh
[09:12:57] <OndraSter_> damnit, why is it downloading garbage when not using Fiddler, but when I use fiddler and the traffic goes through that it downloads fine? (Mouser)
[09:13:32] <megal0maniac> Depends on what the garbage is..
[09:13:43] <OndraSter_> literally garbage
[09:14:04] <megal0maniac> Gross
[09:14:24] <OndraSter_> megal0maniac, http://clip2net.com/s/4Y4Ra7
[09:14:55] <megal0maniac> Aha..
[09:15:10] <megal0maniac> Is it supposed to be html?
[09:15:14] <OndraSter_> yes
[09:16:15] <OndraSter_> with fiddler: http://clip2net.com/s/4Y4Twq
[09:16:30] <OndraSter_> works
[09:16:33] <OndraSter_> it is one giant wtf
[09:16:59] <megal0maniac> Heh :)
[09:17:07] <megal0maniac> How does fiddler intercept?
[09:36:56] <OndraSter_> it works as a proxy
[09:37:00] <OndraSter_> I usually use it to sniff data
[09:59:46] <megal0maniac> That makes no sense at all :)
[10:13:15] <OndraSter_> http://clip2net.com/s/4Y6j1S
[10:13:15] <OndraSter_> IT'S ALIVEEEE
[10:13:27] <megal0maniac> What was wrong?
[10:15:37] <OndraSter_> nothing
[10:15:37] <OndraSter_> but I just made a firs tBOM :P
[10:15:37] <OndraSter_> first BOM
[10:15:59] <megal0maniac> Congrats then :)
[10:16:07] <megal0maniac> Through fiddler?
[10:17:37] <OndraSter_> it often works without it too
[10:17:37] <OndraSter_> but it sometimes downloads rubbish
[10:17:49] <megal0maniac> Blame mouser :)
[10:18:46] <OndraSter_> yep :D
[10:18:46] <OndraSter_> I will
[10:18:46] <OndraSter_> because with farnell it works always ok
[10:20:29] <megal0maniac> "Total price:166.58*"
[10:20:32] <megal0maniac> :(
[10:21:09] <megal0maniac> But I guess 17* each...
[10:21:16] <megal0maniac> Still, it's a lot of money :P
[10:21:46] <Steffanx> * = ?
[10:21:54] <megal0maniac> EUR
[10:21:59] <Steffanx> lol
[10:22:07] <megal0maniac> I'm just copying what other people here seem to do
[10:22:15] <megal0maniac> OndraSter_ is guilty of it
[10:23:36] <OndraSter_> that is EUR
[10:23:36] <OndraSter_> and for 10 boards
[10:23:37] <OndraSter_> (as you can see on the left)
[10:48:41] <r00t|home> <OndraSter_> damnit, why is it downloading garbage when not using Fiddler, but when I use fiddler and the traffic goes through that it downloads fine? (Mouser)
[10:49:15] <r00t|home> common cause is fuckup with transfer compression, as in, you are seeing compressed data where it should be plain
[10:53:37] <OndraSter_> hmm
[10:53:39] <OndraSter_> sounds possible
[10:54:15] <OndraSter_> I am not sending that it can use gzip
[10:54:15] <OndraSter_> I would expect the C#'s WebClient to ungzip it even if possible
[10:54:31] <OndraSter_> oh
[10:54:31] <OndraSter_> it is built-in
[10:54:35] <OndraSter_> but not enabled by default
[10:56:49] <r00t|home> there are some fucked-up servers that will serve compressed data to clients not indicating supprt for it (like anidb.net )
[10:57:35] <r00t|home> it can also happen if a cache caches a compressed response and then serves it to _another_ client not supporting compression (something like lack of "Vary: Transfer-Encoding")
[10:59:43] <OndraSter_> thanks r00t|home
[11:00:17] <OndraSter_> taken care of
[11:00:17] <OndraSter_> now it should auto decompress
[11:00:41] <OndraSter_> I was sending
[11:00:41] <OndraSter_> Accept-Language: cs-CZ
[11:00:41] <OndraSter_> Cache-Control: no-cache
[11:00:41] <OndraSter_> Cookie: Mobile=false; preferences=ps=cz&pl=cs-CZ&pc_cz=EUR&pc_eu=EUR&pc_ca=CAD&as=1&pc_in=USDu&pc_de=EUR&pc_www=USDu
[11:00:41] <OndraSter_> Accept: text/html, application/xhtml+xml, */*
[11:00:41] <OndraSter_> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
[11:00:46] <OndraSter_> only this
[11:01:18] <OndraSter_> in headers
[11:04:02] <r00t|home> the server might assume that IE9 supports compression ;)
[11:05:04] <OndraSter_> but I am not telling it
[11:05:05] <OndraSter_> that it can :P
[11:05:41] <OndraSter_> Opera sends out the compression
[11:05:41] <OndraSter_> the mouser is funny - unless you set the cookies, it will keep redirecting you between CZ and IT version
[11:05:55] <OndraSter_> (and then your code graceful "crashes" with "too many redirections, stopping"
[11:06:33] <OndraSter_> after about 10 or 15 or w/e is the default limit
[11:06:47] <xelion> IM GOING CRAZY HERE! Why the F is nobody programming in asm anymore???
[11:07:37] <OndraSter_> lol
[11:07:37] <OndraSter_> I was today
[11:07:37] <OndraSter_> on AVR Butterfly
[11:07:37] <OndraSter_> at school
[11:07:38] <OndraSter_> but I can't imagine writing USB stack in ASM
[11:07:38] <OndraSter_> I am not crazy enough
[11:07:53] <xelion> :D
[11:08:37] <OndraSter_> asm is not worth it except few projects
[11:09:32] <xelion> asm is the only reasonable approach in embedded systems IMHO
[11:09:40] * tzanger chuckles
[11:09:46] <OndraSter_> eh
[11:10:04] <r00t|home> for SOME definition of "embedded"
[11:10:50] <tzanger> anyone programming in asm other than for self-interest, academic or VERY specific reasons particular to the project is clearly inexperienced
[11:11:19] <xelion> right
[11:12:01] <xelion> tzanger: and you on the other hand, the great oracle of programming, is?
[11:12:27] <tzanger> I love asm, and I'm fluent in it on a number of architectures/platforms. but if you're doing it out of some ideology you're no different than the other language zealots
[11:13:01] <tzanger> xelion: please tell us why asm is the only reasonable approach for embedded systems?
[11:13:46] <xelion> It's not that i don't like high-level programmin or anything, but I like to up-front when interacting with my hardware, and the only way I can do this, is by using asm.
[11:14:04] <tzanger> I'm talking in general. I'm not talking for specific reasons that absolutely dictate the use of asm
[11:14:32] <xelion> embedded "electronics" systems, was of course what I ment
[11:14:42] <tzanger> xelion: that's bullshit. after setting up the stack and zeroing BSS you can write bare metal in C without any issues whatsoever
[11:14:46] <Grievre> Because if you believe in doing something yourself instead of having computers do it for you, why are you even using computers at all
[11:15:38] <xelion> I swear to asm, and there's nothing you or anybody can do to change it;) that's funny!
[11:15:42] <tzanger> bit-level access is trivial in C, and carries all the same caveats that bit-level access in asm would have
[11:16:31] <r00t|home> xelion: so where's your pure asm usb stack? and tcp stack?
[11:16:45] <tzanger> oh I'm not trying to change your mind. I'm just questioning your motives. you're not the first person I've run across with the same kind of beliefs, and all of you are entitled to them.
[11:17:33] <tzanger> however your beliefs allow me to make some observations/deduce some aspects of the type of person you are based on those beliefs. This isn't a bad thing.
[11:17:58] <r00t|home> lol
[11:18:30] <tzanger> obviously it doesn't mean I know you, but I can make some pretty good assumptions about you based on your beliefs and based on my experience with people sharing those beliefs. :-)
[11:18:54] <xelion> I believe, that understanding asm (not that I'm a guru or anything), makes it easier to understand other programming languages.
[11:19:03] <tzanger> you are *absolutely* right
[11:19:42] <tzanger> understanding the ISA of a processor is key to being able to use it effectively
[11:19:56] <xelion> r00t|home: what is it you actually want me to show you?
[11:20:41] <tzanger> I can show you a computer built in Minecraft... doesn't mean it's something that is useful beyond entertainment/amusement/trivia :-)
[11:22:07] <xelion> tzanger: nah, not into minecraft;) thx anyway
[11:22:39] <tzanger> xelion: I used to think along the same lines as you. I wrote some interesting stuff in pure asm, and admired people who could write bigger/better things in pure asm
[11:22:44] <r00t|home> xelion: asm code?
[11:23:00] <tzanger> then the Pentium came along and I started realizing how silly this was becoming
[11:23:09] <r00t|home> xelion: the point that me (and others) are tyrying to make is that projects of certain complexity are hard to implement (and maintain!) in asm
[11:23:10] <tzanger> I also started noticing girls around that age too, and all bets were off
[11:24:03] <tzanger> that's why I am willing to bet you're inexperienced in the field of embedded systems development/embedded software. I was there. I was that guy. I grew out of it and can still recognize the thought processes.
[11:24:51] <xelion> r00t|home: oh. I am sure you are right about maintaining and contructing larger programs in asm. My primary drive when I started learning asm was like you say, because I admire those who can write complex stuff (and I want to be one of them)
[11:26:05] <xelion> tzanger: interresting;) I am in fact n00b in the field of asm.. just barely coming to grips with the basics now;)
[11:27:41] <tzanger> holy shit
[11:27:44] <tzanger> I found it
[11:27:57] <tzanger> John McCarthy developed a pure-asm 3d engine for 80386
[11:28:01] <tzanger> I remembered he did it but not his name
[11:28:03] <xelion> found what?
[11:28:04] <xelion> oh
[11:28:04] <tzanger> found the source code
[11:28:07] <xelion> nice
[11:28:22] <xelion> I mean, crazy!
[11:28:53] <tzanger> xelion: see... inexperience. :-) learn asm, it's good for you and helps you understand C
[11:29:29] <tzanger> look for 3dvect39.zip if you're interested
[11:29:35] <tzanger> god that brings back memories
[11:29:39] <tzanger> I should look him up on linked in
[11:31:09] <tzanger> wtf
[11:31:17] <tzanger> I found osme of my ancient code looking for more about him
[11:31:18] <tzanger> http://mytears.org/resources/doc//Assembly/ASNIP11/ASNIP11X/CODE/MACROS.INC
[11:31:30] <tzanger> '94 wow
[11:31:55] <xelion> sweet!
[11:33:11] <tzanger> found him: http://johnmccarthy.ca/outerridge/
[11:34:34] <xelion> tzanger: maybe you can help me out? I'm trying to convert a binary value from ADC on an ATmega8 to a voltage. I'm only using the lower byte of the ADC, but the output to my LCD is recognized as ASCII? any suggestions?
[11:35:17] <tzanger> sure
[11:35:20] <tzanger> what ahve you got so far
[11:35:47] <xelion> Iv'e only managed to print the binary value to my LCD at present time
[11:36:02] <tzanger> "the binary value" ?
[11:36:05] <tzanger> the raw ADC result?
[11:36:14] <xelion> yes, raw ADC result'
[11:37:06] <tzanger> ok
[11:37:12] <xelion> here's my source: https://dl.dropboxusercontent.com/u/11778919/exe.s
[11:37:13] <tzanger> well what can you tell me about what an ADC does
[11:37:26] <tzanger> (I'm not being facetious, I'm genuinely trying to help)
[11:38:58] <xelion> well, in a nutshell, it converts an analogue value (like a voltage) to a binary value, by continuously sampling the input, and making an approximation relative to the reference voltage used
[11:39:12] <xelion> right?
[11:39:33] <xelion> oh, don't mind the dansih coments in the surce
[11:39:35] <xelion> :d
[11:40:25] <tzanger> not bad
[11:40:41] <tzanger> so if I have an 8 bit ADC, what are the range of values that come out of it?
[11:40:52] <xelion> 0-255
[11:41:02] <xelion> 2^8
[11:41:08] <tzanger> yes. Now if it gave me a result of 64, what does that tell you about the input analogue voltage?
[11:41:22] <xelion> 1/4th of the ref
[11:41:26] <tzanger> exactly
[11:41:29] <tzanger> that's important
[11:41:37] <xelion> ok
[11:42:05] <tzanger> so in order for you to convert that ADC value to a number representing the input voltage, you need to scale the result so that 255 = vref
[11:42:14] <tzanger> (in our example)
[11:42:33] <xelion> 255 = Vref, okay
[11:42:37] <tzanger> val / maxval = ? / vref
[11:42:50] <tzanger> standard ratio math
[11:43:13] <tzanger> val * vref / maxval = val_in_volts
[11:43:26] <xelion> yes
[11:43:28] <tzanger> the order there is important, you're dealing with finite storage
[11:43:42] <tzanger> if you do val/maxval you end up with a fraction and that makes it harder to deal with on a micro
[11:43:53] <tzanger> so you say val * vref / maxval to try to maintain some precision
[11:44:02] <tzanger> you can upscale things too if you need, but try that first
[11:44:11] <xelion> okay
[11:44:52] <tzanger> so for a 12 bit dac with a 2.048V reference you'd do something like adc_value * 2048 / 4096, and you would have the adc_value in mV
[11:45:41] <xelion> why is it referred to as DAC, and not ADC?
[11:45:51] <xelion> is it two different pathways?
[11:46:01] <tzanger> sorry I meant ADC
[11:46:04] <xelion> ah, ok
[11:46:05] <tzanger> DAC goes the other way
[11:46:09] <xelion> right
[11:46:47] <xelion> why is val = 2048?
[11:46:52] <tzanger> you can also use that to predict what the ADC value should be. e.g. you have a 125mV accurate voltage source and want to see what the ADC should show.
[11:47:22] <tzanger> 0.125/2.048 * 4096 = 250 counts
[11:47:26] <tzanger> oh
[11:47:34] <tzanger> well again, fractions are bad. :-)
[11:47:38] <xelion> hehe
[11:48:51] <tzanger> I just picked 2.048V for a reference (it's a nice reference for a 12-bit ADC/DAC because 1 count = 500uV
[11:49:42] <tzanger> and it fits in a 3.3V system nicely
[11:52:37] <xelion> so in my case, using only the lower byte (making it 8-bit) of the ADC registers, and a Vref of 5V, I wuld write 5/255 = 0.0196 volts (pr. quantum)
[11:52:40] <xelion> ?
[11:53:14] <xelion> 1 quantum = 1/255
[11:53:25] <tzanger> well be careful
[11:53:34] <tzanger> using only the low 8 bits doesn't give you an 8 bit ADC
[11:53:47] <tzanger> it gives you 4 8 bit ADCs stacked on top of one another
[11:53:52] <xelion> uh-oh
[11:54:02] <tzanger> because as you ramp from 0-vref you will overflow 0-255 4 times
[11:54:09] <tzanger> if you want to do that you truncate the LSBs
[11:54:17] <tzanger> take your 12 bit result and shift right twice and use that value
[11:54:25] <xelion> I need to specify to the MCU that I want to operate the ADC in 8-bit mode then?
[11:54:41] <tzanger> you can also do that, but leaving it 12b and shifting works fine
[11:54:54] <tzanger> fancier ADCs allow you to be left- or right-aligned too
[11:55:12] <tzanger> and yes your math is right for an 8-bit ADC. 20mV/count
[11:55:23] <xelion> yes, I noticed an ADLAR bit making the result left-adjusted
[11:55:57] <xelion> but I don't quite get this "shiting" stuff? shifting from ADCH to ADCL for ex.?
[11:56:34] <tzanger> no
[11:56:41] <tzanger> ADCH/L are both 8-bit regs
[11:56:58] <tzanger> so ADLAR=0 means bits 11-0 are value and bits 15-12 are 0
[11:57:21] <tzanger> ADLAR=1 left-justifies the result, so your 12-bit result is in bits 15-4 and 3-0 are 0s
[11:57:33] <xelion> but my ADC is only 10-bit max
[11:57:34] <tzanger> depending on your algorithm/uses it is sometimes advantageous to do that
[11:57:58] <tzanger> ok 10 bit would be 11-0 or 15-6
[11:58:32] <tzanger> and to convert a 10b result to 8b you'd shift right twice (/4)
[11:59:55] <xelion> yes, well. So ADCH = xxxxxx11, ADCL = 11101110 LSR = 11111011 ?
[12:00:27] <tzanger> what is "LSR" ?
[12:00:33] <xelion> shift right
[12:00:43] <xelion> Logical Shift Right
[12:00:46] <tzanger> yeah that looks right
[12:00:47] <xelion> :)
[12:01:14] <tzanger> that takes a 10 bit result and stuffs it into an 8-bit value by truncating the 2 LSBs
[12:01:34] <tzanger> the neat thing about doing that is that your ADC readings become less noisy
[12:01:52] <tzanger> it's got the same noise floor, but when you quarter the results you also quarter the noise :-)
[12:02:07] <tzanger> it's a standard resolution/noise tradeoff
[12:02:56] <xelion> how would I do this in assembly? If I used say R16 and R17 to store ADCL and ADCH respectively: LSR R17,R16, and then the new value is stored in R17?
[12:03:23] <xelion> nice thing regarding the noise-stuff;)
[12:08:48] <xelion> wait a minute... I think I need to use a register-pair instead?
[12:10:17] <xelion> apparently I can only shift 1 register right at a time. I'm really confused now :§
[12:13:56] <xelion> Hello register named ADCW :D
[12:16:51] <tzanger> why can't you do LSR R17; LSR R16; LSR R17; LSR R16
[12:17:09] <tzanger> (i.e. use the carry bit to carry the LSB from R17 to the MSB of R16
[12:17:14] <tzanger> then your 8b result is in R16
[12:17:28] <tzanger> I haven't done any AVR assembly so take my code as pseudocode
[12:21:01] <xelion> how do I use the carry bit? If ADCH has a value xxxxxx10, then the C gets set in SREG on the 2nd LSR, right?
[12:21:41] <xelion> of the register holding the ADCH value of course
[12:21:45] <xelion> sorry
[12:22:16] <xelion> tzanger: You have opened up many doors for me now!
[12:22:52] <xelion> I will tinker some more for now! Thx for helping me out! I really appriciate you helping me out!!!
[12:22:56] <tzanger> xelion: http://academy.cba.mit.edu/classes/embedded_programming/doc0856.pdf
[12:23:14] <tzanger> LSR shifts the operand right one bit, shifting a 0 into the MSB and shifting the LSB into C
[12:23:32] <tzanger> so no, you can't use LSR to "suck in" the LSB
[12:23:44] <tzanger> but you can use LSR and ROR
[12:24:02] <tzanger> LSR R17; ROR R16; LSR R17; ROR R16
[12:25:35] <tzanger> you could also use ROR for everything since you don't care about trashing R17
[12:25:41] <xelion> omg this is difficult to understand:/
[12:25:45] <tzanger> nah
[12:25:49] <tzanger> assembly is like lego
[12:26:02] <tzanger> you have to know what's in the bucket so you know what to dig for :-)
[12:26:31] <xelion> well, I was always good at disassembling Lego;) I just need to do it the other way now;)
[12:26:34] <tzanger> part of the trouble with knowing assembly on so many platforms is that you are sometimes digging in the bucket trying to remember a particualr instruction that's not there :-)
[12:27:17] <tzanger> I like assembly because it forces you to think in very discrete steps
[12:27:31] <tzanger> you have to break a problem down into little blocks, moreso than with a higher level language
[12:27:36] <xelion> can you try to illustrate how ROtate Right through carry works?
[12:27:46] <tzanger> it's good to be able to do that, it is very helpful when doing FPGA work :-)
[12:27:49] <tzanger> sure
[12:28:24] <tzanger> LSR does this: bit0 -> C, bit1 -> bit0, bit2 -> bit1 ... bit7 -> bit6, 0 -> bit7
[12:28:25] <inkjetunito> only guessing, but i suppose the rightmost bit, that would get lost otherwise, is stored on carry
[12:28:35] <tzanger> so C has the LSB of the register you just LSR'd
[12:28:43] <tzanger> now ROR is "rotate through carry"
[12:29:08] <tzanger> so bit0 -> C, bit1 -> Bit 0... just like LSR except when you get to bit 7. bit7 -> Bit6 and then C -> bit7
[12:30:00] <tzanger> so if R17 has 11101101 and R16 has 00000000, LSR R17 makes R17 01110110 and C 1. ROR R16 would make R16 10000000 since C had a 1 in it (and C now has 0 since we shifted a 0 into it but we don't care about that)
[12:31:33] <xelion> so in a way, ROR "suck" out the flag status, and stores it in MSB?
[12:31:48] <tzanger> when I was learning this I spent a lot of time with a pencil and graph paper (makes it easy to draw 8 bit registers and see what's going on)
[12:32:02] <tzanger> that's exactly what ROR does. it rotates the operand right through carry
[12:32:13] <xelion> cool! thanks man!
[12:32:36] <tzanger> some processors have a "rotate right" which just rotates the bits in the operand, others have "rotate right through carry" which is what AVR has, and othes have both
[12:32:56] <tzanger> there's shifts (arithmetic and logical) and rotates. two different things so you choose what you need based on what you're doing
[12:33:00] <xelion> it's like a snake having 8 segments with the SREG joining the ends together;)
[12:34:21] <xelion> so "through carry" only means, that the C-flag is used. If it was called "ROtate Right throug zero" the Z flag would have been used instead...?
[12:38:22] <tzanger> no such instruction exists but yes
[12:38:41] <tzanger> rotate right just means shift all the bits right 1 bit, with bit 0's value going to bit 7
[12:38:44] <xelion> I know.. only for demo;)
[12:38:49] <tzanger> rotate right through carry adds C in the mix
[12:39:20] <xelion> I'll stick with my snake analogy;) It makes sense in my head;)
[12:41:35] <tzanger> http://www.letssmiletoday.com/pictures/6782-om-nom-nom-nom-snake
[12:45:27] <xelion> LOL!
[12:46:17] <tzanger> that's actually the basis for LFSRs
[12:46:22] <tzanger> (prng generators)
[12:50:31] <dioxide> hmm
[12:50:54] <dioxide> avr + full circuit simulator, neato. must try this
[12:54:02] <xelion> dioxide: if this is linux-compatible, please feel free to elaborate on the subject;)
[12:54:14] <dioxide> oh
[12:54:34] <dioxide> its labcenter design workstop
[12:54:37] <dioxide> workshop
[12:55:26] <dioxide> would appear winows only, but you could alwas attempt wine, or go with a vm if you wanna play with it
[12:55:49] <xelion> Hmm....
[12:57:16] <dioxide> i was just lookin at their website, checkin out their videos
[12:57:39] <dioxide> im not sure whether the copy i have includes the simulation stuff, bout to find out
[13:34:28] <t4nk312> hi guys
[13:34:51] <t4nk312> i'd like to ma some questions about ADCs
[13:34:57] <t4nk312> make
[13:35:34] <t4nk312> first of all what is AREF and AVCC ?
[13:38:35] <john_f> t4nk312: avcc is a separate voltage source so it doesn't have digital noise on it.
[13:39:38] <t4nk312> ok and what about aref?
[13:39:56] <john_f> don't remember that one
[13:41:10] <john_f> ah my chip doesn't have it
[13:41:13] <twnqx> aref is an external reference voltage for the adc
[13:41:45] <twnqx> either supply our own reference voltage, or put a decoupling capacitor for the internal voltage reference
[13:42:03] <t4nk312> and why is this reference needed?
[13:42:21] <twnqx> ADC works by comparing the input voltage to the reference
[13:42:27] <twnqx> reference voltage = 100%
[13:42:39] <t4nk312> aha
[13:43:15] <t4nk312> i'm asking because i have a project with avr butterfly
[13:43:49] <twnqx> so if you want to measure voltages above the reference (e.g. 2.56V for my chip) you either have to use an external divider, or supply a different reference voltage
[13:43:55] <t4nk312> and i must measure the voltage with the internal ADC of butterfly and show the volts on the lcd screen
[13:44:59] <twnqx> there should be a conversion formula in the datasheet of the chip you use
[13:45:12] <t4nk312> i have managed to do everything BUT i'm doing something wrong with the measurment]
[13:45:13] <twnqx> how to convert the values you get back to volts
[13:45:22] <t4nk312> wait
[13:45:24] <tzanger> heh we just went through this a few hours ago
[13:45:35] <tzanger> your output is ratiometric to vref
[13:45:55] <twnqx> plus an external devider, if applicable :P
[13:45:55] <tzanger> vin == vref, adc out = full counts (255 for 8b, 1024 for 10b, etc.)
[13:46:20] <tzanger> so you can figure out what the voltage input to the ADC was by using some math. vin/vref = adc value/adc max
[13:46:30] <t4nk312> well i use the type volts = (5*adc_result)/1023 because it is a 10 bit resolution
[13:46:44] <tzanger> which is wrong
[13:46:52] <t4nk312> why
[13:47:00] <twnqx> first, figure out what vref is.
[13:47:08] <twnqx> what did you set it to
[13:47:20] <t4nk312> actualy i have a problem with this
[13:47:25] <t4nk312> because
[13:47:28] <tzanger> vin = adc result * ref / max
[13:47:32] <tzanger> er that's what you wrote, sorry :-)
[13:47:48] <tzanger> gotta run
[13:47:57] <t4nk312> so its corect?
[13:48:05] <twnqx> the formula, yes
[13:48:08] <t4nk312> ok
[13:48:08] <twnqx> the 5... maybe
[13:48:28] <t4nk312> look
[13:49:02] <t4nk312> in the atmega169 ( butterfly) there are three choices for the reference voltage
[13:49:08] <t4nk312> wait a sec
[13:49:49] <t4nk312> so,,,
[13:50:33] <twnqx> yes
[13:50:35] <t4nk312> by setting the bits REFS1 and REFS0
[13:50:35] <twnqx> as always
[13:50:46] <t4nk312> hehe
[13:51:21] <t4nk312> with combination 0 0 i can select the aref as voltage reference
[13:51:47] <t4nk312> with combination 0 1 i can select the avcc as voltage reference
[13:52:11] <t4nk312> and wit 1 1 i can choose the internal 1.1 volt
[13:52:22] <twnqx> yes.
[13:52:26] <t4nk312> and i don't know which one
[13:52:34] <t4nk312> to choose
[13:53:17] <t4nk312> i tried with internal 1.1 volts but the adc gives me as maximum measurment 820 and 1023
[13:53:30] <t4nk312> and i dont know why
[13:54:31] <twnqx> you can't measure voltages higher than your reference
[13:54:42] <RikusW> can I ask a picaxe question in here ? :-P
[13:54:52] <RikusW> the arduino of pic ;)
[13:55:14] * RikusW hides..
[13:55:40] <t4nk312> so if i want to measure 0-5 volts i must have areference voltage 5 volts?
[13:55:45] <twnqx> yes
[13:55:50] <t4nk312> ok
[13:55:57] <t4nk312> now,
[13:56:50] <t4nk312> if i choose the first option 0 0 the adc gives me 1023 BUT by changing the trimmer nothing happens the adc measurment stucks in 1023
[13:57:16] <twnqx> according to the schematic, no external supply is connected to aref
[13:57:20] <twnqx> so that's not surprising,.
[13:57:44] <t4nk312> you checked the datasheet?
[13:59:02] <twnqx> the ones for the butterfly, yes. let me check again, didn't pay full attention
[13:59:47] <t4nk312> It says that it is connected to vcp. What is vco?
[14:00:06] <t4nk312> vcp
[14:00:26] <twnqx> according to the schematic
[14:00:26] <twnqx> nothing
[14:00:59] <twnqx> or maybe i should say, there is no source connected to it
[14:01:06] <twnqx> you'll have to live with the avcc source.
[14:01:09] <t4nk312> so i have to put on that pin 5 volts if i want to use AREF
[14:01:41] <twnqx> 0 1 AVCC with external capacitor at AREF pin
[14:01:41] <t4nk312> ?
[14:01:45] <twnqx> should do.
[14:02:23] <t4nk312> with 0 1 it is internaly connected?
[14:02:33] <t4nk312> to vcc?
[14:02:43] <twnqx> yes, it will use AVCC as reference
[14:02:48] <twnqx> that's what it says
[14:02:56] <t4nk312> ok
[14:03:28] * twnqx is off to watch football
[14:04:29] <t4nk312> so as long as the Vcc is 5 volts the formula must be volts = AVCC*adc_result)/1023?
[14:12:48] <abcminiuser> I totally got to see Brittney running the other day
[14:13:05] <abcminiuser> A year working, and I FINALLY see the darn thing turned on
[14:19:39] <langoliers> h
[14:19:48] <langoliers> nah finally, i have my rgb leds too :)
[14:20:24] <langoliers> few hardware to be assembled
[14:23:11] <langoliers> these are fairly brigth even at 5mA... so i can just simply tie them to atmega pins through a resistor and limit current to 10mA
[14:51:55] <Tom_itx> abcminiuser what is it? a wafer machine or something?
[14:52:07] <abcminiuser> Our sexy test robot
[14:52:14] <Tom_itx> oh
[14:52:14] <abcminiuser> It has all our kits and all our devices in it
[14:52:38] <abcminiuser> So it runs through Atmel Studio (well, the backend) trying to program/erase/etc. each part and tool combination
[14:52:57] <abcminiuser> FYI, there's a LOT of combinations
[14:53:04] <Tom_itx> i bet
[14:53:46] <abcminiuser> But it's really cool to watch it run, picking up parts from the library and shoving it into the STK600 test beds
[14:58:27] * RikusW puts a picaxe into the robot :-P
[14:58:47] <twnqx> abcminiuser: are the stk600 schematics available anywhere?
[14:58:57] <twnqx> i have two dead ones here ;(
[15:01:56] <twnqx> test
[15:02:31] <Tom_itx> it's not working
[15:02:57] * twnqx wtfs
[15:03:14] <RikusW> 10 packets sent 0 returned ;)
[15:03:25] <twnqx> ok, the router i route my ipv6 via is down
[15:03:35] <twnqx> my PI space and AS dropped off the internet
[15:03:42] <twnqx> i route my ipv6 via that...
[15:04:11] <twnqx> ah. connected via ipv4
[15:04:21] <abcminiuser> twnqx, nope :(
[15:04:29] <abcminiuser> How exactly do they not work?
[15:04:35] <twnqx> um
[15:04:38] <abcminiuser> Are they recognized by the PC?
[15:04:40] <twnqx> nothing on usb
[15:04:46] <abcminiuser> Damn
[15:04:48] <twnqx> not even lusb shows them
[15:04:53] <abcminiuser> Might have a cooked power supply
[15:04:58] <twnqx> maybe
[15:04:59] <abcminiuser> Any LED activity?
[15:05:05] <twnqx> i wouldn't know where to measure
[15:05:44] <abcminiuser> Do any LEDs turn on?
[15:06:42] <twnqx> one one, yes
[15:06:48] <twnqx> the red one
[15:06:51] <twnqx> on the other, no
[15:07:17] <twnqx> on the one where the red next to the switch turns on the red one next to the at90usb is flashing
[15:07:23] <twnqx> very, very short pulses
[15:09:01] <twnqx> uh wrong
[15:09:19] <twnqx> i removed the jumper from one
[15:09:31] <twnqx> the red hear the switch come on on both
[15:09:51] <twnqx> on one there are very short red flashes, on the other the LED is cycling red/yellow
[15:11:05] <langoliers> how would you implement a pulse checking for keypress what is within 19 and 101ms ? and limit its rate below 6Hz ?
[15:11:42] <twnqx> oversampling and counting
[15:11:43] <langoliers> stable timebase using a counter, and compare ?
[15:12:51] <abcminiuser> twnqx, try http://www.atmel.no/webdoc/stk600/stk600.support_troubleshooting.html
[15:15:10] <twnqx> i will
[15:17:06] <langoliers> abcminiuser<= when will atmel finally decide to put a TSC into the microcontrollers? ;/
[15:17:30] <langoliers> 1 counter and 1 readable register :(
[15:17:31] <RikusW> langoliers: use a timer
[15:17:49] <langoliers> TSC is atomic
[15:17:53] <langoliers> counter is not
[15:18:39] <langoliers> PCs have TSC, and cant use them for realtime things really... microcontrollers could use it in real-time, but they do not have TSC
[15:27:24] <hetii> if i want to use just txd and rxd in serial port should i have connected DSR wit DTR ?
[15:46:02] <OndraSter_> hetii, that depends
[15:46:10] <OndraSter_> does it require hardware flow control?
[15:51:23] <hetii> The point is that i made universal serial cable that support power 3.3v 5v +/- 6v so it will be connected to different devices in his period of life. The original converter use pl2303 -> zt213 and and the plan is to add max 2323 cause there to have back the possibility to support 3.3v and 5v devices.
[15:52:31] <hetii> Unfortunate I`m not able to connect between pl2303 and zt213 so thats the idea to use max3232
[15:54:28] <hetii> I also consider to put small attiny that will listen on txd line and will switch power level for max3232. But i`m not sure if its make sense to use uc instead simple switch.
[15:55:30] <hetii> but if i could do by this uc also looping with DSR/DTR and RTS/CTS line then maybe it has more sense to use uC.
[15:57:12] <hetii> All that stuff will be inside http://obrazki.elektroda.net/26_1258281197.jpg
[17:03:02] <hetii> !!!@!@#@ I spend 2~3 hour to made small 3.3v LDO and on the end of the day by accident i threw it in the trash with other garbage :/
[17:04:01] <OndraSter_> eh?
[17:06:08] <twnqx> i wonder if "Error: Sign on string is ë!, expected 'AVRBLDR'" is progress with my stk600
[17:06:40] <twnqx> googling indicates i need an AS5 for the upgrade
[17:06:46] <RikusW> hetii: rx/tx is fine
[17:07:46] <twnqx> cts/rts as well is better though
[17:08:08] <twnqx> can i install atmel studio 5.0 and 6.0 in parallel?
[17:09:12] <OndraSter_> yes
[17:10:37] * RikusW just used an old idea to hack an app, put some x86 asm in to do LoadLibrary and the wrote a dll to do the rest :)
[17:11:24] <RikusW> and copy pasted some raw binary asm from one exe to another for the hack too :)
[17:12:07] <RikusW> I already had it in C and really didn't feel like coding it in asm and then hex editing a exe to put it in....
[17:12:16] <RikusW> though I had to do a bit of that too
[17:12:52] <RikusW> basically its a custom GetProcAddress
[17:20:56] <twnqx> lol atmel
[17:21:02] <twnqx> "download as a guest"
[17:21:08] <twnqx> "does not create an account"
[17:21:17] <twnqx> "thank you for registering, an email has been sent for verification"
[17:22:09] <twnqx> "we don't care how, as long as we can get your private data!"
[17:32:40] <vsync_> nom nom nom tasty private data nom
[17:37:32] <hetii> is it a good practice to connect cover from cristal to ground ?
[17:37:59] <twnqx> i wouldn't say it's needed
[17:39:59] <hetii> but is there some negative aspects?
[17:40:26] <twnqx> look into the crystal's datasheet
[17:51:47] <Horologium> xelion, http://www.avr-asm-tutorial.net/avr_en/calc/CONVERSION.html
[17:53:16] <DanFrederiksen> is there a pic channel as well?
[17:54:53] <Dan39> maybe... #pic ? lol
[17:55:07] <Dan39> or ##pic
[17:55:53] <Horologium> it is ##pic
[17:55:59] <Horologium> but is very quiet usually.
[19:02:15] <Malinuss> avr is also pretty quiet :)
[19:02:35] <Horologium> right now
[19:04:22] <twnqx> ok
[19:04:32] <twnqx> i'll blatantly assume that i can't upgrade stk600s
[19:04:34] <twnqx> inside a VM
[20:31:14] <metalliqaz> come on LUFA experts....
[20:31:23] <metalliqaz> raise yo hand! :)
[20:35:20] * Casper raises metalliqaz's hand and duct tape it to the ceiling
[20:35:36] <metalliqaz> :(