#avr | Logs for 2012-10-25

Back
[00:00:15] <skorket> Should one disable the ADC if you switch the input pin it's doing the conversion on?
[00:03:05] <jadew> skorket, I don't think it cares about ADSC in free running mode
[00:03:22] <jadew> it probably just sets a flag and keeps going
[00:03:44] <jadew> you need to read the datasheet
[00:04:52] <skorket> but it says that it takes 13 ADC clock cycles for subsequent conversions. How do you know when the next conversion is done? And is that 25 ADC clock cycle initial cost also when you switch between pins? Don't you need to set the ADSC for a conversion after you've switched input pins?
[00:08:28] <rue_house> you wait for the conversion complete flag
[00:09:07] <rue_house> you dont need to turn off the adc, you can cycle channels after each conversion
[00:09:14] <rue_house> want an example?
[00:13:23] <skorket> please
[00:14:12] <skorket> I do not see a 'conversion complete' flag
[04:31:51] * RikusW is now connected using the SIM900 dev kit
[06:32:03] <amee2woof> hmm has anyone here tried using a 5.2V 5W zener as on a PSU to meet the idle load requirement? did it work?
[06:32:38] <amee2woof> the idea being... with less than the minimum load, rail voltage goes a bit high until the zener conducts and the minimum load is just barely met
[06:32:57] <amee2woof> when external load is connected, the voltage drops and the zener current goes down
[06:39:15] <Horologium> wouldn't that cause lots of oscillation?
[06:39:57] <Horologium> and when a zener conducts it is like a dead short almost.
[06:40:01] <amee2woof> a zener doesn't have a very sharp "knee" point so i don't think so
[06:40:40] <Horologium> guess there is one way to find out.
[06:41:14] <amee2woof> hehe :)
[06:42:06] <amee2woof> still wondering because i can't really believe i'm the only one who has thought about that kind of dynamic idle load before
[06:43:18] <amee2woof> if it does result in instability due to the nonlinearity i could put a small resistor in series, like 0.47 - 1 ohm or so
[06:43:49] <Horologium> what about current?
[06:44:15] <Horologium> if using a PC power supply, the 5V rail can put out quite a bit of current, possibly damaging the zener?
[06:44:52] <amee2woof> with under-load the risk is that the output voltage goes above specs. the zener voltage is picked so the "knee" is just above nominal too
[06:44:59] <Horologium> or am I overthinking it?
[06:45:36] <amee2woof> so if the PSU is under-loaded and its output voltage starts climbing above nominal, the zener starts to conduct more current until the minimum load is just barely met and the voltage stops climbing further
[06:46:23] <amee2woof> if i put more load on it, it'll return to normal regulation and the voltage goes down to nominal so the zener current goes down too
[06:46:46] <amee2woof> if that works like i think it should, i wouldn't ever have more than the minimum load spec current through the zener
[06:48:31] <Horologium> try and see.
[06:48:37] <Horologium> would be interesting to see if it works.
[06:49:13] <amee2woof> (as a side note, this is not for a ghetto computer PSU rig. but i found a cheap source for 5V/12V SMP modules that would be interesting as project PSUs. only annoying point is 500mA minimum load on 5V)
[06:50:56] <Horologium> http://terpconnect.umd.edu/~toh/ElectroSim/index.html unrelated, but, interesting site...
[07:00:34] <Horologium> too bad the player they used for that no longer exists.
[07:56:01] <jadew> what's the idle load requirement?
[07:56:51] <jadew> if it has to do with not having anything connected to the PSU, why would you care about it?
[07:57:12] <megal0maniac> Would a PC PSU deviate that much from rated voltage? I can understand the crappy wall-warts, but I thought these things were pretty well regulated. And switchmode
[07:57:22] <megal0maniac> (Not that I know anything about switchmode, but..)
[07:57:35] <amee2woof> specs say 500mA on 5V and 150mA on 12V... that is a fair bit considering the power levels i'm considering
[07:57:53] <amee2woof> jadew: what if i have a load that doesn't meet the idle requirements?
[07:58:30] <Kevin`> megal0maniac: pc psu should be within 5% iirc
[07:58:39] <amee2woof> megal0maniac: SMPs in theory are an implementation of the law of conservation of energy... input power equals output power, neglecting losses
[07:59:17] <jadew> amee2woof, what if your psu is drifting above 5.2
[07:59:30] <jadew> and starts pushing full power into the zener
[07:59:36] <iSaleK> jadew: Hi again... I didn't manage to fix my DS18B20 and ATtiny2313 to work :\
[07:59:45] <jadew> it will eventually end up in a continous short
[08:00:05] <amee2woof> yep, until the minimum load current is met... once it has enough load for regulation it'll try to steer back towards 5.0-ish
[08:00:08] <jadew> iSaleK, sorry to hear that
[08:00:18] <iSaleK> I've tried with another sensor and still I get 0xFF 0xFF as high/low temperatures :\
[08:00:25] <amee2woof> megal0maniac: the problem is that not all power supplies can turn off *completely*
[08:01:17] <amee2woof> that is usually by design because they bleed power off the output to drive their internal control circuitry. if it were to go down to zero duty cycle it would starve itself and go out
[08:01:23] <jadew> amee2woof, I figured that's your plan, but I mean what if you PSU thinks 5.3 is 5 (so it has drifted)
[08:01:31] <jadew> and no matter how much current the zener draws
[08:01:36] <jadew> it will keep pushing more
[08:01:43] <amee2woof> then the zener would blow :P
[08:01:46] <jadew> to the point of burning the zener
[08:02:15] <amee2woof> gotta pick the zener high enough to be above nominal but still within acceptable tolerances
[08:02:20] <jadew> iSaleK, you need a scope
[08:02:26] <amee2woof> 5.6V would probably be a better example value
[08:02:51] <iSaleK> jadew: I know but I don't have one :\
[08:02:56] <megal0maniac> So the zener would be a "dummy load"?
[08:03:01] <jadew> what powersources drift like taht anyway?
[08:03:12] <megal0maniac> jadew: Wallwarts :)
[08:03:33] <amee2woof> megal0maniac: so since it is always on a little bit, it will keep moving energy from input to output and if there is no adequate load for whatever the minimum duty cycle is, then the output voltage will soar high
[08:03:55] <amee2woof> jadew: then the PSU is defective anyway and forcing it into overload shutdown will only protect my load
[08:04:27] <jadew> yeah, it doesn't sound bad
[08:06:04] <jadew> iSaleK, attiny2313, right?
[08:06:09] <iSaleK> Yes
[08:06:16] <jadew> do you have anything else connected to it?
[08:06:28] <iSaleK> I connected 1wire bus on PB0 (it was on PD6 yesterday)
[08:06:37] <iSaleK> I have MAX232 for serial comm
[08:07:04] <jadew> at what freq. are you running it?
[08:07:33] <iSaleK> 7.37281 MHz
[08:07:54] <iSaleK> Do you want to take a look at my code?
[08:07:55] <jadew> that's the clock of the AVR?
[08:08:10] <iSaleK> Clock of the external crystal
[08:08:18] <iSaleK> *Frequency
[08:08:32] <jadew> didn't have anything less weird? :)
[08:08:44] <iSaleK> What do you mean? :)
[08:08:57] <jadew> is that for perfect serial baud rates?
[08:09:00] <jadew> like 8Mhz
[08:09:09] <jadew> 10Mhz 12Mhz 16
[08:09:13] <jadew> you know, anything with .0
[08:09:22] <iSaleK> Yes it's for perfect baud rate
[08:09:51] <iSaleK> With 7.37281MHz I can get exactly the 115200 baud rate :)
[08:10:46] <amee2woof> i found that 16MHz gets me closer to all the common baudrates than parts tolerances guarantee anyway
[08:11:13] <jadew> I just don't care about standard baudrates
[08:11:25] <jadew> most cdc devices use a 12Mhz clock
[08:11:37] <jadew> so they can't do the standard baud rates either
[08:12:02] <jadew> if you buy a PL232 based usb to serial convertor it will work better with non standard baudrates than with the standard ones
[08:12:02] * amee2woof only stocks 8 and 16MHz xtals
[08:12:14] <iSaleK> Well with 12MHz clock you get about 0.16% error on 19200 which is really low :)
[08:12:19] <jadew> well, the PL232 can't be set on non-standard ones... but still
[08:12:22] <jadew> it has error on them
[08:12:44] <iSaleK> You think maybe my crystal is makin a mess?
[08:12:49] <jadew> no
[08:12:50] <iSaleK> *making
[08:13:09] <iSaleK> here is my code, if you could take a look if I'm doing anything wrong
[08:13:09] <iSaleK> http://pastebin.com/PjQZfFap
[08:13:35] <amee2woof> so long as you observe the minimum high and low times, you can feed any junk into the clock input and it'll work the same
[08:14:38] <jadew> iSaleK, it looks good
[08:14:48] <iSaleK> :(
[08:15:19] <jadew> the problem is I don't think that library is following the protocol
[08:15:33] <iSaleK> I will upload you the library code if you want?
[08:15:42] <iSaleK> Or do you have a link to one that works for sure?
[08:15:44] <jadew> and we don't know what exactly is going on in there, since you can't look at the signal
[08:16:46] <iSaleK> Can you give me any 1-wire library that works for sure?
[08:16:46] <jadew> I wrote my own lib, but I don't want to opensource it yet, still some stuff to fix
[08:17:07] <jadew> I was about to give you the code from my own yesterday
[08:17:08] <megal0maniac> I find there are only issues with baud rate tolerances when you sum the error of both devices, and they're equally bad in opposite directions
[08:17:36] <jadew> but I realized that some code is clock dependent
[08:17:48] <jadew> and I remember timiging it with the scope for spot on accuracy
[08:17:58] <jadew> which means it might not work properly either on your chip
[08:18:06] <iSaleK> Too bad :\
[08:18:20] <iSaleK> Is there any other open-source library that I can use?
[08:18:37] <jadew> I don't know, I always write my own stuff
[08:20:09] <jadew> I'm gonna fix my lib tonight and if you can't make it work by tomorrow, I'll give you my code together with a working example
[08:20:20] <jadew> will even test it on the same clock as you
[08:20:52] <iSaleK> That would be great, thank you
[08:20:56] <iSaleK> I've found this library http://www.sicklinger.com/component/remository/func-startdown/4/?Itemid=54
[08:20:57] <jadew> np
[08:21:12] <iSaleK> I'm not sure but I will try to use it now to see if it work
[08:21:14] <iSaleK> *works
[08:23:29] <jadew> it looks ok
[08:38:37] <iSaleK> jadew: It's working! :D
[08:38:45] <iSaleK> It was library fault :)
[08:38:59] <jadew> nice
[08:39:01] <iSaleK> Now I get some decent values and when I try to heat up my sensor the values change :)
[08:39:23] <iSaleK> Now I got another question, what is the easiest way to convert thease values to temperature? :)
[08:39:29] <jadew> yeah, the first 2 bytes are of interrest
[08:39:38] <jadew> divide them by 2
[08:39:47] <jadew> IIRC it works in 0.5C increments
[08:40:00] <jadew> so 61 would mean 30.5 C
[08:41:30] <iSaleK> Hmmmm... so I create the 16bit value from high+low and divide it with two?
[08:41:38] <jadew> yep
[08:42:19] <iSaleK> Can I just make one 16bit char and then shift right for division by 2? :)
[08:42:39] <jadew> you don't want to lose the LSB
[08:42:55] <jadew> you can shift right
[08:43:01] <jadew> but also keep that LSB
[08:43:05] <jadew> and if it's 1
[08:43:13] <jadew> you output ".5" :)
[08:43:21] <iSaleK> Oh, that's nice :D
[08:46:41] <jadew> http://pastebin.com/jdnPAXRG
[08:47:12] <jadew> there's more data in there, you can use that to get better accuracy, it's explained in the datasheet
[08:48:05] <iSaleK> So If I get the value High/Low 0x01 0xA2
[08:48:49] <jadew> it would be pretty hot
[08:49:31] <iSaleK> I'm not heating it right now...
[08:49:33] <jadew> 209 Celsius
[08:49:50] <iSaleK> It should say about 26 Celsius
[08:50:08] <jadew> I don't have the exact chip you have
[08:50:10] <iSaleK> That's what my other thermometer says
[08:50:24] <jadew> so I don't know how data is encoded in there
[08:50:35] <iSaleK> temperature = ((temp_high << 8) | temp_low);
[08:50:40] <jadew> but for me, the data is arranged as I showed you in that pastebin
[08:50:40] <iSaleK> This part is ok?
[08:50:51] <jadew> I never used more than the first byte of the scratchpad
[08:51:06] <jadew> depends what high means for you
[08:51:15] <jadew> the low part is the first byte
[08:51:29] <jadew> it's arranged as low high
[08:51:35] <jadew> so it depends how you read them
[08:51:36] <iSaleK> Yes, I first get low byte then high
[08:51:45] <jadew> then yeah, it's ok
[08:52:10] <iSaleK> Oh, so I have to flip them from low->high to high->low?
[08:52:20] <jadew> no
[08:52:24] <jadew> if you do:
[08:52:30] <jadew> low = wire_read()
[08:52:34] <jadew> high = wire_read()
[08:52:47] <jadew> total = low | (high << 8);
[08:52:51] <jadew> it's perfectly fine
[08:55:09] <iSaleK> I did that...
[08:55:39] <iSaleK> What bothers me is that I get 3 chars instead of 2 :\
[08:55:42] <iSaleK> Don't know how :\
[08:55:51] <iSaleK> Last two are the same thou...
[08:56:09] <jadew> what do you mean 3 instead of 2?
[08:56:14] <jadew> how is that possible?
[08:57:31] <iSaleK> Don't know... Uploading picture for you to see...
[08:57:35] <iSaleK> http://imgur.com/8f4vH
[08:58:38] <jadew> well, you do usart_putc 3 times
[08:59:06] * iSaleK is an idiot... :D
[08:59:16] <iSaleK> I totally forgot about that :D
[09:01:08] <iSaleK> So now I get 9F as temperature
[09:01:22] <jadew> yeah, that doesn't look right
[09:03:02] <iSaleK> Well when I hold it in my hand I get FB
[09:05:10] <jadew> heh, probably the pullup isn't doing it's job
[09:05:19] <iSaleK> It's 4K7
[09:05:58] <jadew> actually FB seems to have lots of 1's
[09:06:17] <jadew> so maybe the sensor isn't properly connected or something and it fails to pull the line down
[09:08:02] <iSaleK> Should I try to re-wire it and use 10K maybe?
[09:08:41] <jadew> no, theBear was right yesterday, it shouldn't have issues with the 4.7k one
[09:09:58] <theBear> hooray for me !
[09:10:06] <iSaleK> :D
[09:15:30] <iSaleK> Now I get values like C2, C8, C4 etc...
[09:16:55] <iSaleK> Is that ok?
[09:17:39] <jadew> if you live in an oven
[09:17:50] <iSaleK> :D
[09:18:07] <jadew> you're not living in a country that's using the metric system, isn't it?
[09:18:14] <iSaleK> Yes
[09:18:21] <iSaleK> Europe
[09:18:29] <jadew> ah, so you are on the metric system
[09:18:51] <jadew> well C2 = 194
[09:18:57] <jadew> 194 / 2 == too hot
[09:19:23] <Richard_Cavell> Now am I right in thinking that the STK500 only programs DIP chips? Is the STK600 more advanced primarily because it can program other packages?
[09:19:42] <iSaleK> Hmmm... I don't know what's the problem then...
[09:19:46] <jadew> I'm sure it can program all the chips
[09:20:15] <jadew> Richard_Cavell, why would the packaging matter?
[09:20:28] <Richard_Cavell> jadew: Cos you can't fit the damn thing in if there's no socket fo rit
[09:20:42] <jadew> use some wires
[09:20:58] <jadew> or do what Tom_itx did
[09:21:27] <Richard_Cavell> The only sockets I see there are DIP
[09:21:31] <Richard_Cavell> I have to say that I like DIP
[09:21:36] <Richard_Cavell> but it limits the number of pins
[09:21:43] <Richard_Cavell> There's no AVR 8 with more than 40 pins in DIP
[09:21:44] <jadew> http://tom-itx.dyndns.org:81/~webpage/attiny2313/attiny9.jpg
[09:22:02] <jadew> make a pcb like that one, especially for burning chips
[09:22:08] <jadew> and you can hold them down with your finger
[09:22:25] <Richard_Cavell> it's not the same. STK500 gives you LEDs, switches
[09:22:56] <jadew> well, you asked about programming
[09:23:10] <jadew> you can deffinitely use the STK500 to program them
[09:23:41] <Richard_Cavell> but you have to mount the chip externally somehow
[09:23:44] <Richard_Cavell> just not elegant
[09:23:45] <jadew> now if you need a devboard... maybe you can make yourself a smd to dip pcb?
[09:24:21] <Richard_Cavell> I'd like to move into other socket types but not until I know how to make my own PCBs
[09:24:32] <Richard_Cavell> That's next on my list of things to learn - toner transfer.
[09:24:45] <jadew> it's easy
[09:25:16] <jadew> 1) you print with max settings on glossy paper
[09:25:29] <jadew> 2) you put a piece of regular paper over the pcb
[09:25:41] <jadew> 3) you preheat the pcb trough that paper (with the iron)
[09:26:17] <iSaleK> jadew: how come, the HIGH is 01, LOW is AF and the High+Low is the same as the LOW???
[09:26:24] <jadew> 4) remove the paper and place the glossy paper on the PCB, being very careful, because the PCB will be hot and it will stick imediatly
[09:26:51] <jadew> 5) you iron it for a while, making sure the glossy paper won't slide and ruin the traces
[09:27:01] <jadew> 6) soak for 10-20 minutes
[09:27:23] <jadew> 7) remove paper, clean with acetone, drill, done
[09:27:43] <jadew> iSaleK, I thought that might happen
[09:28:06] <jadew> 1) check that the accumulator variable is int16_t
[09:28:19] <jadew> and cast high to int16_t as well, before you << 8
[09:28:48] <jadew> otherwise, after the shift, you might end up with a zeroed 8 bit variable
[09:29:08] <jadew> so you need to tell the compiler to treat it as a 16 bit var, before shifting
[09:31:17] <iSaleK> I still get High+Low = Low :\
[09:31:56] <iSaleK> I cast value with temp_high = (int16_t)ds1820_re_byte(DS1820_pin_po);
[09:33:16] <iSaleK> Here is the code
[09:33:16] <iSaleK> http://pastebin.com/9RvSAFb5
[09:34:05] <jacekowski> that ds lib
[09:34:13] <jacekowski> where did it came from?
[09:34:51] <jadew> iSaleK, total = low | ((int16_t)high << 8);
[09:34:59] <jadew> iSaleK, int16_t total = low | ((int16_t)high << 8);
[09:35:53] <jacekowski> iSaleK: gcc is coercing types in your case
[09:36:01] <jacekowski> temperature = temp_low | ((int16_t)temp_high << 8);
[09:36:04] <jacekowski> that should be changed into
[09:36:13] <jacekowski> temperature = (int16_t)temp_low | (temp_high << 8);
[09:36:28] <jacekowski> that's one
[09:36:33] <jacekowski> and two, it should be all uint16_t
[09:36:44] <jadew> jacekowski, (temp_high << 8) might end up as int8_t
[09:36:55] <jadew> so you end up with 0
[09:37:06] <jacekowski> yes
[09:37:15] <jadew> that's why that one needs to be casted
[09:37:18] <jadew> the other one doesn't matter
[09:37:19] <jacekowski> not that one
[09:37:22] <jacekowski> other one
[09:37:22] <RLa> 324 has two usart, is one of them preferred?
[09:37:37] <jadew> because if the result of (temp_high << 8) is int16, the entire result will be int16
[09:37:47] <jadew> the low value can remain 8 bits
[09:37:50] <jacekowski> no
[09:38:04] <jadew> why not?
[09:38:11] <jacekowski> in there you have
[09:38:12] <jacekowski> temperature = temp_low | ((int16_t)temp_high << 8);
[09:38:14] <jacekowski> which is
[09:38:18] <jacekowski> 16 = 8 | 16
[09:38:24] <jadew> exactly
[09:38:35] <jadew> 8 | 16 = 16
[09:38:45] <jacekowski> so you will end up with 16 = 8 | 8
[09:38:54] <jacekowski> and then that will be casted to 16 again
[09:39:04] <jadew> why would you end up with 8 | 8?
[09:39:21] <jacekowski> because gcc will coerce that int16 to int8 because that's what's on the left
[09:39:47] <jadew> that sounds like bad behaviour
[09:39:49] <jacekowski> no
[09:39:58] <jadew> as far as I know it will use the biggest number
[09:40:01] <jacekowski> no
[09:40:08] <jacekowski> it's well known behaviour
[09:40:13] <jadew> it's like 100 / 10.0 or 100.0 / 10 will always result into a float
[09:40:16] <jadew> not into an int
[09:40:40] <jacekowski> it's different thing
[09:40:48] <jadew> I'm gonna try it, it sounds bad
[09:41:09] <jacekowski> no, it's specified by the standard
[09:41:45] <jacekowski> add -Wconversion to commandline and it will warn about stuff like that
[09:43:16] <jadew> testing something, give me a sec
[09:44:01] <jadew> well, vc++ doesn't seem to do it that way
[09:44:04] <jadew> gonna try it with vcc
[09:44:37] <jadew> gcc
[09:46:30] <jacekowski> yes it does
[09:46:44] <jadew> jacekowski, I just tried it, it doesn't
[09:47:23] <megal0maniac> Is a "double" the ugle Java cousin of something? I never seem to hear about it in C
[09:47:40] <jacekowski> double is 2xfloat
[09:47:41] <Landon> double precision float
[09:47:47] <jacekowski> standard thing
[09:47:54] <karlp> and remember on avr that a double is a float....
[09:48:12] <jacekowski> and float is bad idea on avr
[09:48:19] <karlp> not necessarily.
[09:48:24] <karlp> you should just know what you're doing.
[09:48:32] <karlp> there's nothing intrinsically _wrong_ with it.
[09:48:34] <jacekowski> slow code
[09:48:41] <karlp> which doesn't necessarily matter
[09:48:43] <jacekowski> that's what you're doing with floads
[09:48:44] <Kevin`> float on avr is fine if you realize that it takes flash space for the library and significant time to compute
[09:48:58] <jacekowski> floats*
[09:49:28] <jadew> jacekowski, gcc doesn't do it either
[09:49:35] <jadew> I tried it on an avr
[09:49:44] <jadew> uint16_t total = low | ((uint16_t)high << 8);
[09:49:52] <jadew> where low and high were uint8_t
[09:50:00] <jacekowski> uint
[09:50:03] <jacekowski> different thing
[09:50:03] <jadew> the result was 266
[09:50:09] <jadew> it's not different
[09:50:31] <jacekowski> let me find an article about it
[09:51:10] <jadew> same happens with int
[09:51:16] <jadew> it must be a wrong article
[09:51:50] <jadew> any compiler is smart enough to know which type to use in such operations
[09:52:15] <jadew> not to mention that | doesn't care which operand is on the left and which is on the right
[09:52:33] <jadew> so it makes sense for the result to be of the biggest size
[09:52:51] <jacekowski> http://gcc.gnu.org/wiki/Wcoercion#Testcases
[09:53:24] <jacekowski> you are assuming that gcc knows what is the biggest size
[09:53:34] <jadew> of course it does
[09:53:38] <jadew> low is 8 bit
[09:53:44] <jadew> on the other side it has 16
[09:53:48] <jacekowski> same way 255*255*255*255 will fail
[09:54:05] <jadew> what?
[09:54:08] <jacekowski> because gcc will use smallest type for each one of those
[09:54:23] <jadew> yeah, it will fail on avr
[09:54:25] <jadew> that's normal
[09:54:42] <jadew> but it has nothing to do with the |
[09:54:55] <jacekowski> not only avr
[09:54:56] <jadew> which operates on two values
[09:54:57] <jacekowski> any other cpu
[09:55:14] <jadew> it won't fail on any cpu
[09:55:34] <jacekowski> unsigned long int res=255*255*255*255;
[09:55:34] <jacekowski> printf("%ld\n",res);
[09:56:38] <jacekowski> and you get
[09:56:38] <jacekowski> -66716671
[09:56:56] <jadew> I actually got an integral constant overflow on vc++
[09:57:16] <jacekowski> but if you do
[09:57:23] <jacekowski> unsigned long int res=255L*255L*255L*255L;
[09:57:31] <jadew> that's where you're wrong
[09:57:32] <jacekowski> as in make it treat all of them as long ints
[09:57:37] <jadew> I'm sure you don't have to make them all long
[09:57:42] <jadew> only 1 would suffice
[09:57:44] <jacekowski> you will get
[09:57:45] <jacekowski> 4228250625
[09:58:27] <jadew> it's interresting tho that it's using the smallest possible value on any architecture
[09:59:04] <jacekowski> hmm, i'm reading up on that stuff
[09:59:18] <jacekowski> and it looks like behaviour has changed couple versions ago
[09:59:26] <jadew> which behaviour?
[09:59:32] <jadew> for the | thing?
[09:59:42] <jacekowski> no, for coercion
[10:00:19] <jacekowski> hmm, let me check in C99 standard
[10:00:51] <jadew> ah, look at that in vc++ it issues that warning but gives the right result
[10:01:05] <jacekowski> thing is, there is C99 standard but not all compilers support it fully
[10:01:08] <jacekowski> as in, most don't
[10:01:25] <jacekowski> As of July 2011 in mainline GCC, 43 features have been completely implemented (12 suffer library issues), 1 feature is broken and 6 are missing.[10] GCC's 4.6 and 4.7 releases also provides the same level of compliance.[11][12]
[10:01:26] <jadew> I only started using c for AVRs
[10:01:32] <jacekowski> As of Visual C++ 2010, there are no plans to support C99.[16][17] The forthcoming Visual C++ 2011 will also lack C99 support.[18]
[10:01:49] <jacekowski> so you end up with different compilers behaving differently
[10:01:50] <jadew> yeah
[10:02:02] <jacekowski> and sometimes with different behaviour depending on version
[10:02:17] <jacekowski> that's why migration from 3.x to 4.x was quite complicated
[10:02:44] <jacekowski> though 4.x tends to be a lot more strict about all kinds of undefined behaviours
[10:36:25] <buserror> BTW guys, I've just tagged simavr as v1.0 !! https://github.com/buserror-uk/simavr
[10:37:29] <jadew> nice
[11:13:00] <megal0maniac> OSterver: I see you've simplified the blinky demo :P
[11:13:27] <megal0maniac> Also, why do you write to all ports?
[11:14:49] <RLa> huh, just finished soldering 5v regulator and rs232 level translator, now going to power on
[11:15:11] * megal0maniac covers head with hands
[11:16:22] <RLa> no smoke yet :)
[11:17:59] <RLa> and this is the first 7805 that shows exactly 5V on dmm
[11:22:08] <RLa> and +/- Vs pins on max 232 show mostly correct voltage
[11:25:43] <Thetawaves> RLa, with minimum load?
[11:26:54] <RLa> you mean the regulator?
[11:27:07] <RLa> only max232 loads it, nothing else connected
[11:48:57] <RLa> got loopback working too
[12:54:29] <RikusW> megal0maniac: the small gsm antenna does have poor signal... (rtti)
[12:56:33] <megal0maniac> RikusW: I've replied to your email ;)
[12:57:29] <jadew> iSaleK, here's the recovery time with 4k7: http://imagebin.org/233242
[12:57:40] <RikusW> megal0maniac: I've seen
[12:57:47] <jadew> iSaleK, and here's with 10k: http://imagebin.org/233243
[12:58:15] <RikusW> megal0maniac: strange thing is that cloudy weather improves the signal...
[12:58:38] <jadew> RikusW, will you have the antena on the pcb itself, in the form of traces or it's not possible for gsm?
[12:58:41] <megal0maniac> RikusW: The moisture increases conductivity XD
[12:58:42] <RikusW> I've seen it multiple times, from say 17 to 18 or 19
[12:59:08] <RikusW> jadew: the antenna I bought is made from pcb
[12:59:09] <megal0maniac> jadew: Don't most phones use PCB traces for antennas?
[12:59:28] <jadew> I don't think it's the moisture, if anything that would decrease it I think, it's possible the clouds are reflecting the signal
[12:59:31] <RikusW> megal0maniac: I think the signal is reflected from the clouds
[12:59:41] <megal0maniac> I was only kidding, guys :)
[12:59:48] <jadew> ah :P
[13:00:13] <RikusW> almost like atmospheric scatter thats used for long range comms
[13:00:29] <Casper> anyone know what transistor I can use to make a mosfet gate driver from bjt for fast and high current? 2n3904/06 give me 200ns rise and fall time, so need way more current
[13:00:37] <Casper> I'm switching at 100kHz
[13:00:51] <RikusW> megal0maniac: you might be able to get the ARRL handbook fomr a library
[13:01:01] <megal0maniac> ARRL?
[13:01:15] <megal0maniac> If it has anything to do with anything that isn't C, then I can't at the moment :P
[13:01:27] <RikusW> american radio relay league (amateur radio)
[13:01:54] <RikusW> its a book as thick as a telephone directory :-P
[13:01:58] <jadew> Casper, I think I succesfully switched 1Mhz trough a BS108
[13:02:09] <RikusW> well, the paper is a bit thicker...
[13:02:12] <jadew> ah, wait you want a bjt
[13:02:15] <RikusW> so less pages
[13:03:56] <Casper> my fet heat too much... and considering that the pulse width isn't that wide, it eat tons of the power
[13:05:44] <RikusW> megal0maniac: another nice thing, both modems have a SMA connector, so I easily connected my Wavecom antenna to the SIM900
[13:05:44] <megal0maniac> RikusW: Let me get these NRF boards working, and then we'll talk :P
[13:05:54] <megal0maniac> Ah, we like SMA
[13:06:00] <jadew> Casper, shouldn't 200ns rise and fall time be sufficient for 100khz?
[13:06:06] <Casper> what about those bc547 or something like that? or too slow?
[13:06:08] <megal0maniac> Considered NRF with SMA, but it was too pricey in comparison
[13:06:25] <RikusW> megal0maniac: how about U FL
[13:06:31] <megal0maniac> U FL?
[13:06:35] <megal0maniac> Don't know it
[13:06:44] <Casper> jadew: 10us pulse width... 0.4us in active region..
[13:07:03] <Casper> 10us max... really, it should be closer to 5 iirc...
[13:07:11] <RikusW> U.FL
[13:07:18] <RikusW> its a very small connector
[13:08:01] <RikusW> megal0maniac: you should be able to fine U.FL-R-SMT on www.otto.co.za
[13:08:22] <RikusW> or at least PGSM03-IPEX100 thats the antenna I got
[13:08:41] <RikusW> there is a UFL connector on that antenna too
[13:09:11] <RikusW> that antenna only measure 7x36mm
[13:10:03] <megal0maniac> I'd need a U FL connector on the board, though
[13:10:34] <RikusW> thats the other pat number, its smt
[13:11:44] <RikusW> it can handle a few GHz
[13:11:44] <RikusW> and that antenna is for GSM only
[13:12:44] <RikusW> megal0maniac: the smt UFL is like R7
[13:14:27] <megal0maniac> RikusW: Like this? http://otto.co.za/store/images/product/03e2b76218223d6c798a019996d2c985.jpg
[13:14:42] <RikusW> part nr ?
[13:14:50] <megal0maniac> Thing is, what would I connect it to? I've only got the ground trace...
[13:14:54] <RikusW> looks right
[13:14:58] <megal0maniac> It's a tiny image. GPRS friendly :P
[13:16:17] <RikusW> the center one is the signal
[13:16:17] <megal0maniac> Yeah, but the board has signal connected to groud, i think
[13:16:17] <megal0maniac> Can't check now, it's at home
[13:16:30] <RikusW> signal via coil or special trace to ground...
[13:16:48] <RikusW> iirc there is a few configurations for the nrf output
[13:16:52] <RikusW> *are
[13:17:23] <RikusW> those nrfs got a builting pcb trace antenna
[13:17:36] <RikusW> better not to mess with something thats working right ;)
[13:19:00] <megal0maniac> The schematic doesn't correspond with the PCB layout, so I'm just ignoring both of them
[13:19:00] <megal0maniac> And I shall leave it as is :)
[13:19:03] <RikusW> that pic is like 3x3x1.25mm
[13:26:22] <iSaleK> jadew: Could it be that I'm recieving higher temperatures on DS18B20 because my cables are about 30-33cm long?
[13:26:49] <megal0maniac> Unlikely
[13:27:00] <megal0maniac> On a digital device. Analogue, maybe
[13:27:54] <iSaleK> It's wierd that I get values that are not real
[13:28:17] <iSaleK> I get High+Low byte and when I convert it to decimal and divide by 2 I get temperatures around 70 Celsius
[13:28:29] <iSaleK> And I'm pretty sure that's false reading :D
[13:29:17] <RikusW> isn't that Fahrenheit ?
[13:30:59] <iSaleK> Are you sure?
[13:31:22] <RikusW> whats the actual Celcius temp over there ?
[13:31:26] <iSaleK> jadew told me to use that formula
[13:31:34] <iSaleK> about 26
[13:32:34] <RikusW> isn't 26C ~~ 70F ?
[13:32:36] <iSaleK> What is the formula for Celsius?
[13:33:12] <RikusW> 100F = 40C
[13:33:14] <RikusW> almost
[13:33:26] <iSaleK> OK, got it
[13:33:34] <iSaleK> In datasheet examples are in Celsius thou... :\
[13:33:58] <iSaleK> Another problem is that my HIGH byte + LOW Byte equal LOW byte
[13:34:00] <RikusW> recheck calculations...
[13:34:10] <iSaleK> Even when I do cast to uint_16
[13:34:14] <iSaleK> Don't know why
[13:34:24] <RikusW> high byte = 0 ?
[13:35:41] <iSaleK> It's 01
[13:35:43] <iSaleK> 0x01
[13:36:18] <jadew> iSaleK, can you post your code again
[13:36:28] <jadew> ah wait
[13:36:48] <jadew> your high + low is not equal to your low, not with my formula anyway
[13:37:02] <jadew> I just remembered what you did there
[13:37:07] <jadew> you did usart_putc(total)
[13:37:13] <jadew> that will convert total to uint8
[13:37:17] <jadew> well, int8
[13:37:22] <jadew> doesn't matter, but 8
[13:37:28] <jadew> so it will truncate it
[13:38:03] <iSaleK> Ok, that's nice to know :)
[13:38:19] <iSaleK> How can I send full 16bit over uart or send float value?
[13:38:29] <jadew> usart_putc(total >> 8);
[13:38:31] <jadew> usart_putc(total);
[13:39:30] <iSaleK> Ok, and how would I send a float? :)
[13:39:54] <jadew> I don't know what's the size of float on avr
[13:40:01] <jadew> probably 2...
[13:40:38] * RikusW won't use float on avr
[13:40:44] <jadew> me either
[13:40:55] <jadew> well, if it's necesary and I've got the space, I'll use it
[13:41:13] <jadew> however you can do it like for (uint8_t i = 0; i < sizeof(float); ++i) usart_putc(nr >> (i * 8));
[13:41:26] <jadew> and you'll figure out what the size of float is as well
[13:41:57] <jadew> it's wasting resources tho
[13:42:01] <jadew> so do it just to test stuff
[13:42:07] <iSaleK> Ok, or otherwise I will send hex to usart and do calculations on pc
[13:42:51] <jadew> if you don't plan to use the serial as a console, send binary
[13:43:04] <jadew> just know your types and stuff
[13:43:31] <iSaleK> Ok, I'm glad that I've solved the farenheit/celsius misunderstanding :D
[13:43:34] <jadew> and as RikusW said, try to avoid float
[13:43:49] <iSaleK> so I should only use hex?
[13:43:49] <jadew> wait, yours is in farenheit?
[13:44:03] <iSaleK> Yes, but datasheet says celsius
[13:44:12] <jadew> are you sure it's fahrenheit?
[13:44:19] <jadew> and not just an error?
[13:44:23] <jadew> ah... you know what
[13:44:26] <jadew> read 9 bytes
[13:44:31] <jadew> spit them over serial
[13:44:36] <jadew> and let me know what they are
[13:44:54] <jadew> I think I'll be able to tell if it's working or not
[13:47:44] <iSaleK> Well, I get 01 9C 4B 46 7F FF 04 10 7A 9C 9C
[13:48:17] <iSaleK> wait
[13:48:18] <OSterver> megal0maniac, TO BLINK ALL TEH PORTZ!
[13:48:39] <iSaleK> first two are low and high and the last one is high+low
[13:49:19] <iSaleK> 01 9C 4B 46 7F FF 04 10 7A 9C
[13:49:54] <jadew> yeah, looks ok
[13:50:03] <jadew> what chip did you say you had?
[13:50:06] <iSaleK> So is it Farenheit or Celsius? :)
[13:50:09] <iSaleK> DS18B20
[13:50:23] <jadew> mines are S
[13:51:33] <jadew> ok, I think yours is smarter
[13:51:40] <jadew> it depends on the resolution you set
[13:52:02] <jadew> it is in celsius
[13:52:07] <jadew> but you have several resolutions to pick from
[13:52:25] <jadew> The resolution of the temperature sensor is user-configurable to 9, 10, 11, or 12 bits, corresponding to increments of 0.5°C, 0.25°C, 0.125°C, and 0.0625°C, respectively. The default resolution at power-up is 12-bit.
[13:52:43] <jadew> taht means that you have to divide by 0.0625
[13:52:51] <jadew> *that
[13:53:27] <iSaleK> Oh, I see, and then I will get actual temperature?
[13:53:32] <jadew> yep
[13:54:14] <jadew> wait
[13:54:17] <jadew> you don't have to /
[13:54:26] <jadew> you'll get even bigger numbers :P
[13:54:28] <RikusW> just send to PC and do it there
[13:54:40] <jadew> yeah, that's a better idea
[13:54:58] <iSaleK> Ok, but on PC how do I know what to do with those numbers? :D
[13:54:59] <jadew> 25.75
[13:55:02] <jadew> that's your temperature
[13:55:10] <jadew> you multiply it with the resolution
[13:55:22] <jadew> well, it's 01 9C
[13:55:39] <RikusW> iSaleK: easier to figure it out there without reflashing the AVR every time ;)
[13:55:51] <jadew> 19c = 412
[13:56:01] <jadew> 412 * 0.0625 = 25.75
[13:56:06] <iSaleK> OK, got it now :)
[13:56:13] <iSaleK> Thank you very much :)
[13:56:38] <jadew> np
[13:56:56] <jadew> you could have saved yourself several hours of wondering if you just read the datasheet :)
[14:08:14] <iSaleK> I did skim read it... I will read it from cover to cover another time :D
[14:08:17] <iSaleK> *next time
[14:08:23] <iSaleK> :)
[14:51:44] <iSaleK> Damn, this VB.net has really wierd way of handling things :\
[14:53:24] <RikusW> VB has a really weird way of handling things :-P
[14:54:35] <iSaleK> I see that...
[14:54:54] <iSaleK> I only like the thing it has really easy GUI to design...
[14:59:56] <OSterver> C#
[15:01:31] <iSaleK> Why do Java developers wear glasses?
[15:01:39] <iSaleK> Because they can't C#
[15:01:40] <iSaleK> :D
[15:01:57] <RikusW> lol
[15:05:19] <inkjetunito> :D
[15:24:45] <OSterver> I have just realized that arduino's FTDI FT232 is using 5V IO
[15:24:48] <OSterver> or does it use 3V3?
[15:24:58] <Tom_itx> dunno
[15:25:01] <OSterver> either way I was driving with it xmega's UART :D
[15:25:26] <Tom_itx> xmegas are tough
[15:25:30] <Tom_itx> i've powered mine at 5v a few times
[15:25:34] <OSterver> aye
[15:25:39] <OSterver> no clock fuses!
[15:25:39] <OSterver> heh
[15:25:41] <OSterver> did they survive?
[15:25:46] <Tom_itx> not for extended periods
[15:26:18] <OSterver> ah
[15:26:27] <OSterver> well, I do wonder at two things:
[15:26:41] <OSterver> a) if you would put it under LN2 and put in higher voltages (let's say 4V) how high would it go? :P
[15:26:47] <OSterver> (clock speed)
[15:26:55] <OSterver> b) at what manufacturing size are they made? I'd guess something like 90nm or so
[23:03:01] <jadew> samn... solder paste is so expensive
[23:03:05] <jadew> *damn
[23:07:46] <hackvana> Solder paste shipped to you cold, that's been cold all its life is expensive.
[23:08:28] <hackvana> http://blogs.indium.com/blog/eric-bastow/solder-paste-and-summer-heathot-stuff
[23:09:23] <jadew> so after I get it, should I keep it in the fridge, or what?
[23:10:27] <hackvana> Most people do, although that article says < 25C
[23:11:24] <hackvana> If it's Pb solder paste, and you're going to put it in your home fridge, best put it in some form of childproof container, and mark it as containing lead, and doesn't make good paste for midnight sandwiches.
[23:11:58] <tyrithe> I know some people use those single can sized USB "fridges" for stpring a small amount.
[23:12:26] <tyrithe> Personally, lead and food always stay separated.
[23:12:44] <jadew> yeah, I guess it's not a good idea to have them together eh? :)
[23:13:13] <tyrithe> Often not.
[23:13:15] <jadew> the pb based ones seem to be cheapper
[23:13:29] <tyrithe> Plus, if I tried, I expect my wife would kill me... :)
[23:13:57] <jadew> yeah, not gonna use solder paste
[23:14:07] <jadew> seems like too much trouble
[23:15:11] <jadew> I'm about to buy a hakko fx 888, do you guys have any other recommendations? should I get something else?
[23:15:31] <jadew> I wanted to get the weller wes51, but it's way too expensive in here
[23:20:46] <tyrithe> Only heard good about the Hakko, and haven't heard much either way on the Weller.
[23:21:39] <jadew> apparently they're both pretty good
[23:21:46] <jadew> but the weller costs about 3 times as much
[23:22:31] <hackvana> Hackko 888 has a very good rep
[23:22:48] <tyrithe> Plan to upgrade one of these days.
[23:22:55] <hackvana> I put my solder paste tube in a zip-lock bag in the fridge.
[23:23:46] <hackvana> The USB fridges are rather inefficient, because of volume-to-surface area, and because of the inefficiency of the TEC units they use.
[23:23:57] <tyrithe> True
[23:24:17] <hackvana> jadew: Solder paste is magic with SMD
[23:24:27] <jadew> I know...
[23:24:37] <hackvana> Esp when combined with a stencil, such as the ones I provide
[23:24:37] <jadew> but then again, I'd need a proper hot air gun
[23:24:42] <jadew> the one I have has only two settings
[23:24:46] <jadew> and it puts out about 2000W
[23:24:51] <jadew> it melts PCBs
[23:24:55] <hackvana> One of my customers does reflow on an inverted clothes iron
[23:25:18] <tyrithe> interesting. I've seen electric skillet and toaster oven... never seen clothes iron
[23:25:19] <jadew> I guess that could work as well
[23:25:29] <hackvana> You just gotta get inventive
[23:46:02] <NinoScript_> /join #arduino
[23:48:28] <jadew> do you guys know what A B and C means when it comes to enclosures? I can't make sense of the values they're providing on this site, I think they're messed up
[23:53:01] <Casper> jadew: check the drawing
[23:53:13] <Casper> nite
[23:53:13] <jadew> I did... but there are so many
[23:53:17] <jadew> night