#avr | Logs for 2012-03-21

Back
[00:05:00] <dehuman> so yah v-usb rock on
[00:05:03] <dehuman> i dig it
[00:22:30] <CapnKernel> v-usb is great, for what it does
[03:31:14] <mitsakos> hello, i would to ask if you know if there is a difference in assembly code generation when use structs instead of simple variables. what is prefered?
[03:31:33] <mitsakos> in avr-gcc
[03:37:28] <ziph> mitsakos: It depends.
[03:37:42] <ziph> mitsakos: Writing tiny test programs and looking at the assembler output might be helpful.
[04:31:50] <mansfeld> does anyone know if I can use a prescaler with the quadrature decoder on an XMEGA chip?
[04:35:19] <mrfrenzy> what does the datasheet say?
[04:37:49] <mitsakos> :P
[04:38:23] <mansfeld> it doesn't seem to say that I can :(
[04:39:25] <mansfeld> I thought of extending the counter to 32 bits using a second counter, but the event system doesn't seem to handle over- and underflow at the same time
[04:44:48] <RikusW> http://news.stanford.edu/news/2012/march/molecules-designer-electrons-031412.html
[05:06:30] <RikusW> A Heisenbug can drive you mad. Its name stems from Werner Heisenberg’s uncertainty principle on quantum physics.
[05:48:10] <mitsakos> if i have a struct in file1.c and i want to use the same struct in file2.c do i have to define it as extern struct_name.variable in the file2?
[05:49:43] <raek> mitsakos: do you want to use the struct type or a variable of the struct type?
[05:50:45] <raek> if you want to use a global variable defined in another source file (no matter what type it has), you use the "extern" keyword in the file that uses it
[05:51:19] <mitsakos> all the variables of the struct i want to be public and use them in two files
[05:51:38] <mitsakos> *global
[05:52:00] <mitsakos> and i define it in which way?
[05:52:13] <mitsakos> extern struct_name.variable_name?
[05:52:24] <mitsakos> or extern struct_name
[05:52:37] <raek> what do you mean by "all the variables of the struct"? variables that has the struct as their type, or the fields of a certain struct?
[05:53:06] <raek> ok, this holds for variables in general:
[05:53:18] <raek> let's assume variable foo lives in file1.c
[05:53:33] <mitsakos> yes i know for one variable
[05:53:40] <raek> then you have "int foo;" at the top level of file1.c
[05:53:53] <raek> and "extern int foo;" at the top level of file2.c
[05:54:13] <raek> then place is allocated for foo in the object file for file1.c
[05:54:24] <mitsakos> for example i have typedef struct{ uint8_t variable1; uint8_t variable2;}struct_name;
[05:54:35] <mitsakos> how i extern this one?
[05:55:02] <raek> ok, first: I think what you call variables there is usually called "fields", but whatever
[05:55:11] <raek> mitsakos: extern deals with variables, not types
[05:55:25] <mitsakos> ok.. lets say they are fields
[05:55:39] <raek> so, in the end you need the "typedef .... ;" line to be present in both file1.c and file2.c
[05:55:52] <raek> you usually achieve this with header files
[05:56:15] <mitsakos> yes that is what i have done
[05:56:17] <raek> for example, you can have "my_stuct.h" with contents "typedef struct{ uint8_t variable1; uint8_t variable2;}struct_name;
[05:56:20] <raek> "
[05:56:29] <raek> + include guards
[05:56:33] <mitsakos> and i also have included one more line which is the define of struct type
[05:56:40] <raek> than include that file in both file1.c and file2.c
[05:57:11] <raek> included which line in which file?
[05:57:15] <mitsakos> and the line where you declare the type
[05:57:29] <mitsakos> struct_name name;
[05:58:09] <mitsakos> after you declare a struct type you have to make a variable which type will be the structs type
[05:58:30] <mitsakos> you did this in header file or in each .c ?
[05:58:32] <raek> to declare a variable that has the type struct_name, you write "struct struct_name variable_name"
[05:58:48] <mitsakos> yes
[05:58:49] <raek> and in the other file you would have "extern struct struct_name variable name"
[05:59:11] <raek> sorry, you don't need the "struct" part there
[05:59:14] <raek> since you use a typedef
[06:00:01] <raek> mitsakos: it's fine to have the extern line in both files (so you can put that in a header file)
[06:00:17] <raek> but you should only have the line without the extern in one file
[06:00:27] <mitsakos> yes
[06:00:32] <mitsakos> but if i put this line
[06:00:42] <mitsakos> in header files it occurs an compile error
[06:00:54] <raek> which line?
[06:00:54] <mitsakos> but if i put this line in a function e.g in main there is no error
[06:01:03] <mitsakos> struct_name varialbe;
[06:01:12] <mitsakos> with extern at the fron
[06:01:20] <raek> yes, as I said you should only have that in one source file
[06:01:49] <raek> and any included files are inserted into the source file where the #include directive is
[06:02:09] <raek> so:
[06:02:21] <raek> in my_struct.h:
[06:02:34] <raek> typedef .... my_struct;
[06:02:42] <raek> extern my_struct my_variable;
[06:02:46] <raek> in file1.c:
[06:02:52] <raek> #include "my_struct.h"
[06:02:58] <raek> my_struct my_variable;
[06:03:02] <raek> in file2.c:
[06:03:12] <raek> #inlcude "my_struct.h"
[06:03:49] <mitsakos> aha.. ok ;)
[06:04:30] <mitsakos> now i understand
[06:05:40] <mitsakos> thank you
[08:41:30] <SianaGearz> asteve: i think if you want to divide by 5, you can multiply by 205 and divide by 1024, that can be trivially converted into shifts and adds.
[08:42:14] <SianaGearz> but of course you need to do this with longer data types -.-
[08:42:38] <SianaGearz> well i think this can be optimized a bit to avoid that...
[08:45:02] <SianaGearz> and there is quite a bit of error there.
[08:46:57] <SianaGearz> next step in precision is 819/4096
[09:11:16] <inflex> bah, just doit with a busy negating loop
[09:11:59] <inflex> while (x >5) { x-=5; i++; }
[09:12:17] <inflex> which is 1000x slower than doing a proper division with bitshifts :p
[09:20:07] <gkwhc> Hi, anyone have experience working with playing audio from wave files? I am trying to debug why the audio output doesnt sound like the original file in any way. The wave file has samples like 0x62 0xE1 but when read into the MCU it becomes 0x62E1. is this a problem?
[09:24:00] <Kevin`> gkwhc: is it correct or isn't it
[09:24:21] <timemage> gkwhc, yeah, sounds like the endian has been switched.
[09:24:37] <Kevin`> gkwhc: do you know what format the wave file is in?
[09:27:03] <gkwhc> Kevin`: i think it is 24bit signed
[09:28:03] <timemage> gkwhc a bit odd.
[09:44:16] <gkwhc> hmm
[09:55:23] <Kevin`> in either case 24bit signed isn't 16bit
[09:56:46] <asteve> Kevin`: orly? how many bits is it?
[10:03:16] <timemage> i think that's the first time "orly" has actually brought the picture to my head.
[10:04:41] <asteve> timemage: you're welcome
[10:04:43] <LoRez> it sounds like it's 24bits
[10:04:50] <timemage> asteve, well done =P
[10:05:03] <asteve> LoRez: it can't be that simple
[10:05:14] <asteve> there's gotta be a trick somewhere
[10:05:27] <LoRez> why?
[10:06:30] <LoRez> because you don't understand what's going on?
[10:07:06] <asteve> here's a legitimate question, how many bits on the + does 24 signed represent?
[10:07:12] <asteve> 2^(24-1)-1
[10:07:26] <LoRez> 23
[10:07:26] <asteve> it's that last -1 that'll gitya
[10:07:36] <asteve> and my question wasn't asked correctly
[10:07:41] <asteve> damn shame
[10:07:43] <LoRez> I answered your question.
[10:08:31] <Kevin`> I assumed you were joking, asteve :o
[10:08:42] <asteve> Kevin`: i never joke
[10:09:20] <LoRez> now, if you're talking specifically about 24 bit PCM, it's stored in files in blocks
[10:09:47] <LoRez> if it's linear PCM anyway
[11:19:38] * OndraSter has fixed GPS today
[11:19:42] <OndraSter> brother's Mio C720
[11:19:49] <OndraSter> the digitizer was going crazy
[11:19:57] <OndraSter> I took it apart about 2 or 3 weeks ago
[11:20:04] <OndraSter> desoldered digitizer and what not
[11:20:08] <OndraSter> and ordered new one
[11:20:11] <OndraSter> surprise surprise, IT WORKS
[11:23:07] <OndraSter> duh, no xmega64/128 with USB on mouser for 1 piece order, only 395 / 500 / .. :(
[11:33:34] <OndraSter> guys, how do you programm these?
[11:33:35] <OndraSter> http://eu.mouser.com/ProductDetail/Atmel/ATF22LV10C-10JU/?qs=sGAEpiMZZMuPkEnZOVpBOD0WCuvaTeiWEEBsmDgb%252bM0%3d
[11:33:38] <OndraSter> you gotta call Atmel?
[11:34:13] <Casper> look at the datasheet
[11:35:00] <Casper> probably the same way as plain avr, but with different tools
[11:35:07] <OndraSter> I looked there
[11:35:11] <OndraSter> they said "refer to document blabla"
[11:35:14] <OndraSter> so I opened that
[11:35:23] <OndraSter> and there is only list of companies that are allowed to programm it?!
[11:36:29] <Casper> so you got the wrong datasheets probably
[11:37:24] <OndraSter> I got the ones from mouser/atmel website
[11:37:45] <OndraSter> The following list of Atmel-certified programmer
[11:37:45] <OndraSter> vendors and programmers are
[11:37:45] <OndraSter> those which are evaluated by Atmel for
[11:37:45] <OndraSter> all additions and changes of all EPLD
[11:37:45] <OndraSter> devices manufactured by Atmel.
[11:40:27] <dirty_d> OndraSter, lol http://www.youtube.com/watch?v=cBCbTRqPMTY
[11:41:18] <OndraSter> LOL
[11:42:12] <dirty_d> i think i need to do some PID tuning
[11:42:19] <dirty_d> and prop nut tightening
[11:42:28] <mrfrenzy> you could see right away that two props where slower to spin up
[11:43:39] <dirty_d> well, that was happening before but because its on a hill because of the pid
[11:43:48] <dirty_d> if its level they will all spin at the same time
[11:45:38] <mrfrenzy> aic
[12:52:25] <ThersiT> CapnKernel: I looked at your link about the RF transceiver, Thank you. Would you know of any example circuits I could look at to get an idea where to start with this thing?
[12:53:38] <CapnKernel> From memory, the data sheet has an example site.
[12:53:59] <CapnKernel> I have a customer for those chips (actually, I'm staying at his house now) who might be able to give you more information.
[12:54:08] <CapnKernel> Sorry, has an example circuit
[12:55:47] <specing> CapnKernel: you could make an easy to use RF transceiver board for us :D
[12:56:18] <ThersiT> They want my tel number and email to dl the sheet. I guess I'll bite the bullet and give it to them.
[12:56:27] <specing> ThersiT: DONT
[12:56:45] <specing> go get a throwaway account on slopsbox
[12:56:46] <ThersiT> standing by..
[12:57:10] <specing> and put 123456780 for telephone
[12:57:15] <specing> D:
[12:57:38] <ThersiT> ah, good call.
[12:58:28] <ThersiT> I've still got Analog Devices blowing up my email.
[12:58:36] <specing> ...
[13:01:48] <ThersiT> good ol google.. snagged from some other site.
[13:11:17] <CapnKernel> specing: I think it would be more useful to more people if I get a general PCB facility going.
[13:11:35] <CapnKernel> Plus I have no RF design experience.
[13:14:23] <specing> CapnKernel: how was the arm thing?
[13:14:49] <CapnKernel> Hmm?
[13:14:57] <ThersiT> CapnKernel: This thing looks pretty cool thanks.
[13:15:07] <CapnKernel> That's what my friend says.
[13:15:22] <CapnKernel> The chips I sold him will be launched into low orbit :-)
[13:15:55] <ThersiT> So good range then? heh.
[13:16:21] <ThersiT> Do you sell for RDA?
[13:16:53] <CapnKernel> My friend asked him to get him that chip, and I got it through my suppliers.
[13:17:04] <CapnKernel> If you want a particular chip, I can do the same.
[13:17:26] <CapnKernel> Oh btw, if you're looking for something with a bit more value add, these are also very nice: http://www.hoperf.com/pro/rf/fsk/rfm22b.htm
[13:18:30] <CapnKernel> I can get those too.
[13:18:42] <CapnKernel> I live in the city where they're made.
[13:24:04] <asteve> i need to transmit the live video from a camcorder to a central location over 300 yards
[13:24:13] <asteve> what camcorder can i use? what do i look for?
[13:26:33] <ThersiT> CapnKernel: Can you send me that last link again
[13:27:03] <ThersiT> XChat just closed it's self.
[13:27:20] <CapnKernel> I think you're probably better off googling for "video sender unit"
[13:27:38] <CapnKernel> But here it is: http://www.hoperf.com/pro/rf/fsk/rfm22b.htm
[13:27:49] <ThersiT> thanks
[13:31:47] <CapnKernel> Something like this: http://www.security-cams.com/pd9-1500-transmitter.aspx
[13:32:45] <CapnKernel> Depending on how you value your time, development cost for your own sender is going to run to thousands of dollars. You're better off using off-the-shelf units like these, if you have an off-the-shelf application.
[13:36:37] <ThersiT> Yea we got quotes from a few different companies, they were in the thousands, but for the money we wern't getting exactly what we wanted.
[13:37:21] <ThersiT> I'm just looking to see how hard it would be to do it myself.
[13:37:34] <OndraSter> heya CapnKernel
[13:37:40] <OndraSter> so how's the Shenzen?
[13:37:44] <CapnKernel> OndraSter: Hi there
[13:37:49] <CapnKernel> I wish I knew
[13:38:04] <CapnKernel> I'm still in HK, hoping to pick up my visa tomorrow morning.
[13:40:41] <OndraSter> CapnKernel, have you ever programmed any of those Atmel CPLDs that are like $1.5/device?
[13:40:42] <OndraSter> like these
[13:40:43] <OndraSter> http://eu.mouser.com/ProductDetail/Atmel/ATF16V8B-10JU/?qs=sGAEpiMZZMuPkEnZOVpBOPRTzuNlcbRo4w0ABLP5wCs%3d
[13:40:47] <OndraSter> or anybody else :)
[13:40:56] <OndraSter> I am having hard time getting any !cheap! programmer
[13:41:13] <CapnKernel> I haven't used a CPLD or FPGA before.
[13:41:14] <OndraSter> either these or ATF15 series with JTAG
[13:41:34] <CapnKernel> Always wanted to, but the lack of free tools means I've always decided against it.
[13:41:59] <OndraSter> :)
[13:42:33] <CapnKernel> There's a lot you can do with a chip like that.
[13:42:39] <OndraSter> these cheap CPLDs seem quite cool
[13:42:41] <CapnKernel> (Bit hungry on the current though)
[13:42:45] <OndraSter> I need some small but "fast" ones
[13:43:25] <specing> CapnKernel: How far do those FSK RF modules reach?
[13:47:04] <CapnKernel> If you have the right radio receiver, then it can be up to hundreds of kilometres.
[13:47:04] <CapnKernel> http://www.daveakerman.com/?p=277
[13:47:12] <CapnKernel> Read the comments
[13:47:17] <CapnKernel> However that is a very very big if.
[13:48:17] <CapnKernel> A customer asked me to price the RFM22Bs, because he wants to use them in the downlink for balloons. Apparently he's already using them. His balloons go to 35km, so I think that means it works for that.
[13:48:26] <CapnKernel> Note, it is low frequency data, not video.
[13:48:45] <CapnKernel> And special radio receivers, high gain antennas, etc.
[13:52:20] <OndraSter> abcminiuser, I am trying to find some info about Atmel's CPLD ISP cable... it used to be here
[13:52:21] <OndraSter> http://www.atmel.com/dyn/resources/prod_documents/isp_C_v5.PDF
[13:52:22] <OndraSter> but not anymore
[13:52:28] <OndraSter> and before that here
[13:52:28] <OndraSter> http://www.atmel.com/acrobat/isp_c_v5.pdf
[13:52:47] <OndraSter> can't find it anywhere now
[13:55:17] <OndraSter> do you happen to have it? :P
[13:59:12] <CapnKernel> Nearly 3am, bedtime for me now. Good night all.
[13:59:26] <OndraSter> hah I got the schematics
[13:59:28] <OndraSter> now I need the app
[13:59:34] <OndraSter> + PC with Win98 and LPT
[13:59:35] <OndraSter> gn CapnKernel
[14:03:55] <asteve> win98?
[14:05:17] <abcminiuser> OndraSter, no idea
[14:05:40] <ferdnaO> and he flew... http://www.humanbirdwings.net/
[14:10:18] <dirty_d> lol
[14:10:27] <dirty_d> is that real?
[14:10:35] <dirty_d> i dont see enough motors
[14:12:31] <CapnKernel> OMG
[14:17:59] <dirty_d> what do you think?
[14:18:30] <ThersiT> I want one.
[14:18:41] <CapnKernel> Lots and lots of interesting comments here: http://www.wired.com/wiredscience/2012/03/analysis-of-the-human-birdwings/
[14:19:11] <CapnKernel> At the very least, not 100% human powered. He has 4kw of electric motors to flap the wings.
[14:19:23] <dirty_d> from the size of the motors id say he cant get more than 600W
[14:19:25] <dirty_d> 6000W
[14:19:47] <dirty_d> oh ok 4000W
[14:19:55] <dirty_d> my quadcopter is 4000W
[14:20:03] <dirty_d> and it only will lift like 30 pounds
[14:22:28] <s_mack> is this working?
[14:24:08] <s_mack> what's the trick? lol
[14:26:42] <CapnKernel> Your QC has no wing surface
[14:27:12] <CapnKernel> His motors have to overcome the glide angle, your QC motors have to overcome a dead fall
[14:29:26] <dirty_d> i dunno i still dont think its anywhere near enough
[14:29:57] <dirty_d> it doestn even look real
[14:44:52] <dirty_d> a propeller is just a wing that spins
[14:45:14] <dirty_d> airplanes are more effiecnt because the wing has a much bigger surface area than a propeller
[14:52:08] <ferdnaO> btw, there is no landing video footage =/
[14:52:19] <ferdnaO> i would like to see how that went
[14:53:28] <dirty_d> i know lol
[15:39:51] <OndraSter> so
[15:40:01] <OndraSter> appearantly the altera byteblaster programmer works with these CPLDs as well
[15:44:03] <cyanide> my adxl samples came in today
[15:44:11] <cyanide> analog devices are really cool people
[15:44:31] <cyanide> they do dhl international shipping even for samples
[15:47:04] <lifeeth> neat :)
[15:57:04] <OndraSter> yeah
[15:57:09] <OndraSter> TI does even FedEx
[16:01:29] <asteve> attack of the beepbeeps!
[16:02:16] <cyanide> i hate fedex
[16:02:47] <asteve> beepbeep!
[16:02:47] <beepbeep> beepbeep beepbeep!
[16:02:56] <cyanide> bot?
[16:02:57] <cyanide> lol
[16:38:37] * Landon is glad avrs are relatively OK with being plugged in backwards
[16:39:14] <Kevin`> as long as your source is current limited
[16:40:07] <Landon> heh
[16:40:11] <Landon> just batteries right now
[16:56:52] <Landon> well, I take that back, something's gone wrong terribly wrong this time :P
[20:51:00] <Casper> rue_house: ya there?
[21:58:06] <rue_house> almost always
[22:00:45] <Casper> rue_house: you know, that steel screen thing with like 1/2" square holes...
[22:01:00] <Tom_itx> chicken wire
[22:01:05] <Casper> is it foot kicking proof?
[22:01:14] <Tom_itx> who's foot?
[22:01:17] <Tom_itx> yes
[22:01:27] <Casper> bulgar one
[22:01:31] <Tom_itx> somewhat
[22:01:32] <Tom_itx> no
[22:01:40] <Casper> I'm actually concerned about one neighbour
[22:01:44] <Tom_itx> use diamond mesh
[22:02:02] <rue_house> stucco mesh has 2" holes
[22:02:29] <Casper> the window here is huge! 19x10!!!
[22:02:31] <Casper> inch...
[22:02:48] <Casper> just big enought to pass throught it...
[22:03:18] <Casper> it used to have a steel bar, but due to me sleeping in the basement... that bar went away, but now allow theif to get in too
[22:03:19] <Casper> and
[22:03:30] <Casper> I'm almost certain that someone removed the outside window
[22:03:35] <Casper> of my bedroom
[22:03:50] <Casper> as I'm certain to actually put it back in it's hole
[22:03:58] <Casper> I found it on the ground
[22:04:48] <Casper> so trying to find a way to have the window open, easy to get out in case of emergency, yet hard for bulgar to get in
[22:05:05] <Casper> (which one is known to live 2 house away)
[22:05:42] <Casper> btw, the one I talk isn't chicken wire
[22:05:48] <Casper> it have true square holes
[22:06:00] <Casper> and have bigger wire, spot welded at each intersection
[22:09:13] <Kevin`> i've seen that stuff, sounds good for this
[22:12:23] <Tom_itx> Casper, i know i use it in the garden
[22:13:01] <Casper> I guess it will be good enought...
[22:13:03] <Tom_itx> and if a burgular wanted thru it he could get thru
[22:13:08] <Casper> sure
[22:13:29] <Casper> just need to discourage enought, and make enought noise
[22:14:11] <Casper> those at the store broke throught a 5mm tempered glass door with 1mm vinyl or something
[22:14:30] <Tom_itx> so hang a swinging barb grid behind the entrance point so if tampered it trips the swing
[22:14:49] <Tom_itx> no mistaken who it was tampering that way
[22:14:51] <Kevin`> Tom_itx: it needs to be obvious to discourage
[22:14:56] <Casper> they made enought noise to wake up the neighbour, closed windows, about 400ft away... he tought they were breaking into his car or something
[22:15:05] <Tom_itx> paint it flourescent orange?
[22:15:44] <Kevin`> reinforced glass, for example, is not obviously strong to most people
[22:15:47] <Casper> crowbar? nope, don't work... baseball bat? nope...
[22:15:48] <Tom_itx> sry, been watching a couple of these 'survivor' shows last couple days
[22:15:48] <Kevin`> so they start hitting it
[22:15:59] <Casper> they actually had to give strong kicks...
[22:16:19] <Casper> we actually had to readjust the door as they twisted it a bit out of shape
[22:16:46] <Casper> now it's 6mm with 2mm
[22:16:54] <Casper> and with steel bars
[23:35:07] <CapnKernel> Well that's rather annoying: Visa back into China has been rejected.
[23:41:36] <Casper> meaning your in trouble?
[23:47:04] <CapnKernel> Unless a miracle occurs, yes.
[23:47:27] <CapnKernel> Almost certain to involve an expensive return to Australia, and return to China will be no means assured
[23:50:15] <CapnKernel> It's rather annoying, because I've spent a year of my time and money doing this, just to have it fall apart when I getting to the good bit.