Thursday, May 31, 2012

Programming pic microcontrollers in C for begginers ! -source :internet . Learning to program microcontrollers seems like an impossible task but with the help and support of a Hackerspace you’ll find that it’s actually simple to get started. The members of Harford Hackerspace set out to learn by starting at the basics and gradually taking on more difficult applications. The key to our quick success was group participation. Most of us had at least attempted PIC programming, but it took a group effort to get the whole picture. In this tutorial we will teach you what we learned. You can then take this new knowledge to your local hackerspace and put it to good use. Let’s get started! What will you need? PicKit2 Debug Express PicKit2 or PicKit3 Debug Express- The PicKits come with software, an in-circuit programmer (ICP) and a demo board. On the demo board is a PIC Microcontroller, 8 LEDs, 1 Potentiometer (variable resistor), and 1 momentary push button switch. You’ll want the Debug Express version. MPLAB IDE – The PicKits come with MPLAB IDE (Integrated Development Environment) software on a CD. However, you should download and install the latest version, as with any software, to avoid running into bugs. MPLAB is where you will do your C Programming. CCS Compiler- There is a free demo version of the CCS Compiler. However it’s limited in features. If you plan to do a lot of programming you may want to fork out the money for a full version. CCS comes with its own IDE but you won’t be using that. Debug Express Examples – The PicKit 2 comes with a second CD which includes mostly assembly (.asm) examples but does include a couple Hi-Tech C examples. Hi-Tech is an alternative compiler to CCS and chances are these C examples will not work. However, they contain enough information that they are worth looking at. PicKit2 44Pin Demo Board Software Installation Installing the software is fairly straight forward. Start by installing MPLAB and the Debug Express Examples. Then install the CCS Compiler. You can post a comment here if you have trouble but I don’t think you will. Start a new Project 1. Start MPLAB 2. From the Project Menu select Project Wizard 3. Click Next – This is just a splash screen telling you about the wizard 4. Select your PIC device – Our PicKit2s came with PIC16F887 chips. Yours may be different so make sure you select the correct chip. 5. Click Next – This takes you to the second step which is the Compiler Setup. 6. From the Active Toolsuite drop down box select CCS C Compiler… 7. Under Toolsuite Contents, CCS C Compiler (ccsc.exe) should be selected. 8. Browse to the location of ccsc.exe which by default is C:\Program files\Picc\CCSC.exe 9. Click Next – This takes you to the third step which is naming your project. 10. Click browse and create a new project folder and create a new file called Blink. You can use any name but for this tutorial we will be blinking an LED so we call it Blink. It’s a good idea to put projects in their own folder because a bunch of files will be created and associated with the project. 11. Click Next – This takes you to the fourth step which is adding files to your project. We won’t be adding any existing files here so you can just Click Next. 12. Click Finish – It may look like nothing happened or there are no windows open. In this case select View -> Project and this should show the Project Tree. 13. Select File -> New 14. Type the following code: #include <16f887.h> void main() { } 15. Select File -> Save and save the file as main.c in your Blink project folder. 16. Right Click on the Source Files folder in your Project Tree and select Add Files… Then select the main.c file you just created. 17. Select Project -> Build All and notice that several new files have been created for you. If you get an error check your code. Project Tree After you select build all you should notice several new files in your Project Tree. The most important to note is the 16F887.h file under the Header Files folder. Depending on your chip it may be named something different. Sample Code So, did you pick up on what just happened here? We created a Source File which we called main.c. It could have been named anything. By using the code #include <16F887.h> and selecting build all the compiler found a compatible header file for our PIC chip and automatically inserted it into our project. Now you have a complete skeleton project ready for you to fill in the blanks. We’ll give you your first program and examine it line by line. We will also tell you how we learned which functions would work for the compiler and chip combination we are using. First, we need to get some reading material or resources. You will need to open the help file for the CCS Compiler. They are nice and give you an executable in Windows Start -> Programs -> Pic-C ->Pic C Help. This was installed with the CCS Compiler. Then, we need to get the Datasheet for our chip. PIC16F887 Datasheet Here is our sample Blink code: #include <16f887.h> #fuses NOMCLR, INTRC_IO, NOBROWNOUT #use delay(clock=8M) void main() { while(true) { output_high(PIN_D1); delay_ms(50); output_low(PIN_D1); delay_ms(50); } } Line 1: We already know that this file is what tells the compiler to load the header file in our Project Tree. This line also tells the preprocessor to treat the contents of the 16F887.h file as if those contents had appeared in the source program starting from this line. Keywords that start with the character # are called a preprocessor directive. Some examples are #include, #use, #define, and #fuses which are used most often. This code is used to setup the compiler before it starts compiling your code. #fuses NOMCLR, INTRC_IO, NOBROWNOUT Line 2: The #fuses directive tells the compiler how we want to setup our chip. The available #fuses can be found by looking at the top of the 16f887.h header file. Just double click on it in the Project Tree to open it. At the very top there will be a several-line comment which tells you what fuses can be set. This is one of the murky areas for us still but we can explain what we know so far. We are setting 3 fuses in our example code. The first NOMCLR stands for No Master Clear. Master Clear is a pin on most chips which can be used to reset the chip. Usually this pin doubles as a Input/Output (I/O) pin. In order to use it as an I/O you must set the fuse NOMCLR to disable it as a Master Clear pin. You’ll always want to do this if you are not using it as a Master Clear because leaving it float will cause your chip to randomly reboot itself. The second fuse is INTRC_IO which tells the compiler we want to use the Internal RC (Resistor Capacitor) Oscillator and that we want Pins (9) OSC1/CLKIN and (10) OSC2/CLKOUT set as outputs. In our chips datasheet this is cryptically explained on page 61. You might be tempted to use INTRC instead of INTRC_IO. INTRC outputs a clock on Pin 10 which is 4 times slower than our internal oscillator. This is usually written as Fosc/4. Pin 9 is an I/O when using INTRC. The third fuse we set in NOBROWNOUT. Brownout is a circuit protection feature. If voltage to our chip drops below a certain threshold the chip will shutdown or reset. On page 216 this is described as Vbor for Voltage Brown Out Reset. In our particular chip the brown out voltage can be set at 4Volts or 2.1volts. In our case we don’t want the chip to ever reset no matter what the voltage is. So we set NOBROWNOUT. #use delay(clock=8M) Line 3: The #use directive is followed by another keyword delay. This must be set to the speed at which are oscillator is actually running. Since we are using the INTRC_IO oscillator we know we are using the internal oscillator of this chip. Therefore you need to look in the datasheet of the chip and find out what the normal operating speed of the internal oscillator is. Some chips, including this one, can have their clocks divided to slow them down or they can be clocked faster using an external oscillator such as a crystal. On page 3 of our chip’s datasheet we can see that our chip actually has two internal oscillators. 8Mhz and 31Khz. We are using the 8Mhz here. The reason #use delay needs to be defined is actually because we are using the delay_ms() function on line 10. delay_ms() uses the #use delay to know how fast the oscillator is running so that it can correctly delay the execution of our code. If you set #use delay to an incorrect value your delay_ms() will function but it will be at the wrong speed. We’ll touch on this again in a minute. void main() { Line 5: Every program needs a starting point. void main() is the starting point for our program. This is simply how the C language works. Our chip needs to know where to start executing code and it will start in the void main() function. Why void? Void is simply saying that we do not expect our function to return any value. It could be int main but then we would have to return an integer at the end of our program. This is sometimes done to indicate a successful run of the program, but what’s the point? So we just use void and then we don’t have to return anything. void main() { while(true) { output_high(PIN_D1); delay_ms(50); output_low(PIN_D1); delay_ms(50); } } Line 6 and 14, 8 and 13: Sets of brackets are called blocks. Line 6 starts a block of code and line 14 ends that block of code. Lines 8 and 13 are another pair of brackets and are nested inside of the void main(){} code block. A common syntax error is having too many or two few brackets. For each open bracket you need a matching close bracket. while(true) { output_high(PIN_D1); delay_ms(50); output_low(PIN_D1); delay_ms(50); } Line 7: We use a while(true) loop so our code keeps restarting. If we did not use a while(true) loop our LED would turn on and off only one time. We want the LED to keep blinking. CCS Help Program Line 9: output_high() is a compiler function. This is unique to the CCS Compiler. Remember that Help File I told you to get ready? It’s located under Windows Start -> Programs -> Pic-C -> Pic C Help. If you select the index tab and type ‘output’ you will see a long list of output options. output_A would control an entire bank, or PORT, of outputs. In our case we only want to toggle one output and we want to set it to High (on). The parameter PIN_D1 is defined in the 16f887.h header file. See…That header file is coming in handy after all. Instead of you having to look in the datasheet and try to figure out what the hex value of PIN_D1 is, the CCS Compiler has given you a header file which defines a constant name for the value. All you need to know is where to look for the name (in the header file). If you look at the pinout diagram in your datasheet you might notice there is no pin labeled D1. It’s actually labeled RD1. ‘D’ is the Bank and 1 is the Port. Honestly, I don’t know what the R means but who cares. Let’s try another one. What do you think output_high(PIN_A0) will do? You’ve got it. It will turn the pin labeled RA0 in your datasheet to high. See…It’s not that hard once you know where to look. delay_ms(50); Line 10 and Line 12: We already touched on delay_ms(50) when we were talking about the #use directive. Just a refresher here: In order for delay_ms to work you must set #use delay to the proper clock speed. A wrong clock speed will cause delay_ms to not work properly. delay_ms stands for Delay Milliseconds. Where do you think you would look if you wanted to delay micro seconds? You look in the CCS Help program and simply type delay. You would then notice you can delay for Microseconds(_us) or Cycles(_cycles). Clicking on those entries gives you examples of their use. Line 11: This one I am going to leave for your homework. If output_high(PIN_ D1) turns the LED on then what do you think output_low(PIN_D1) does? Here’s a tip. Look in the CCS Help file. Conclusion So, you flashed an LED and now you are bored again. Use the CCS Help file and look up ADC for Analog to Digital Converter. Your Potentiometer is connected to an ADC pin and you should be able to read the help file and learn how to read the position of the potentiometer. You can also search the 44 Pin Demo Board User guide and learn what port the pushbutton is connected to. Then search the CCS Help for Input_State and learn how to use an input to control the LED. So don’t stop with this tutorial. There is lots to learn. This is where I’m supposed to tell you to come join our hackerspace. But if you don’t live near Baltimore, check out www.hackerspaces.org and find a hackerspace near you. They are all over the world and are a ton of fun. We are taking the knowledge we learned about flashing LEDs and applying it to hacking Toy RC Cars to make them autonomous (drive themselves). Check out our wiki.harfordhackerspace.org projects page for details on that project. It’s actually a very simple yet rewarding project. Share this: Facebook
Nice 8051 projects and study resource here check this ! - 8051 Microcontroller Projects AVR PIC Projects Tutorials ... 17 May 2012 ... Download microcontroller 8051 projects, ebooks, tutorials and code examples. 8051 projects, AVR ... www.8051projects.net/
Dtmf based robot control implementation is very easy . Connect a audio jack of any cell phone to you microcontroller(mc). Mc monitors it. After you are in call wit tat phone . On the cal. Different buttons from caller ex 1 2 3 would result in different tones at recieves phone . Which can monitored by a microcontroller . Assign different tasks for different tasks for different frequencies for your robot . Simple =) proper implementation would get you many controls . You can get the most out of it . Because gsm mobie range coverage cant be compared to any rc.!
f a very simple robot control circuit using DTMF tones. Dual-tone multi-frequency (DTMF) tones are the sounds you hear when you press keys on a telephone keypad. You can buy a very simple IC (usually used in answsering machines and the like) that takes care of all the filtering and decoding necessary to determine which key was pressed. And because it's just an analog audio signal that is being exchanged, I can use a number of ordinary, low-cost audio transmitter/ reciever pairs for sending that audio signal. The design of the circuit for decoding DTMF tones is pretty straightforward. The CM8870 IC interprets the tones as a 4-bit digital signal. The HCF4514 IC then decodes and stores this onto 16-lanes of output which will switch transistors, which will switch automotive relays, which will operate motors that move the robot.

Thursday, May 17, 2012

Give your Ideas for improving this blog...!!!!!! @ https:// www.facebook.com/ embedyoucareer Embed Your Career ▼ ‹ › Home View web version Two recent demonstrations of autonomous quadrotor helicopter technology have sparked renewed interest in the potential for using automated robotics for construction and search and rescue operations. In early December last year, ETH Zurich roboticist Raffaello D'Andrea and architects Fabio Gramazio and Matthias Kohler, also from ETH, created an art installation titled 'Flight Assembled Architecture' just outside of Paris. The installation used a series of miniature quadrotor helicopters to autonomously build a six metre tower from Styrofoam blocks. Four robots worked on the project at any one time, relying on detailed blueprints and a motion capture system embedded in the roof to accurately construct the tower at a rate of 100 blocks per hour. On the other side of the pond, a research team at the University of Pennsylvania's General Robotics, Automation, Sensing and Perception (GRASP) Lab recently uploaded a video to Youtube demonstrating their advancements in so-called 'swarm' technology. The video shows twenty miniature quadrotors performing complex manoeuvres, navigating around obstacles and otherwise demonstrating what the team describes as "complex autonomous swarm behaviour." While the technology demonstrated by these two teams is far from market ready, its potential applications are intriguing. Larger versions of the building robots, for example, could potentially be used in the construction industry to erect buildings faster and more efficiently, while significantly reducing the occupational health and safety risks for associated workers. While GRASP's demonstration has raised some concerns as to the use of similar technology for unauthorised surveillance operations, the ability of the quadrotors used in their experiment to successfully navigate obstacles points to some very useful potential applications in the area of search and rescue. For example, rescue workers could potentially use a similar system to explore high risk areas, and to gain access to enclosed spaces that are too small for a human being to explore. With the development of such advanced autonomous technology inevitably comes moral and ethical concerns over its use, but if utilised in the right way, self-guiding robots could be used in a variety of applications to complete tasks more efficiently, and importantly, with far less risk for human workers. source: Internet

Wednesday, May 16, 2012

so here is the first project "quadrocopter" its a kind of remote control toy though. But for me its not just a toy its a flying robot . It is intelligent and can used under hazardous situations for instance military purpose and lot application. If you are going to take it seriously. So let me you tel how it actually works . See Next post :)

Tuesday, May 15, 2012

hi friends , here is something very important and useful for all the student especially engineering,science,and related field this website link below would be very very useful it contains video lectures from professors for IIT institutions one this website as an open source for all students . Please do bookmark it lot of useful resource here check in :) nptel.iitm.ac.in/

Intro

Hi everyone, Welcome to my blog this blog is all about technology stuffs,music,photography,robotics,resource update and much more.