#avr | Logs for 2014-03-06

Back
[05:55:53] <Timmy> I have bought a pain of 315MHz transmitter and receiver modules. how can I handle these modules with AVR Mega 16? and how to do code learning?
[05:58:34] <ephexis> hi guys, just getting back into programming and decided to move a led back and forth as a first simple project, works perfectly but the code is a bit ugly, any suggestions on how to improve it would be very welcome
[05:59:26] <ephexis> http://pastebin.com/8nsQ1urs
[06:00:16] <Thrashbarg> use indentation for a start
[06:00:41] <Thrashbarg> the labels should be without tabs, and any assembly code should have a tab behind it
[06:03:00] <Thrashbarg> comments are good too :)
[06:03:40] <ephexis> point taken about the indentation, but i dont see much point in commenting such a short and simple program
[06:03:51] <Thrashbarg> sure
[06:08:14] <ephexis> where do i know the name Roklobsta from... are you on any c64 or amiga forums?
[06:11:59] <Roklobsta> ephexis: i most certain was in the 90's.
[06:12:27] <Roklobsta> this has been my irc handle since 1992.
[06:13:12] <Roklobsta> since before abcminiuser was born
[06:16:05] <ephexis> fair enough :)
[06:16:28] <ephexis> do most of you guys build your own dev boards or is there an off-the-shelf one that is popular here?
[06:17:29] <Roklobsta> <ahem>arduino
[06:17:53] <Roklobsta> i have an aruduino and jtag the mofo
[06:18:18] <ephexis> what advantages does an arduino have over a standard one?
[06:19:23] <Roklobsta> none really. it's just another atmel board with a special bootloader you don't have to use at all
[06:19:31] <Yotson> popular -> loads of clones -> cheap. ? :D
[06:19:41] <Roklobsta> you can wipe the arduino bootloader and do your own thing
[06:19:56] <ephexis> i've not used one before, ive used the mikroelektronia boards in the past which i thought were quite good
[06:20:12] <ephexis> they had a colour graphics lcd display on them
[06:20:47] <Roklobsta> i have the arduino mega which is just a breakout board for all the pins on a atmega1280/2560
[06:21:16] <Roklobsta> but i have done gps and 3g modem stuff with a custom 1280 board.
[06:21:42] <Roklobsta> and started on a new design for a nixie clock.
[06:21:59] <Yotson> Roklobsta, ehm, a regular arduino mega does not have all the controller pins broken out. the seeedstudio version does though.
[06:22:18] <Roklobsta> ok but most of them are broken out
[06:23:05] <Roklobsta> what would be useful is a 1280 board with a microsd card holder
[06:23:05] <Yotson> and mind the pesky positioning of the headers if you want to put some perfboard or so on top.
[06:58:19] <Lambda-Aurigae> Timmy, there are plenty of tutorials out there using rf modules with microcontrollers. not necessarily with your particular chip so you might have to do a bit of thinking and converting.
[06:59:24] <Lambda-Aurigae> as for specifics, one would need details as to which tx/rx set you have as different kinds are used differently.
[06:59:53] <Lambda-Aurigae> http://winavr.scienceprog.com/example-avr-projects/running-tx433-and-rx433-rf-modules-with-avr-microcontrollers.html
[11:40:13] <megal0maniac> Dammit I want 5V xmega
[11:45:14] <synic> ?
[11:51:08] <megal0maniac> My stuff is 5V and the xmega is 3v3. And I'm getting annoyed because I want to code on the xmega, but the hardware makes it impossible :/
[11:52:38] <synic> how is it that the arduino mega is 5v?
[11:54:00] <megal0maniac> synic: Are you misunderstanding me or are you asking a totally different question?
[11:54:24] <synic> I dunno, I thought the arduino mega used the xmega, but it's a 5v board
[11:54:41] <synic> I may be way off in the weeds pay no attention to me
[11:54:53] <megal0maniac> No official arduino uses the xmega. I think they use the atmega2560
[11:54:57] <synic> ah
[12:29:32] <naquad> where does SCK goes in ATTiny2313? PB7?
[12:32:53] <megal0maniac> naquad: The datasheet will tell you
[12:33:17] <naquad> megal0maniac, datasheet doesn't say about SCK, it has only SCL
[12:33:21] <naquad> and i'm not sure those are the same
[12:33:58] <megal0maniac> They are
[12:34:11] <megal0maniac> I think
[12:35:05] <naquad> i've already tried to connect it according to it, but i'm getting some cryptic error
[12:35:10] <naquad> not sure what i doing wrong
[12:35:33] <naquad> 0% 0.00savrdude: stk500v2_recv_mk2: error in USB receive avrdude: usbdev_send(): wrote -32 out of 1 bytes, err = Broken pipe
[12:35:45] <naquad> but until then it verified something and t was fine
[12:35:49] <naquad> *it
[12:36:44] <megal0maniac> It is PB7
[12:37:01] <naquad> well thats where i've connected it
[12:44:56] <Celerity> Hey folks, I'm wondering how much time would it take for the first statement of the ISR (the Pin change interrupt) function to execute if it was a x = PORTB;
[12:45:15] <tzanger> is there a specific reason you're counting cycles?
[12:45:25] <tzanger> the reason I ask is because 99.999% of the time you don't worry about it
[12:45:44] <Celerity> Right now not really.
[12:45:46] <tzanger> and even then I bet 0.0009% of the time you shouldn't be worrying about it
[12:45:54] <Celerity> I'm just curious how it'd work
[12:46:14] <Celerity> that is, how much time does it take the uC to jump from the main loop to the ISR(PCINT)
[12:46:49] <Celerity> I am reasonably confident that an x = PORTB would be 1 cycle, but it's the function call/switch that I'm interested in knowing.
[12:49:09] <Celerity> Is there a way to measure it in a ghetto manner?
[12:50:07] <Celerity> I can whip up a ghetto logic analyzer and poke an second microcontroller
[12:50:39] <naquad> is there something special about using attiny2313a and avr isp mk2? it looks like it can't do program it
[12:50:53] <tzanger> Celerity: it's usually documented in the data sheet
[12:51:04] <tzanger> I think offhand it's something like 4 or 6 cycles if memory serves
[12:51:36] <tzanger> Celerity: in a ghetto manner? have a free running timer with no divider (so 1 tick = 1 cycle) and grab the count before firing the isr and again in the isr
[12:51:38] <Celerity> ok, I am looking at the Atmega328. I will go look at the datasheet again.
[13:37:04] <docmur> I'm having problems with the watchdog timer on the attiny13, I believe what is happening is the system is either stuck in a continous reboot loop or it's not firing it's reset, this is sample code: http://pastebin.com/crBMrgqv I have done this correctly?
[13:39:08] <synic> naquad: what crystal are you using
[13:40:10] <synic> docmur: you are aware that you have two whiles on the same line?
[13:40:48] <docmur> yes I didn't show the timer interrupt that basically makes the main loop take 250uS , that second while will only waste time until we reach 250uS
[13:41:18] <docmur> I only want my watch dog to reset the system every 500mS
[13:57:41] <naquad> synic, none. internal oscillator
[13:58:54] <tzanger> Celerity: basically you need to read about the interrupt operation of the system. it'll usually describe the process of how it pushes the PC on to the stack, retrieves the vector address and jumps there. From that you should be able to see what the cycle count is to do each of those items
[13:59:37] <Celerity> tzanger - ok, so will reading through a hex file help
[14:01:34] <tzanger> not at all
[14:02:07] <tzanger> reading through the .lst file will show you exactly what instructions will be executed from the time the interrupt routine starts to execute until the time your particular instruction of interest executes
[14:02:19] <tzanger> (usually the ISR ends up pushing all the registers on the stack which is wasteful but safe)
[14:03:18] <Celerity> ok will look at it
[14:04:09] <synic> naquad: what avrdude arguments are you using?
[14:04:44] <naquad> synic, sudo avrdude -c avrispmkii -p t2313 -P usb -D -e -U flash:w:main.hex
[14:05:31] <synic> naquad: try adding -B5
[14:05:40] <synic> maybe the programmer clock is too fast
[14:12:00] <naquad> synic, same effect :(
[14:19:30] <Jordan_U> I'm trying to use _delay_ms and _delay_us from util/delay.h and I'm getting the warning "#warning "F_CPU not defined for <util/delay.h>" " and of course my delays are not correct (they seem about half as long as they should be). How should I determine the correct value for F_CPU for my microcontroller (ATMEGA 128A1)?
[14:22:58] <naquad> synic, it behaves very strange. i've tried several controllers already, same effect everywhere. also i can erase (-e) the flash, get/set fuses (using defaults), but it doesn't program actual code
[15:08:34] <megal0maniac_afk> Jordan_U: You need to define #F_CPU...
[15:08:35] <hjohnson> ok... look slike the xmega has the usb termination resistors internal
[15:09:08] <megal0maniac_afk> #define F_CPU 16000000UL
[15:09:25] <megal0maniac_afk> Before you #include delay.h
[15:10:36] <megal0maniac_afk> naquad: Check the voltage. Some devices can't be programmed unless you give them 5V. They'll read just fine and respond to commands, but flash won't be written
[15:14:04] <megal0maniac_afk> attiny10 is one of those, the little bastard...
[15:34:32] <hotch> megal0maniac_afk: What is the UL? I've noticed that I don't use it in my Makefile for using avrdude, but use it in my .c ?
[15:42:35] <naquad> megal0maniac_afk, i've tried to add a resistor, but no luck
[15:45:03] <Jordan_U> megal0maniac_afk: I know that, I just don't know how to determine the right value for F_CPU. Through guessing I've found that 2000000UL seems to give correct delays, but I'd like to know how I'm actually supposed to determine this value.
[15:58:07] <tzanger> UL means unsigned long
[15:58:56] <tzanger> it's a compiler hint that yes, Virginia, you really do mean such a large number (compilers default to constants being ints and 20000000 would get mangled to INT_MAX (I think)
[16:02:04] <naquad> megal0maniac_afk, synic when i set -vvvv (four, with byte output) it actually write 0_0 it looks like there's indeed some problem with delays, but i'm not sure how to fix that, tried -b down to 600 and -B up to 6, but no luck
[18:26:00] <hotch> thx tzanger