#avr | Logs for 2013-04-10

Back
[03:17:24] <JyZyXEL> what to use when you need to convert hex/decimals into big/little endian binary sign/unsigned/twos complement?
[03:17:41] <JyZyXEL> is there like some programmers calculator that could be used
[03:19:00] <jadew> for hex/dec/bin/oct the standard calculator from windows
[03:19:16] <jadew> for the other stuff, you can just do it in your head
[03:19:53] <JyZyXEL> thats the problem, you really cant
[03:20:58] <jadew> sure you can, you just read it backwards for little endian
[03:21:15] <JyZyXEL> what about the sign byte, does it change place too?
[03:21:20] <jadew> no
[03:21:25] <jadew> it stays in the MSB
[03:22:14] <JyZyXEL> in offset 0
[03:22:42] <JyZyXEL> so its always "the first byte"
[03:22:58] <jadew> -32768 (WORD)
[03:23:04] <jadew> 0x8000
[03:23:09] <jadew> little endian 00 80
[03:26:47] <JyZyXEL> what about number 13 in 32-bit big endian
[03:26:55] <JyZyXEL> decimal number 13
[03:27:12] <JyZyXEL> signed
[03:27:13] <jadew> 0d 00 00 00
[03:27:27] <jadew> the sign bit is only set when you're going negative
[03:27:43] <jadew> -13 would be 0d 00 00 80
[03:28:20] <jadew> or wait...
[03:28:34] <JyZyXEL> well its super hard to in head
[03:28:45] <jadew> it would be F3 FF FF FF
[03:29:09] <JyZyXEL> this is why a calculator is needed
[03:29:21] <JyZyXEL> it doesn't make stupid mistakes
[03:29:23] <jadew> yeah, but the endianness is easy to figure out
[03:30:43] * jadew has to clean up his room
[03:33:40] <JyZyXEL> if you stored the DEC 13 as a signed 32-bit big endian i think it might be stored in byte order: 0x00, 0x00, 0x00, 0x0d
[03:33:59] <jadew> yes, that's correct
[03:34:05] <JyZyXEL> however im not really sure since i don't know of any calculator that i could use to check it
[03:34:29] <jadew> what do you need to check there?
[03:34:34] <jadew> 13 = 0x0d
[03:34:54] <jadew> big endian = most significant stuff at the front
[03:35:27] <JyZyXEL> i have no clue what would happen if you changed the sign bit now
[03:35:46] <jadew> ff ff ff f3
[03:36:09] <JyZyXEL> thats insane how much effect it has
[03:36:18] <jadew> it's not
[03:36:22] <jadew> consider a 1byte value
[03:36:26] <jadew> 00
[03:36:30] <jadew> if you substract 1
[03:36:42] <jadew> it will overflow and go to FF
[03:37:01] <JyZyXEL> had you a calculator for this you could simply tick the sign box and BAM you'd have that correct answer
[03:37:16] <jadew> the calculator from windows does that
[03:37:23] <jadew> you can set individual bits by clicking on them
[03:37:48] <jadew> but clicking the sign bit wouldn't result in the same number, but below 0
[03:38:42] <JyZyXEL> how about twos complement
[03:38:50] <Tom_itx> http://instacalc.com/7596
[03:40:58] <JyZyXEL> how would i get the bytes for if it was stored in twos complement
[03:42:14] <Tom_itx> http://easycalculation.com/twos-complement.php
[03:42:18] <jadew> two's complement is the number when it's signed...
[03:42:22] <jadew> when it's negative
[03:42:36] <jadew> come on, open up google and read this shit, it's easy
[03:44:57] <JyZyXEL> Tom_itx: it doesn't specify the endianess?
[03:46:19] <JyZyXEL> DEC -13 would be 11110011
[03:46:49] <JyZyXEL> is that big or little and does it have the sign bit or does it need one still?
[03:47:38] <jadew> you can't tell the endianness from 1 byte
[03:47:55] <jadew> 1 byte is always going to be represented as msb
[03:48:42] <Tom_itx> Big Endian and Little Endian come from Swift’s novel Gulliver’s Travels. In this story the Lilliputians were divided into the Big Endians and the Little Endians based on which end of a boiled egg they believed should be opened.
[03:48:47] <jadew> unless it's a 4 bit system
[03:49:44] <JyZyXEL> its all about the 8-bit bytes, thats how most of the information is stored these days
[03:50:01] <JyZyXEL> and processed
[03:52:47] <Tom_itx> you need an egg to convert endian
[03:53:53] <JyZyXEL> so would the twos complement of decimal 13 be in 32-bit big endian the same: 0x00, 0x00, 0x00, 0x0d
[03:54:58] <Tom_itx> http://www.ehow.com/how_8093788_calculate-big-endian-integer-value.html
[03:55:41] <jc5134> Hello, my programmer broke so I got a dragon instead
[03:56:03] <jc5134> I got an atmega32 and can't program it over jtag with avrdude
[03:56:10] <JyZyXEL> what im most interedted about is the resulting byte array
[03:56:38] <Tom_itx> jc5134, so use the ISP port on it instead
[03:56:38] <jc5134> I tried to put -B 10 in there but I can't get it to communicate any slower. It always says: JTAG clock : 891.7 kHz (1.1 us)
[03:56:48] <jc5134> Tom_itx, I need debugging
[03:57:18] <jc5134> the thing is the mega has an 1.8432MHz crystal so I need AT LEAST 4 uS jtag period
[03:57:56] <jc5134> anyone knows how to force avrdude to tell the dragon to go slower ?
[03:58:09] <jc5134> my command line: avrdude -B 10 -v -B 10 -P usb -B 10 -p m32 -B 10 -c dragon_jtag -B 10 -E noreset -B 10 -Uflash:w:pat-mains-cps.hex:a
[03:58:27] <jc5134> fuse programming works fine, t he part responds but flash gets corrupted data (verification fails), understandably
[03:58:34] <Tom_itx> why are you repeating the -B?
[03:58:48] <JyZyXEL> there are also biased numbers
[03:58:50] <jc5134> Tom_itx, because I want to make sure avrdude gets it. I tried it with just one -B 10
[03:59:27] <jc5134> actually the part gets the correct program but with a slight offset it seems
[03:59:49] <jc5134> looks like first page is unwritten and the correct program sits from second page onward
[04:04:55] <jc5134> I see.. looks like the -B parameter applies to STK500 only.. so looks like the dragon can't be used with avrdude for frequencies < 4MHz over JTAG
[04:04:58] <jc5134> I'll try avarice
[04:14:22] <jc5134> hmm avarice seems to misbehave as well when programming
[04:14:29] <jc5134> I'll try upgrading firmware
[04:24:22] <jc5134> damn the atmel site is soooo slow and it's a 500MB download
[04:24:34] <jc5134> what are they thinking not allowing external mirrorring? useless.
[05:41:37] <langoliers> h
[05:42:14] <Steffanx> l
[05:47:03] <langoliers> jc5134<= hahaha
[05:48:49] <jc5134> turns out my in circuit debugging connectors were wrong, tried it on a breadboard and it worked, lol
[05:49:16] <jc5134> I wouldn't expect it to behave so very obscurely though, had to reconnect usb to the dragon plenty of times
[05:52:12] <langoliers> i remember my atmel.com snapshot is more than 1GB
[05:55:40] <Steffanx> that's incl. datasheets?
[05:56:06] <langoliers> yes
[05:56:41] <Steffanx> Then 1GB isn't that much imho
[05:57:03] <Horologium> 7.3GB for the full atmel techlib.
[05:57:17] <Horologium> that includes both avr and avr32 though.
[05:59:22] <langoliers> ha i don't know where is my atmel.com mirror now, tried searching for it
[05:59:56] <langoliers> must have slipped into some porn directory
[06:01:21] <Steffanx> Why people save that nowadays? :P
[06:01:28] <Steffanx> *download
[06:01:35] <langoliers> atmel.com?
[06:01:41] <Steffanx> nevermind
[06:01:53] <langoliers> it is cool to read datasheets offline
[06:03:50] <langoliers> the thing is, they do not name it the way it would be easy to search for them...
[06:04:07] <langoliers> *pdf files
[06:29:36] <kdehl> Has anyone of you ever made a vt100 compatible terminal?
[06:29:42] <Horologium> http://www.atmel.no/techlib/
[06:29:54] <Horologium> you mean that? first link in a google search for avr techlib
[06:30:00] <Horologium> kdehl, yes.
[06:30:32] <kdehl> I'm not sure how I should implement local setups, should I have a special key combination that enters a menu, perhaps? What do you think?
[06:30:52] <kdehl> Local setup of the terminal.
[06:31:20] <Horologium> I just had basic setup and didn't allow changing it on the fly, but, yeah, that would work.
[06:31:37] <kdehl> I want to send as much as possible to the host, not to screw up whatever program is being run.
[06:31:38] <Horologium> what keyboard are you using?
[06:31:40] <kdehl> Okay.
[06:32:00] <kdehl> For now I'm using a common PS/2 keyboard, but I don't want to restrict myself to that.
[06:32:09] <kdehl> Is there a common key combination for this kind of thing?
[06:32:23] <Horologium> I don't remember, but one could look it up fairly quickly.
[06:32:26] <kdehl> I think I've seen caps lock + some key somewhere.
[06:32:38] <kdehl> I tried. But I should try again. Heh.
[06:32:43] <Horologium> I was going to suggest F12 as that isn't part of the vt100 stuff.
[06:33:34] <Horologium> http://www.vt100.net/
[06:33:37] <kdehl> True that. But I'm not sure, maybe I shouldn't restrict myself to vt100 either. I mean, some unix console programs use that key, don't they?
[06:33:45] <Horologium> manuals on there tell how you do it on a real vt100 terminal.
[06:33:46] <kdehl> Heh, yeah, found that site.
[06:34:09] <kdehl> Caps Lock/Print Screen.
[06:34:21] <kdehl> (or Alt/Print Screen)
[06:34:30] <kdehl> Heh. I've never heard of that combination before.
[06:34:49] <twnqx> hm, alt+print = sysrq
[06:34:56] <twnqx> needed for linux (at times)
[06:35:09] <Horologium> only if you want to print screen.
[06:35:13] <kdehl> Oh yeah, that's true.
[06:35:13] <Horologium> I've never used it...
[06:35:20] <twnqx> or reboot, or power off, or ...
[06:35:22] <Horologium> nor have I ever used F11 or F12 for anything
[06:35:24] <twnqx> (sysrq)
[06:35:36] <Horologium> and I've used linux exclusively for 10 years.
[06:36:03] * twnqx uses it more often than he'd like
[06:36:15] <Horologium> I could assign virtual terminals to them but never needed to.
[06:36:35] <kdehl> Maybe I should use something like screen, like ctrl-F12 instead of ctrl-a, and if you do a double you send the key combination to the host instead.
[06:39:02] <kdehl> No, that'd require the keyboard to have F12, something which not all do.
[06:39:38] <kdehl> I definitely don't want to use ctrl-a, then I'd complicate the usage of screen.
[06:39:43] <kdehl> Hrrm.
[06:44:57] <Horologium> ctrl-alt-shift-enter
[06:48:19] <kdehl> Yeah, maybe. Did you make that one up, or have you seen it being used?
[06:55:38] <langoliers> 8 keys are enough for everything
[06:55:50] <langoliers> you just need to press the right combination
[06:56:46] <langoliers> or use 10 and one of your fingers can be clock
[06:57:07] <langoliers> and 512 keys with one clock
[06:57:16] <langoliers> nah? cool?
[06:58:46] <kdehl> Yeah... no.
[08:43:22] <geoforce> long ? hope it makes sense
[08:45:46] <geoforce> can you use a write to the PINx register to toggle a pin in the Portx as a clock signal for serial off that port?
[08:47:31] <geoforce> like: load 01xxxxxx in port then load 1xxxxxxx in PIN register to toggle the port to 11xxxxxx ?
[08:48:26] <geoforce> seems this is a possible way to clock a rising edge in minimum cycles.
[08:49:04] <geoforce> hope tis makes sense, im just musing as I try to start thinking in AVR
[08:52:28] <Casper> writing to pin may change it's state, IF the part support it
[08:52:48] <geoforce> that should be load 10000000
[08:53:04] <geoforce> looking at ATmega 328
[08:53:18] <Casper> but if you want a steady clock, you should consider using a timer
[08:53:29] <Valen1> is there a part that will do an xor Casper?
[08:53:36] <Valen1> what are you actually trying to do geoforce?
[08:54:24] <geoforce> not looking for steady, as data to out on the port is random timed
[08:55:09] <Casper> I don't code in asm, but in C
[08:55:12] <geoforce> data will come in on another port then must be sent out on rising edge to a receiver
[08:55:22] <Casper> for my needs, C is the best language
[08:56:38] <geoforce> I'm really new at this and am just musing about weird ways of doing things
[08:58:26] <Casper> banana and toothpaste... that was a weird taste, off to work, see ya
[08:59:35] <geoforce> this looks like it could give a transfer rate in 3-4 clocks or much faster than interrupts
[09:04:33] <tzanger> yeah many years in the biz has taught me you don't write in asm unless there's a damn good reason for it
[09:05:00] <langoliers> i wrote my first running lights in asm :(
[09:05:42] <tzanger> yeah I wrote my first real actual product in asm... PIC16C74 -> PIC16F77 -> PIC16F877, was a three phase industrial motor soft starter
[09:06:01] <tzanger> That thing didn't get more than about 170 instructions before hitting an interrupt of some kind
[09:06:20] <geoforce> being 70 yrs old now, I grew up thinking assembly and even did machine when starting I love it
[09:47:11] <langoliers> anybody did fractional N pwm yet?
[09:47:50] <langoliers> for example, get more than 256 power levels in motor pwm
[09:50:39] <jacekowski> 1bit pwm
[10:04:54] <OndraSter__> langoliers, use 16bit timer :P
[10:09:27] <bsdfox> what do you mean fractional? on a lot of (all?) the timers you can set alternate TOP values
[10:14:57] <langoliers> bsdfox<= by fractional i mean alternating between 2 pwm values for example
[10:16:34] <bsdfox> langoliers, if you were going to do that I would recommend using a combination software/hardware pwm.. toggle the outputs in software and run the hardware timer as fast as possible generating an interrupt when you want to toggle
[13:52:39] <cluelessperson> can someone tell me why this isn't working?
[13:52:40] <cluelessperson> http://paste.ubuntu.com/5696241/
[14:10:59] <specing> cluelessperson: does not work in what way?
[14:13:23] <cluelessperson> specing, On the arduino, pin 13 going HIGH should turn on an LED
[14:13:29] <cluelessperson> specing, the LED does not turn on.
[14:13:49] <cluelessperson> specing, http://arduino.cc/en/Hacking/PinMapping168
[14:14:03] <cluelessperson> specing, Pin 13, is PortB5
[14:15:25] <specing> B5 is 6-th pin
[14:15:36] <cluelessperson> what
[14:15:37] <specing> you are setting 2-th and 0-th
[14:16:49] <cluelessperson> specing, how?
[14:17:24] <cluelessperson> specing, can I use DDRB = 0b0010_0000; ?
[14:18:07] <cluelessperson> specing, can you tell me how I would turn PORTB 5th pin high?
[14:19:21] <specing> = 0b00100000 = 32 = 0x20 = 040
[14:20:54] <cluelessperson> specing, How do I "upload" a program to my AVR from atmel studio?
[14:21:05] <specing> I have absolutely no idea
[14:21:07] <cluelessperson> I can compile fine, but it doesn't seem to be putting it on the board.
[14:26:50] <twnqx> cluelessperson: what's that supposed to do? :P
[14:31:02] <OndraSter_> break women
[14:31:32] <cluelessperson> twnqx, I can't seem to upload my program to the AVR
[14:31:33] <cluelessperson> >.<
[14:37:30] <specing> OndraSter_: broke any yet?
[14:37:50] <OndraSter_> nope
[14:37:52] <OndraSter_> but I shaved
[14:37:55] <OndraSter_> completely!
[14:37:57] <specing> Im finding the art of seduction is a very hard subject
[14:37:58] <OndraSter_> and cut the hair
[14:38:06] <OndraSter_> so now I need just some very, very sexy PCB
[14:38:13] <OndraSter_> to make me irresistable
[14:38:47] <OndraSter_> I went from "shoulder length" hair to 2cm :P
[14:38:54] <OndraSter_> and from long beard to nothing
[14:38:57] <OndraSter_> to a babyface!
[14:39:12] <specing> hah
[14:39:23] <specing> one female called me a babyface half a year ago
[14:39:36] <specing> she flunked, lol -- who is the babyface now?
[14:39:55] <specing> Im growing shoulder-length hair, though
[15:02:04] <wondiws> is a ICSP programmer for AVR also suited for Microchips PIC?
[15:04:25] <OndraSter_> no
[15:07:02] <specing> PIC has some weird crappy protocol of their own
[15:07:08] <specing> never worked for me
[15:07:15] <specing> errors, errors everywhere!
[15:08:18] <OndraSter_> what did you expect, specing ?
[15:08:27] <OndraSter_> they have got terrible layout of registers (at least on PIC24F)
[15:08:29] <OndraSter_> :)
[15:08:45] <OndraSter_> they group together interrupts... okay, but they are named IEC0, IEC1, ... IEC8
[15:08:56] <OndraSter_> then interrupt levels: IPC0, IPC1.... IPC15
[15:08:58] <OndraSter_> seriously
[15:09:05] <OndraSter_> who is supposed to remember which register has got which peripheral
[15:10:19] <specing> OndraSter_: well... needless to say, I stopped working on them
[15:10:24] <OndraSter_> :)
[15:10:32] <OndraSter_> I still have got few classes with them at school :/
[15:10:49] <sabesto> OndraSter_: i just wrote a task for a course. try explaining why PCINT1 isnt the same as PCINT1
[15:11:05] <OndraSter_> sabesto, ?
[15:11:31] <OndraSter_> PCINT1
[15:11:31] <Steffanx> See even OndraSter_ doesnt understand
[15:11:31] <OndraSter_> twice
[15:11:58] <sabesto> PCINT1 could be the pin or refer to the interrupt vector
[15:12:05] <OndraSter_> oh
[15:12:12] <sabesto> that is really confusing
[15:12:20] <sabesto> for newbies
[15:12:21] <OndraSter_> you call that confusing?....
[15:12:21] <Steffanx> Then you call it PCINT1_vect :P
[15:12:24] <OndraSter_> yep
[15:15:07] <sabesto> well, i think you know what i mean
[15:16:23] <sabesto> "Bit 1 - PCIE1: Pin Change Interrupt Enable 1"
[15:17:06] <sabesto> i have a feeling that i have to explain that a few times, maybe i should redirect them here :P
[15:47:41] <cluelessperson> So.. how do I upload to my atmega from atmel studio?
[15:47:54] <cluelessperson> I have the programmer conencted up, it's detected, device programmer is setup
[15:48:01] <cluelessperson> how do I "upload" to the chip?
[15:48:37] <specing> you'll have to wait for someone who actually uses atmel studio to show up
[15:59:25] <cluelessperson> specing, what do you use?
[16:01:29] <specing> cluelessperson: vim + avr-gcc + avrdude on Linux
[16:06:08] <OndraSter_> cluelessperson, what programmer/debugger?
[16:17:57] <cluelessperson> OndraSter_, Atmel studio
[16:23:21] <OndraSter_> cluelessperson, I figured that
[16:23:24] <OndraSter_> but I mean your hardware
[16:23:41] <cluelessperson> OndraSter_, Oh. USBTiny MKII by Tom_itx
[16:24:10] <OndraSter_> oh
[16:24:13] <OndraSter_> ask Tom_itx then :)
[16:24:47] <OndraSter_> there should be in Device section in options
[16:24:49] <OndraSter_> project settings
[16:24:52] <OndraSter_> there should be Device tab
[16:24:57] <OndraSter_> and it might support the usbtiny mkII directly
[16:27:21] <cluelessperson> OndraSter_, it does.. but I'm not sure it's uploading..
[16:27:39] <cluelessperson> OndraSter_, it it's being initiated. I'm sure it works
[16:27:52] <cluelessperson> just not that my app is being uploaded
[16:28:14] <specing> lol
[16:28:16] <specing> "app"
[16:29:26] <OndraSter_> how do you know if it has been uploaded?
[16:31:08] <cluelessperson> OndraSter_, I figured it out..
[16:31:20] <cluelessperson> OndraSter_, but I'm not sure if it's reprogrammed every time I save though
[16:31:23] <cluelessperson> i'm testing
[16:31:28] <cluelessperson> specing, "program" then
[16:31:45] <OndraSter_> no, it is not reprogrammed when you save it
[16:31:51] <OndraSter_> it is reprogrammed when you hit the RUN or something button
[16:33:34] <cluelessperson> OndraSter_, it doesn't seem to
[16:52:29] <Tom_itx> cluelessperson do you still have the bootloader in the arduino?
[16:52:56] <cluelessperson> Tom_itx, yes.
[16:53:13] <Tom_itx> and you're trying to upload a program to it?
[16:53:16] <Tom_itx> using studio?
[16:53:28] <cluelessperson> Tom_itx, it seems to upload, but it's a tedious process
[16:53:43] <cluelessperson> Tom_itx, I have to repeatedly go to "device programming" and hit program
[16:53:53] <sabesto> doesnt seem like avrdude supports the new xplained pro boards, wonder if someone is still maintaining it
[16:53:56] <Tom_itx> i leave that open
[16:53:59] <Tom_itx> usually
[16:54:12] <Tom_itx> not sure you can in studio 6
[16:54:15] <cluelessperson> Tom_itx, ah, I can open it somewhere else, so it's not in the way
[16:54:17] <Tom_itx> haven't used it that much
[16:54:48] <Tom_itx> erase before write needs to be checked
[16:54:55] <sabesto> you can setup the programmer in the project settings and hit "run without debugging" to compile+upload
[16:55:12] <cluelessperson> Tom_itx, ah, got it
[16:55:21] <sabesto> and assign a shortcut for it aswell
[16:55:26] <cluelessperson> Tom_itx, do you know a simple wait(time) command?
[16:55:43] <Tom_itx> delay
[16:56:05] <sabesto> http://www.nongnu.org/avr-libc/user-manual/group__util__delay.html
[16:56:10] <Tom_itx> there are a couple
[16:56:33] <cluelessperson> Tom_itx, hm. I turn this pin high, then it doesn't seem to go off after the delay
[16:56:59] <Tom_itx> have you overwritten the bootloader?
[16:57:17] <cluelessperson> Tom_itx, no.
[16:57:24] <cluelessperson> Tom_itx, what should I overwrite it with?
[16:57:40] <Tom_itx> just figuring out where you are with it
[16:57:55] <Tom_itx> if you erase the bootloader you also need to change the boot fuse
[16:58:07] <Tom_itx> or it will look in the wrong place in flash to run code
[16:58:35] <Tom_itx> what avr is it?
[17:01:25] <cluelessperson> Tom_itx, Atmega328P-PU
[17:01:46] <Tom_itx> what fuses are set?
[17:02:17] <cluelessperson> Tom_itx, 16 mhz
[17:02:27] <cluelessperson> Tom_itx, external oscillator, I dunno
[17:02:52] <Tom_itx> don't change that
[17:02:58] <Tom_itx> is BOOTRST set?
[17:03:22] <cluelessperson> yea
[17:03:37] <Tom_itx> so if your bootloader is missing, it won't run the program
[17:03:41] <cluelessperson> Tom_itx, what's CKOUT ?
[17:03:58] <Tom_itx> don't remember
[17:04:04] <sabesto> clock out
[17:04:05] <Tom_itx> it's in the data sheet
[17:04:13] <cluelessperson> Tom_itx, clock pulses out on sckout? so I oculd theoretically sync the clock on two fo these?
[17:04:19] <Tom_itx> could be
[17:04:29] <Tom_itx> yes i think so
[17:04:32] <sabesto> sends the clock signal out on 1 or 2 spesific pins
[17:04:41] <cluelessperson> Tom_itx, my program is running
[17:04:49] <Tom_itx> k
[17:05:07] <cluelessperson> Tom_itx, I'm using it on my arduino. pin PORTB5 or Digital 13, has an LED on it
[17:05:11] <cluelessperson> I can make it turn on or off
[17:05:20] <cluelessperson> but not on, delay(1000), off
[17:05:24] <cluelessperson> it doesn't turn back off
[17:05:35] <cluelessperson> PORTB = 0b00100000;
[17:05:36] <cluelessperson> _delay_ms(1000000);
[17:05:36] <cluelessperson> PORTB = 0b00000000;
[17:06:11] <sabesto> add another delay
[17:06:25] <cluelessperson> sabesto, why?
[17:06:28] <Tom_itx> you also need a delay after the 2nd one
[17:06:30] <cluelessperson> I will, just curious
[17:06:33] <sabesto> it turns off then on again right after
[17:06:34] <Tom_itx> because the program loops
[17:06:40] <Tom_itx> you need 2
[17:06:41] <cluelessperson> while(1){
[17:06:41] <cluelessperson> }
[17:06:44] <sabesto> this is in a while loop i presume
[17:06:46] <Tom_itx> uh huh
[17:06:54] <cluelessperson> doesn't delay (1000) delay for 1000 milliseconds?
[17:07:00] <cluelessperson> I put a million to test for micros
[17:07:00] <Tom_itx> 1 sec
[17:07:01] <Tom_itx> yes
[17:07:10] <Tom_itx> but you need 2
[17:07:16] <cluelessperson> yeah. I put a while loop after them
[17:07:28] <cluelessperson> so it should turn on, delay for one second, then off again
[17:07:34] <cluelessperson> and stick in the while(1)
[17:07:39] <Tom_itx> uh huh
[17:07:43] <Tom_itx> post your code
[17:08:01] <cluelessperson> http://paste.ubuntu.com/5696714/
[17:08:25] <vsync_> you need another delay or you'll miss the blink! :(
[17:08:52] <cluelessperson> vsync_, ON, Delay(1 second), OFF, While(forever)
[17:08:56] <sabesto> that should work
[17:09:00] <Tom_itx> you could also do PORTB ^= 0x20; and it would do the same thing
[17:09:03] <Tom_itx> with 1 delay
[17:09:08] <Tom_itx> xor
[17:09:20] <Tom_itx> will either turn it on or off based on it's current state
[17:09:29] <sabesto> you also need to #define F_CPU "clock speed in Hz" to get accurate delays
[17:09:36] <vsync_> cluelessperson: you need to throw that thing inside the while loop
[17:09:36] <Tom_itx> yes
[17:09:37] <cluelessperson> sabesto, right!
[17:10:12] <sabesto> so if its an arduino you must #define F_CPU 16000000
[17:10:17] <cluelessperson> sabesto, Tom_itx That's it. The defined
[17:10:20] <sabesto> before you include delay.h
[17:10:21] <cluelessperson> works
[17:10:38] <Tom_itx> what's asf.h?
[17:10:54] <Tom_itx> and why are you using binary notation?
[17:10:57] <Tom_itx> instead of hex
[17:11:04] <Tom_itx> learn to use hex
[17:11:33] <sabesto> or (1<<PB5)
[17:11:36] <Tom_itx> asf.h musb be ardweenie
[17:11:40] <Tom_itx> yeah
[17:11:52] <sabesto> asf = atmel sofrware framework
[17:11:54] <Tom_itx> that way you can look at the code and see what pin it affects
[17:12:05] <Tom_itx> mmmm
[17:12:07] <sabesto> *software
[17:12:26] <cluelessperson> I don't think
[17:12:28] <cluelessperson> yeah
[17:12:34] <cluelessperson> PORTB ^= 0x20;
[17:12:38] <cluelessperson> so what does this do exactly?
[17:12:57] * Tom_itx mutters some obscenities about asf.h
[17:13:16] <Tom_itx> it tells it to switch the pin to the opposite of what it currently is
[17:13:23] <Tom_itx> xor
[17:13:33] <cluelessperson> Tom_itx, PORTB ^= 0x00; and this?
[17:13:37] <Malinuss> cluelessperson, read this: http://playground.arduino.cc/Code/BitMath
[17:13:41] <cluelessperson> those commands target specific pins?
[17:13:44] <Tom_itx> that won't work
[17:13:58] <cluelessperson> Tom_itx, I see. It's a switch
[17:14:01] <Tom_itx> PORTB ^= 0xFF; would
[17:14:07] <Tom_itx> because it will switch the whole port
[17:14:17] <cluelessperson> Tom_itx, sabesto It's still not waiting like it should
[17:14:27] <Malinuss> read what I linked and you will from this day understand bit math, instead of seeing it as some magic letters, numbers and signs :)
[17:14:30] <cluelessperson> Tom_itx, sabesto I'm playing with the delay. It seems to just not work
[17:14:44] <Tom_itx> you don't have the code inside the loop
[17:14:50] <Tom_itx> not on your paste anyway
[17:14:59] <cluelessperson> it should just run once?
[17:15:00] <cluelessperson> at least
[17:15:06] <cluelessperson> turn on led, then off after 2 seconds.
[17:15:14] <cluelessperson> it's just staying on
[17:16:52] <Tom_itx> http://paste.ubuntu.com/5696741/
[17:18:47] <sabesto> Tom_itx: doesnt matter, he put a while after his code, it should have worked
[17:19:07] <cluelessperson> Tom_itx, It's flashing many times per second...
[17:19:23] <Tom_itx> i forgot the #define F_CPU there
[17:19:26] <Tom_itx> add it
[17:19:30] <cluelessperson> it's there
[17:19:36] <Tom_itx> not in mine
[17:19:51] <cluelessperson> http://paste.ubuntu.com/5696752/
[17:19:59] <cluelessperson> This flashes many times per second.
[17:20:17] <cluelessperson> like 2.5 times per second with that code
[17:20:34] <Tom_itx> take the DDRB out of the loop
[17:20:41] <cluelessperson> then it doesn't flash at all
[17:20:45] <sabesto> put the define before you include util/delay
[17:20:53] <Tom_itx> yeah
[17:20:56] <cluelessperson> er
[17:21:02] <Tom_itx> delay needs to see it
[17:21:05] <cluelessperson> sabesto, did
[17:21:08] <cluelessperson> oh
[17:21:30] <cluelessperson> That's it! :D
[17:21:39] <cluelessperson> define speed before the delay library
[17:22:35] <cluelessperson> So cool
[17:22:38] <cluelessperson> first working program
[17:22:54] <Tom_itx> you only need one PORTB ^= line
[17:22:55] <cluelessperson> and first medium in which I needed help for my hello world. >.<
[17:22:58] <Tom_itx> and one delay
[17:23:05] <cluelessperson> Tom_itx, TRUE
[17:23:09] <Tom_itx> if you use ^=
[17:23:13] <cluelessperson> it's a switch
[17:23:17] <cluelessperson> switch, delay
[17:23:20] <cluelessperson> repeat
[17:23:28] <Tom_itx> if you set it then you will need them both
[17:24:11] <Tom_itx> PORTB |= (1<<PINB5);
[17:24:15] <Tom_itx> PORTB |= ~(1<<PINB5);
[17:24:31] <cluelessperson> Tom_itx, that's some weird ass syntax.
[17:24:32] <sabesto> this should work: http://pastebin.com
[17:24:43] <Tom_itx> err the 2nd one may be wrong
[17:24:52] <Tom_itx> you may need
[17:25:03] <Tom_itx> PORTB &= ~(1<<PINB5);
[17:25:05] <cluelessperson> Tom_itx, I really hate C for that.
[17:25:06] <Tom_itx> i forget
[17:25:08] <cluelessperson> seems uberly complicated
[17:25:09] <Tom_itx> naw
[17:25:20] <Tom_itx> you're just shifting the bit into place
[17:25:31] <Tom_itx> instead of using a whole mask
[17:25:48] <Tom_itx> there are times you won't want to use a whole mask
[17:25:55] <cluelessperson> Tom_itx, Now to figure out ASM
[17:26:03] <Tom_itx> that's easy
[17:26:13] <cluelessperson> Tom_itx, not for me, yet. >.<
[17:26:26] <cluelessperson> Tom_itx, I really just need a fairly simple script
[17:26:32] <Tom_itx> .list
[17:26:33] <Tom_itx> SBI DDRB, DDB2 ;make PB2 output
[17:26:33] <Tom_itx> loop:
[17:26:33] <Tom_itx> DEC r16
[17:26:33] <Tom_itx> BRNE loop ;inner loop
[17:26:33] <Tom_itx> DEC r17
[17:26:33] <Tom_itx> BRNE loop ;outer loop
[17:26:34] <Tom_itx> SBI PINB, PB2 ;toggle PB2
[17:26:34] <Tom_itx> RJMP loop
[17:27:18] <cluelessperson> Tom_itx, I'm going after the ASM for this.
[17:27:18] <cluelessperson> http://www.espruino.com/datasheets/WS2811.pdf
[17:27:35] <cluelessperson> Tom_itx, specifically, the 800khz protocol
[17:28:30] <Tom_itx> ok
[17:29:10] <Tom_itx> baby steps
[17:29:13] <cluelessperson> Tom_itx, that's my goal. :P
[17:29:33] <Tom_itx> you should crawl before you walk before you run
[17:29:55] <Tom_itx> that's why i hate ardweenie
[17:30:02] <Tom_itx> they skip too many steps
[17:30:16] <Tom_itx> then you get stuck and can't figure out wtf is going on
[17:30:23] <cluelessperson> Tom_itx, why do you call it the ardweenie?
[17:30:32] <Tom_itx> because i can
[17:30:38] <cluelessperson> what's it meen?
[17:30:39] <cluelessperson> mean?
[17:33:02] <Tom_itx> nothing specifically
[17:34:56] <Tom_itx> just remember if you decide to overwrite the bootloader you need to clear that fuse
[17:39:59] <Tom_itx> cluelessperson, PINx is defined in the part header file
[17:40:06] <Tom_itx> as are PORTx and DDRx
[17:47:44] <cluelessperson> Tom_itx, what fuse?
[17:57:43] <Tom_itx> BOOTRST
[20:42:46] <cluelessperson> Tom_itx, what does bootrst do anyway?
[21:07:35] <Tom_itx> cluelessperson, it tells the chip where to look to begin executing code
[21:07:44] <Tom_itx> along with the bootsize fuse
[21:08:39] <Tom_itx> if it's not set, it will start executing at 0x0000
[21:09:15] <Tom_itx> look at the memory map in the pdf
[21:09:30] <cluelessperson> I see
[21:10:14] <Tom_itx> once the bootloader does what it does, it will jump to 0x0000 and execute your code
[21:10:21] <Tom_itx> if BOOTRST is set
[21:10:34] <Tom_itx> if it isn't, it will just start executing
[21:24:22] <Valen> attiny question, can you program fuses with serial programming?
[21:34:37] <tzanger> yes. blow the reset disable fuse and you're screwed though. you'll have to use hvisp to recover
[21:48:48] <R0b0t1> Can you clock the timer on the attiny85 from an external crystal?
[21:50:35] <Tom_itx> data sheet indicates an external clock
[21:51:08] <Tom_itx> i think you could look there for your answer
[21:51:28] <Tom_itx> PB3 & PB4 are xtal1 xtal2 respectively
[21:55:17] <R0b0t1> Yeah.
[21:55:19] <R0b0t1> Hmm
[21:55:29] <R0b0t1> If I clocked it externally off of 32kHz and used ckdiv/1 for the timer
[21:55:37] <R0b0t1> It'd run... slowly...
[21:55:45] <R0b0t1> But it could presumably keep time.
[21:56:25] <Tom_itx> usually if the chip supports a 32.768khz crystal it has built in caps for it
[21:56:34] <Tom_itx> that will affect the clock
[21:56:40] <R0b0t1> Yeah, I have caps.
[21:56:54] <R0b0t1> I don't think this was intended for RTC use.
[21:58:13] <Tom_itx> do you have the right caps?
[22:00:05] <R0b0t1> I do!