#avr | Logs for 2014-05-08

Back
[05:36:45] <bezoka> is hard to make something what automatic switch light?
[05:48:27] <megal0maniac_afk> is hard
[05:55:05] <Valen> nah piss easy, I have one that works once a day, and controls illumination for billions of people around the world
[05:55:25] <Valen> of course changing the schedual for it is a little tricky
[06:09:48] <malinus> lol'd
[06:09:59] <malinus> aww, he left
[06:21:50] <PHPtest> hi guys, can someone explain to me this modbus protocoll? i know about SPI, I2C, UART, what the hack is this modbus? i know that it is a protocol, but is it using uart interface or spi or it has its own device?
[06:22:56] <megal0maniac_afk> malinus: He'll be back. They always are
[06:23:45] <malinus> PHPtest, I'm assuming you are using some peripheral, and that peripheral should have a datasheet?
[06:24:46] <malinus> megal0maniac_afk, I hope. I want to know if hard something make automatic light switch.
[06:25:03] <megal0maniac_afk> PHPtest: Also, I've only been on the wikipedia page for 4 seconds, but I've already determined that it is a bus protocol (thus incompatible with UART, SPI)
[06:25:13] <PHPtest> malinus, modbus as communication protocol can be implemented over any hardware spec? spi, rs484 rs232 i2c? etc? i have no datasheet, ive just heard lately a lot about this modbus and not before
[06:26:44] <PHPtest> megal0maniac_afk well i was spending more time on wikipedia on this topic and havent seen any usefull comparisional information or level abstraction that shows that modbus is on top of somewhat hardware spec, ive only found that was intended to use with rs484
[06:28:42] <megal0maniac_afk> PHPtest: Probably RS485
[06:29:01] <PHPtest> megal0maniac_afk, yea misstype, sry
[06:29:22] <megal0maniac_afk> Either that or TCP/IP
[06:29:28] <megal0maniac_afk> Those are the common options
[06:29:49] <megal0maniac_afk> I could be wrong. I didn't know what modbus was 10 minutes ago, I just used the google
[06:31:03] <malinus> so what is modbus ;P?
[06:31:27] <PHPtest> megal0maniac_afk well i wonder how does a digital temperature sensor communicate over tcp/ip? is that prefixed? i mean is it allways specified what hardware spec is needed for that specific modbus implementation<
[06:34:19] <megal0maniac_afk> It's a communication protocol typically used in communication between PLCs (industrial stuff). PHPtest Usually the devices will have an ethernet or RS485 interface (RJ12 or RJ45) and be able to "talk modbus" over that link. On TCP/IP there is a port reserved for it. On RS485 it is a protocol which the entire bus will run on. Device addressing is not specified by the protocol, because it's a protocol.
[06:34:23] <PHPtest> megal0maniac_afk as i can see there are 2 modbus versions, one is RTU and the other is TCP so by this they are differentiating the hardware req i guess, so when buying a sensor or device it has to be specified in datasheet wich one it uses i guess... we are using this modbus at school, and have no ideea why, but they say its an industrial standard and commonly used
[06:34:42] <megal0maniac_afk> It is and it is
[06:35:15] <PHPtest> then im wondering why havent u heard of it guys, so i cant believe it is such expanded and much used standard
[06:35:36] <Lambda_Aurigae> it's used in industrial systems.
[06:35:39] <megal0maniac_afk> PHPtest: I've heard of it, just never used it.
[06:35:41] <Lambda_Aurigae> not a lot of us use industrial systems.
[06:36:24] <megal0maniac_afk> If it uses AC, I'm generally not interested XD
[06:36:52] <PHPtest> Lambda_Aurigae then what kind of systems? home systems? or dont know how to say
[06:37:34] <megal0maniac_afk> Factories
[06:37:35] <PHPtest> megal0maniac_afk well using modbus between IC's and digital sensors is a new thing for me...
[06:37:36] <Lambda_Aurigae> for me microcontrollers is a hobby.
[06:38:04] <Lambda_Aurigae> so have never had need for learning modbus.
[06:38:18] <Lambda_Aurigae> I've heard of it and seen and used devices in the wild that were modbus.
[06:38:21] <Lambda_Aurigae> but never had them on my bench.
[06:38:51] <PHPtest> Lambda_Aurigae ah.. well then it should be a good thing, right? xD
[06:39:44] <Lambda_Aurigae> if you have a use or need for it, then learn it.
[06:39:47] <PHPtest> well what is the difference between spi and modbus then, i mean why would people choose rs485 over spi?
[06:39:54] <megal0maniac_afk> SHTAP!
[06:40:01] <Lambda_Aurigae> spi is a hardware interface
[06:40:04] <PHPtest> SHTAP?
[06:40:05] <Lambda_Aurigae> modbus is a PROTOCOL
[06:40:08] <malinus> PHPtest, mind if I ask what kind of application/hardware you are trying to interface?
[06:40:29] <megal0maniac_afk> What Lambda_Aurigae said. You're comparing apples and biscuits
[06:40:31] <Lambda_Aurigae> like the difference between ethernet and tcp/ip
[06:40:31] <PHPtest> malinus 2 avr mcu's
[06:41:03] <PHPtest> what does SHTAP mean<
[06:41:06] <Lambda_Aurigae> ethernet can connect two devices with hardware....tcp/ip is the protocol that is used to send the data over ethernet.
[06:41:06] <malinus> PHPtest, and how does modbus come in?
[06:41:42] <Lambda_Aurigae> spi is a connection hardware...modbus is a protocol that would be used to send data over spi...although modbus over spi would be horrid to implement I would think.
[06:41:58] <PHPtest> malinus we learn about it...
[06:42:42] <PHPtest> ok i understand now, but whats the advantage of using modbus/rs485 over spi?
[06:42:56] <Lambda_Aurigae> I suppose you could do an intermediate layer between spi and modbus to do some kind of two way streaming data link to implement a bus.
[06:43:19] <megal0maniac_afk> Because modBUS is a BUS-oriented protocol, it is best suited to a BUS hardware link like RS485
[06:43:21] <Lambda_Aurigae> rs485 is a bus..multiple devices talking to each other.
[06:43:28] <Lambda_Aurigae> spi is 2 devices talking back and forth.
[06:43:49] <Lambda_Aurigae> rs485 doesn't really have a master and slave like spi does...I think.
[06:44:19] <megal0maniac_afk> No it doesn't
[06:44:28] <Lambda_Aurigae> with spi all communications has to be initiated by the master device.
[06:44:40] <Lambda_Aurigae> with rs485, communications can be initiated by any device on the bus.
[06:44:41] <PHPtest> ok, ive got it now, i think..
[06:45:30] <PHPtest> heh, its good to talk with you guys, man can learn a lot from u
[06:45:39] <Lambda_Aurigae> modbus is used in big industrial control systems...things that use SCADA, like power plants and automated factories and such.
[06:45:44] <megal0maniac_afk> PHPtest: While the hardware link and the protocol aren't strictly related, you want to choose them so that they work nicely together. TCP/IP and RS485 are good choices
[06:46:21] <Lambda_Aurigae> if you notice, there are different frame formats for tcp/ip and rs485 based modbus...
[06:46:33] <Lambda_Aurigae> so you would need an interface controller between the two if you had to mix them.
[06:48:12] <Lambda_Aurigae> looking through the specifications, modbus is a fairly simple protocol.
[06:48:33] <PHPtest> well, i guess we stick to rs485, but i dont know much about it
[06:48:50] <PHPtest> does an xmega or atmega handle rs485?
[06:49:23] <Lambda_Aurigae> http://www.8051projects.net/files/public/1326555919_22364_FT52908_sumant_khalateimplementing_rs458_on_avr.pdf
[06:49:56] <Lambda_Aurigae> you will need rs485 interface chips.
[06:49:57] <PHPtest> lambda reading exactly the same xD
[06:51:04] <Lambda_Aurigae> you can use the USART/UART on any microcontroller to tie to an rs232-to-rs485 adapter.
[06:51:10] <megal0maniac_afk> PHPtest: iirc, there are chips which convert simple serial (which almost all AVRs handle and is very simple to use) to RS485
[06:51:18] <megal0maniac_afk> Beat me to it :)
[06:51:49] <Lambda_Aurigae> in fact, someone posted a link to a nice little chip a couple days ago in here.
[06:53:27] <megal0maniac_afk> Bam! http://www.ebay.com/itm/400366034896
[06:53:29] <Lambda_Aurigae> april 30 at 06:48
[06:54:17] <Lambda_Aurigae> http://datasheets.maximintegrated.com/en/ds/MAX1480A-MA
[06:54:37] <Lambda_Aurigae> http://www.maximintegrated.com/datasheet/index.mvp/id/1020
[06:55:19] <PHPtest> hmm
[06:55:34] <Lambda_Aurigae> a complete rs485 transceiver module in a 28 pin dip.
[06:55:51] <PHPtest> so with a simple max485 connected to usart can make a modbus compatible interface
[06:56:07] <Lambda_Aurigae> it is possible, yes.
[06:56:14] <megal0maniac_afk> typically withstand 1600VRMS (1 minute) or 2000VRMS (1 second)
[06:56:19] <megal0maniac_afk> Good grief
[06:56:42] <Lambda_Aurigae> it's all optically and magnetically isolated.
[06:56:53] <Lambda_Aurigae> and, I gotta go make lunch and go to work.
[06:56:54] <Lambda_Aurigae> later all.
[06:57:06] <megal0maniac_afk> Those are magical
[06:57:11] <megal0maniac_afk> Bye!
[07:00:27] <PHPtest> bze
[07:00:29] <PHPtest> bye
[07:03:56] <PHPtest> thx for helping, everyone
[07:04:14] <PHPtest> i have to go to eat smth too, bye bye, have a nice day
[08:35:27] <malinus> I'm reading the datasheet, but I don't quiet get it, nor do I remember. If I set up the WDT (in interrupt mode, not reset), will it keep interupting, or only do it once?
[08:44:58] <malinus> so - will the interrupt from the WDT keep on being trigered or will it only happen once?
[09:58:03] <Daulity> malinus: i think it wil keep interrupting
[10:08:07] <Daulity> malinus: where do you read it?
[11:44:13] <Laurenceb__> hi
[11:44:28] <Laurenceb__> im trying to build esc firmware with avra on ubuntu
[11:44:36] <Laurenceb__> m8def.inc(40) : Error : Unknown mnemonic/macro: #ifndef
[11:55:25] <Laurenceb__> wow avr is a dying platform
[11:55:31] <Laurenceb__> noone to help
[12:00:49] <megal0maniac_afk> Laurenceb__: I'm sure comments like that will get people running to your aid
[12:05:04] <malinus> Duality, I've figured it out, thanks.
[12:11:26] <megal0maniac_afk> malinus: Yeah, you've gotta feed that watchdog
[12:16:12] <malinus> megal0maniac_afk, I forgot that when you forget to add the interupt routine to your code, the poor avr doesn't know what to do with himself and resets
[12:16:22] <malinus> I guess it's better than undefined behaviour :)
[13:23:52] <argoneus> hello
[13:41:40] <Daulity> argoneus: hi
[14:54:42] <argoneus> Hey
[14:54:54] <argoneus> can anyone assist me with AVR Butterfly / AtMega169?
[14:55:08] <argoneus> I'm rather new to working with all these things and I need specific help on how to properly process joystick interrupts
[14:55:22] <argoneus> I skimmed through the 200 page documentation of atmega169 but I have no idea what I'm looking for
[14:55:52] <argoneus> what I'm trying to do is have 5 fields on the display, and move through them one by one with the joystick left/right
[16:30:21] <hetii> Hi :)
[16:30:28] <hetii> I have such simple code: http://pastebin.com/knGgFp35
[16:31:13] <hetii> The idea is when i recive in uart char 'A' then my LED should be on for 2 second.
[16:32:18] <hetii> The issue is in that, when i send 'A' time after time my LED definitely are of early then 2 second(for eg just blink fast).
[16:32:29] <hetii> any clue what I do wrong?
[16:46:59] <tzanger> hetii: does the LED on PIN_FLASH_2 blink on and off every 1s?
[16:49:03] <hetii> tzanger: yes
[16:53:27] <hetii> hmm, even when i set PIN_FLASH_1_COUNT = 20; in my switch then its just blink
[17:01:02] <hetii> ok as i notice my watchdog make mess there so after removing it now its better
[17:03:25] <Daulity> w8 how does this clear the flag ? : TIFR = (1 << OCF1A);
[17:07:39] <hetii> Daulity: look at the end of this thread: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=50106
[17:09:51] <tzanger> Daulity: many, many flags are write-1-to-clear
[17:09:56] <tzanger> hetii: interesting
[17:10:21] <Daulity> tzanger: yea i remember :) got a little confused
[17:10:31] <tzanger> hetii: do you have the ability to single-step this?
[17:11:05] <hetii> no
[17:11:14] <tzanger> btw, kudos on using the bit defines correctly (1 << OCF1A), many people don't bother
[17:11:35] <tzanger> try getting rid of line 27. I don't think it will help but you're essentially flooding the UART transmitter
[17:11:41] <hetii> but after removing my watchdog stuff it works promising.
[17:11:56] <tzanger> you don't show watchdog code in there
[17:12:29] <hetii> yes, it was just one line when i enable it and don`t use reset at all. Don`t notice that :/
[17:13:44] <Daulity> tzanger: doing it that way is clearer imho
[18:52:10] <Klapo> 11:33:32 #avr: < jacekowski> Klapo: with a timer
[18:52:10] <Klapo> 11:43:48 #avr: < Yotson> read the application note from Atmel already Klapo?
[18:52:21] <Klapo> sorry guys for no replay, didn't even had time for that
[18:52:33] <Klapo> but thanks for clue, saved pdf to ereader so gotta check it soon