• Electronics and Embedded Programming V2
    1,309 replies, posted
  • Avatar of Chryseus
  • [img]http://i.cubeupload.com/YgNJgq.png[/img] [i]Cookies to ddrl46 for the banner.[/i] [b]Welcome to the Facepunch electronics thread, this thread is for anyone who has an interest in electronics, be it analog, digital or just blowing shit up in their free time. If you have something you want to show or desire to get into electronics just make a post and someone will be along eventually.[/b] [release] [b]Highlights of V2[/b] [b][url=http://www.facepunch.com/members/124890-ddrl46]ddrl46[/url][/b] [img_thumb]http://i.imgur.com/pCTcZ.jpg[/img_thumb] [img_thumb]http://i.imgur.com/giL7o.jpg[/img_thumb] [img_thumb]http://i.imgur.com/xk6ut.jpg[/img_thumb] [b][url=http://www.facepunch.com/members/200070-DrLuke]DrLuke[/url][/b] [img_thumb]http://i.imgur.com/gB2Zt.jpg[/img_thumb] [img_thumb]http://i.imgur.com/YlhNt.png[/img_thumb] [img_thumb]http://i.imgur.com/ohPRh.jpg[/img_thumb] [b][url=http://www.facepunch.com/members/423192-LoneWolf_Recon]LoneWolf_Recon[/url][/b] [img_thumb]https://sites.google.com/site/lonewolfscircuits/sitefiles/Tele-TalkV2-1.jpg[/img_thumb] [b][url=http://www.facepunch.com/members/7258-ROBO_DONUT]ROBO_DONUT[/url][/b] [img_thumb]http://img85.imageshack.us/img85/8858/progressyw.jpg[/img_thumb] [/release] [release] [b]Thread Helpers[/b] This is a list of the people who have a decent knowledge of electronics, if in doubt give one of us a poke. If you wish to be added here please talk to me. [url=http://www.facepunch.com/members/199636-Chryseus]Chryseus[/url] [url=http://www.facepunch.com/members/124890-ddrl46]ddrl46[/url] [url=http://www.facepunch.com/members/7258-ROBO_DONUT]ROBO_DONUT[/url] [/release] [release] [b]Recommended Reading[/b] [img]http://upload.wikimedia.org/wikipedia/en/9/93/The_Art_of_Electronics.jpg[/img] [b]Art of Electronics by Paul Horowitz and Winfield Hill[/b] Without a doubt the most complete and informative book on electronics, although the current 2nd edition is rather old (1989) it is still extremely relevant to modern electronics. If you're going to buy any book this should be the one, although it is not designed for beginners. [img]http://i.imgur.com/8RLwm.png[/img] [b]Complete Digital Design by Mark Balch[/b] An excellent book that covers all the basics such as boolean logic, karnaugh maps, binary arithmetic and more advanced topics such as serial communication, microprocessors and the practical design of digital circuits. [img]http://i.imgur.com/CpPKh.png[/img] [b]Principles of Electric Circuits by Thomas L. Floyd (9th ed)[/b] A very good book for beginners that unlike most comes in an electron flow version as well, if you prefer that. The book is full of well drawn diagrams and helpful pictures which makes reading easy and fun, in addition at the end of each chapter there is a quiz to make sure you fully understand what you have read. [img]http://i.imgur.com/hjhkN.png[/img] [b]Troubleshooting Analog Circuits by Robert A. Pease (Bob Pease)[/b] An excellent book by an excellent author, this book contains a lot of useful information that is invaluable if you are interested in getting into electronic repair. [b] Video Lectures[/b] [url=http://www.youtube.com/user/nptelhrd#grid/user/7987F30C41A9ADCB]Basic Electronics, Prof T.S.Natarajan - NPTEL[/url][img]http://www.facepunch.com/fp/ratings/winner.png[/img] Very well made lecture series with a lot of useful information, highly recommended. [b]Other Resources[/b] [url]http://www.allaboutcircuits.com/[/url] A very informative e-book that can be read online or downloaded, it explains things very nicely and with plenty of pictures and diagrams so it is suitable for beginners. I highly recommend although the book is not complete. [url]http://www.eevblog.com/[/url] Excellent video blog all about electronics, definitely worth watching. Also has an excellent forum suitable both for beginners and professionals. [url]http://www.williamson-labs.com/[/url] Some useful images but the site design will make your eyes bleed. [/release] [release] [b]Where to buy components[/b] [url=http://www.bitsbox.co.uk/]Bitsbox[/url] - Small selection of components but very cheap shipping, £1.50 UK, £2.75 Europe, £4.00 anywhere else. [url=http://www.rs-components.com/]RS[/url] - A well known supplier with large selection, shipping is fairly cheap but no Paypal. [url=http://www.farnell.com/]Farnell[/url] - Another excellent supplier with a very large selection, minimum order applies and no Paypal. [url=http://www.dealextreme.com]DealExtreme[/url] - Sells a lot of made in china stuff but you can get some really good deals such as the Rigol DS1052E. [url=http://www.rapidonline.com/]Rapid[/url] - Decent selection but not the cheapest, shipping outside the UK is also fairly expensive. [url=http://www.maplin.co.uk/]Maplin Electronics[/url] - Similar to rapid but even more expensive, not available outside the UK as far as I'm aware, avoid. [url=http://www.digikey.com/]Digikey[/url] - Excellent selection of components but fairly expensive shipping. [url=www.sureelectronics.net/]Sure Electronics[/url] - Small selection but some good value for money component kits. [url=http://www.sparkfun.com/]Sparkfun Electronics[/url] - Nice selection with some good deals. [url=http://www.rshelectronics.co.uk/]RSH Electronics[/url] - Small selection with some great bargain packs, cheap delivery £4.00 international [/release] [release] [h2]Electrical Safety[/h2] Working with electricity is generally quite safe, however here are a some useful tips that will help you avoid severe injury or in the worst case death. [b]Avoid working with mains electricity unless you are confident with what you're doing Probe live circuits with your right hand and keep your left hand in your pocket Keep your hands clean and dry Do not wear any metal objects even around low voltage Never go near high energy (3 phase) systems with a non-industry grade multimeter Use a properly fused multimeter to avoid risk of explosion Ensure high voltage capacitors are discharged before touching a circuit Never make changes to household wiring unless you REALLY know what you're doing NEVER EVER play around with microwave ovens they're potentially lethal[/b] [/release] [quote] [b]Previous Threads[/b] [url]http://www.facepunch.com/threads/880827-Electronics-and-Embedded-Programming[/url] V1 - By Ddrl46 [/quote]
  • This looks fairly interesting, what languages can you code for this stuff in?
  • Avatar of Chryseus
  • [QUOTE=Icedshot;30126319]This looks fairly interesting, what languages can you code for this stuff in?[/QUOTE] It depends very much on the MCU / CPU in question, C and inline assembly is usually the standard however a number of other languages have been made to work such Fortran, Java, C++, Python, etc Any language can with some effort be used.
  • Avatar of DrLuke
  • It should be noted that the higher level the programming languages get (C++, Java, .........., Lua), they need a lot more CPU power and ROM and RAM, making them impractical for microcontroller use. That's why you'll most likely find C and assembly used on microcontroller like the AVR or PIC.
  • Avatar of Elspin
  • [QUOTE=DrLuke;30126674]It should be noted that the higher level the programming languages get (C++, Java, .........., Lua), they need a lot more CPU power and ROM and RAM, making them impractical for microcontroller use. That's why you'll most likely find C and assembly used on microcontroller like the AVR or PIC.[/QUOTE] C++ is not a high level language; and lua is not a programming language, it's a scripting language written in C. While C++ is not used on many microcontrollers by default, it still compiles to assembly so as long as a compiler is written it can be used on any microcontroller that is assembly-compliant. All of the arduino platforms use C++ though, and it's fairly easy to set up visual C++ to compile onto an arduino for example.
  • [QUOTE=Elspin;30135444]C++ is not a high level language; and lua is not a programming language, it's a scripting language written in C. While C++ is not used on many microcontrollers by default, it still compiles to assembly so as long as a compiler is written it can be used on any microcontroller that is assembly-compliant. All of the arduino platforms use C++ though, and it's fairly easy to set up visual C++ to compile onto an arduino for example.[/QUOTE] Lua [i]is [/i]a programming language and I have no idea what you mean by "assembly-compliant".
  • [QUOTE=ROBO_DONUT;30135578]Lua [i]is [/i]a programming language and I have no idea what you mean by "assembly-compliant".[/QUOTE] I think he means it compiles into assembly
  • Avatar of Elspin
  • [QUOTE=ROBO_DONUT;30135578]Lua [i]is [/i]a programming language and I have no idea what you mean by "assembly-compliant".[/QUOTE] Just mean any embedded system that is designed to interpret assembly commands. EDIT: Also, fair enough if they want to call lua a programming language - but it is by definition a scripting language. It's a language made within another language that only runs by being executed by another program (whether it be a custom program or the standard lua interpreter), and it's usually used to extend programs functionality outside of the main code.
  • Avatar of Chryseus
  • [QUOTE=benjojo;30135714]Oh wow, We finally got to a v2, we need highlights.[/QUOTE] Please PM me any suggestions you have for the featured projects section.
  • [QUOTE=ROBO_DONUT;30135578]Lua [i]is [/i]a programming language and I have no idea what you mean by "assembly-compliant".[/QUOTE] Personally, I wouldn't class something that runs in a VM as a programming language. But that's like, my opinion man.
  • So.. what do people actually use these for? Other than shamelessly screwing around :v:
  • [QUOTE=Azur;30135783]Personally, I wouldn't class something that runs in a VM as a programming language. But that's like, my opinion man.[/QUOTE] It's not a matter of opinion. It's a programming language [i]by definition[/i]. [QUOTE=Elspin;30135651]Just mean any embedded system that is designed to interpret assembly commands.[/QUOTE] That still doesn't make any sense. Any modern processor is going to be pretty similar. They all iterate through instructions containing opcodes and arguments. Assembly languages are just the human-readable form where opcodes are replaced by mnemonics.
  • Avatar of Elspin
  • [QUOTE=ROBO_DONUT;30136095]It's not a matter of opinion. It's a programming language [i]by definition[/i]. That still doesn't make any sense. Any modern processor is going to be pretty similar. They all iterate through instructions containing opcodes and arguments. Assembly is just the human-readable form where opcodes are replaced by mnemonics.[/QUOTE] Alright so honestly, why would you do this? You skip over my post and basically reword it but without reasoning. [QUOTE]it is by definition a scripting language. It's a language made within another language that only runs by being executed by another program (whether it be a custom program or the standard lua interpreter), and it's usually used to extend programs functionality outside of the main code.[/QUOTE] Also, I didn't say it was rare or abnormal - for gods sake read the posts in the thread. The entire point of me saying that was that everything should work with C++ to some extent, and that went over your head to a pretty extreme extent.
  • Avatar of Overv
  • [QUOTE=Elspin;30135651]Just mean any embedded system that is designed to interpret assembly commands. EDIT: Also, fair enough if they want to call lua a programming language - but it is by definition a scripting language. It's a language made within another language that only runs by being executed by another program (whether it be a custom program or the standard lua interpreter), and it's usually used to extend programs functionality outside of the main code.[/QUOTE] I don't think you are aware of the definition of a scripting language. A scripting language is by definition a special type of programming language that's designed to be embedded in an application written in a different language. [quote=Wikipedia][b]A scripting language[/b], script language or extension language [b]is a programming language[/b] that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the end-user. Scripts are often interpreted from source code or bytecode, whereas the application is typically first compiled to native machine code.[/quote]
  • Avatar of Elspin
  • [QUOTE=Overv;30136209]I don't think you are aware of the definition of a scripting language. A scripting language is by definition a special type of programming language that's designed to be embedded in an application written in a different language.[/QUOTE] That's pretty much what I said exactly, did you read my post at all...? EDIT: Oh, I see. Well if you just bold two parts of a sentence it's easy to disagree with what I said I suppose, but the rest of that paragraph agrees with everything I said. EDIT2: also, your title is missing a semi-colon.
  • [QUOTE=Azur;30135783]Personally, I wouldn't class something that runs in a VM as a programming language. But that's like, my opinion man.[/QUOTE] So what you're basically saying Java isn't a programming language? What about C#?
  • Avatar of Elspin
  • Alright, since everyone is clearly incredibly offended by my disagreement of lua being a programming language - let me clarify what I said in a language everyone here can understand (apologies for any 5AM spelling/grammar/other errors). Lua is embedded - it has to be run in an interpreter, whether that be the standard one written in C or a custom one. The wikipedia definition of a scripting language says this, just as Overv quoted as well: [QUOTE]A scripting language, script language or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the end-user. Scripts are often interpreted from source code or bytecode, whereas the application is typically first compiled to native machine code.[/QUOTE] Now, because the definition opens with "a programming language that...", some people are crying foul and saying this is a programming language then. But the that is not leading up to include an [b]addition[/b], it's leading up to include an [b]exception[/b]. In this way it means that the scripting language is not a complete programming language - it cannot run on it's own, and is therefore not totally one. Now, a way to analogize this to C++ is to say that in a way scripting is more of a base class - it is related to a programming language class but is is not a complete reference, it is not complete on its own when used alone. So that's why I said lua is not a programming language - and if you disagree then fine I suppose, but at least be mature about it please. This isn't fast threads.
  • Avatar of DrLuke
  • [QUOTE=Elspin;30135444]C++ is not a high level language; and lua is not a programming language, it's a scripting language written in C. While C++ is not used on many microcontrollers by default, it still compiles to assembly so as long as a compiler is written it can be used on any microcontroller that is assembly-compliant. All of the arduino platforms use C++ though, and it's fairly easy to set up visual C++ to compile onto an arduino for example.[/QUOTE] Even though it is compiled into assembly, it still requires big amounts of CPU power and RAM.
  • Avatar of Elspin
  • [QUOTE=DrLuke;30136514]Even though it is compiled into assembly, it still requires big amounts of CPU power and RAM.[/QUOTE] C++ does not require large amounts of processing power and RAM by default. You can make C++ wasteful yourself by abstracting the fuck out of it and using tonnes of convenient structures that you don't really need, but that's using C++ poorly.
  • Avatar of Overv
  • [QUOTE=Elspin;30136463]Now, because the definition opens with "a programming language that...", some people are crying foul and saying this is a programming language then. But the that is not leading up to include an [b]addition[/b], it's leading up to include an [b]exception[/b]. In this way it means that the scripting language is not a complete programming language - it cannot run on it's own, and is therefore not totally one.[/QUOTE] Where in the definition of a programming language is it specified that it needs to be able to run on its own? [quote=Wikipedia]A programming language is an artificial language designed to express computations that can be performed by a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine, to express algorithms precisely, or as a mode of human communication.[/quote] And actually it is an addition. The fact that a scripting language allows control of an application is a special property that programming languages do not necessarily have. Additionally, I like how you're saying people are being immature here, yet you are the one coming up with stuff like this: [QUOTE=Elspin;30136229]EDIT2: also, your title is missing a semi-colon.[/QUOTE]
  • Avatar of Elspin
  • [QUOTE=Overv;30136633]Where in the definition of a programming language is it specified that it needs to be able to run on its own?[/QUOTE] It's the other way around - it's not that a programming language is defined to be able to run on it's own, it's that a scripting language is defined to not be able to run on its own. A programming language can always control an application because it is the application. A scripting language is an extra layer that cannot be run on it's own - but can add functionality to an existing application that runs on its own. EDIT: ie, I can write a C app that runs on it's own, and I can write it in any way to have control over itself - and I can add a layer of lua to add additional ways of controlling it. BUT, I cannot just use the lua on it's own - it needs the C, whereas the C does not need the lua. [editline]30th May 2011[/editline] [QUOTE=Overv;30136633]Additionally, I like how you're saying people are being immature here, yet you are the one coming up with stuff like this:[/QUOTE] That was a joke, it wasn't intended to be offensive. Sorry.
  • Avatar of Chryseus
  • [media]http://www.youtube.com/watch?v=dzrtEYmuQJQ[/media] I really was not expecting this.
  • Avatar of r4nk_
  • [QUOTE=Elspin;30136463]Alright, since everyone is clearly incredibly offended by my disagreement of lua being a programming language - let me clarify what I said in a language everyone here can understand (apologies for any 5AM spelling/grammar/other errors). Lua is embedded - it has to be run in an interpreter, whether that be the standard one written in C or a custom one. The wikipedia definition of a scripting language says this, just as Overv quoted as well: Now, because the definition opens with "a programming language that...", some people are crying foul and saying this is a programming language then. But the that is not leading up to include an [b]addition[/b], it's leading up to include an [b]exception[/b]. In this way it means that the scripting language is not a complete programming language - it cannot run on it's own, and is therefore not totally one. Now, a way to analogize this to C++ is to say that in a way scripting is more of a base class - it is related to a programming language class but is is not a complete reference, it is not complete on its own when used alone. So that's why I said lua is not a programming language - and if you disagree then fine I suppose, but at least be mature about it please. This isn't fast threads.[/QUOTE] Well I'll be damned, here I was thinking that C# was a programming language but it clearly isn't because it can't run on its own, it needs an implementation of the CLR and the FCL.
  • [QUOTE=r4nk_;30137603]Well I'll be damned, here I was thinking that C# was a programming language but it clearly isn't because it can't run on its own, it needs an implementation of the CLR and the FCL.[/QUOTE] As far as im aware, dont all languages need something to turn them into executable code, or intermediate code? Does that mean C isnt a programming language because you need an original implementation of a compiler in ASM?
  • Apparently ASM isn't a programming language either because it needs the CPU tpo interpret it.
  • Avatar of DrLuke
  • [QUOTE=Icedshot;30137660]As far as im aware, dont all languages need something to turn them into executable code, or intermediate code? Does that mean C isnt a programming language because you need an original implementation of a compiler in ASM?[/QUOTE] I guess you could technically say so. [QUOTE=Darwin226;30137754]Apparently ASM isn't a programming language either because it needs the CPU tpo interpret it.[/QUOTE] No, that's dumb.
  • Avatar of Lapsus
  • Chryseus: I'm a hilight?! :3: It's just a single H-bridge though, not a stepper driver, just a plain old DC motor driver. As for content, I can post some of my stuff from the last thread, though I'm working on a few things again, so there'll probably be some new content sooner or later.
  • Avatar of DrLuke
  • [QUOTE=Agent766;30139350]I came here expecting content.[/QUOTE] Don't complain, post content. [editline]30th May 2011[/editline] Would it be asking for too much if the banner was 10px narrower?