1 / 46

Bengkel Asas Pembinaan Robot 2

Universiti Teknologi Malaysia Robot Contest. UBOCON ‘02. Bengkel Asas Pembinaan Robot 2. Prepared by Yeong Che Fai. Overview. Micro Controller Circuit Atmel AT89C2051with output Micro Controller Programming Simple Program Compiler Universal Programmer Micro Controller Circuit

garvey
Download Presentation

Bengkel Asas Pembinaan Robot 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Universiti Teknologi Malaysia Robot Contest UBOCON ‘02 Bengkel Asas Pembinaan Robot 2 Prepared by Yeong Che Fai

  2. Overview • Micro Controller Circuit • Atmel AT89C2051with output • Micro Controller Programming • Simple Program • Compiler • Universal Programmer • Micro Controller Circuit • Atmel AT89C2051 with output and input • Sensor • Infra red detector • Micro Controller Circuit + Sensor • Motor Driver • L293B • Micro Controller Circuit + Sensor + Motor Driver • Conclusion

  3. Micro controller circuit (Atmel AT89C2051 with output)

  4. 19 18 17 16 15 14 13 12 A T M E L A T 8 9 C 2 0 5 1 1 4 5 11 9 8 7 6 3 2 Vcc 20 10 • Build a basic micro controller system as shown below. • 3 majors component to connect to micro controller; power, oscillator and reset circuit. 5 V 10uF P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0 Reset 10K ohm 33pF Oscillator 12Mhz crystal P3.7 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0 33pF Gnd

  5. Basic micro controller system

  6. 19 18 17 16 15 14 13 12 A T M E L A T 8 9 C 2 0 5 1 1 4 5 11 9 8 7 6 3 2 Vcc 20 10 • Now, connect LEDs to pin as shown below 5 V 10uF 5 V P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0 Reset 10K ohm 220 ohm LED 33pF Oscillator 12Mhz crystal LED 220 ohm P3.7 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0 33pF Gnd

  7. The circuit is ready, now remove the Atmel and proceed to download your program onto it.

  8. Micro controller Programming (Simple Program, Compiler, Universal Programmer)

  9. Simple program • Write program as below and save as Test1.asm ;Test 1 ;Led Blinking $mod51 org 0h again: mov p1,#00000001b ;On LED at p1.1 acall delay ;delay mov p1,#00000010b ;On LED at p1.0 acall delay ;delay ljmp again ;Always jump back to again delay: ;Delay's Function mov r1,#1 l1: mov r2,#160 l2: mov r3,#255 l3: djnz r3,l3 djnz r2,l2 djnz r1,l1 ret end

  10. Saving Test1.asm file Make sure save as Test1.asm

  11. Compiler • Now, compile the Test1.asm using software available (ie; asm51.exe) • Go to dos and go to the directory with the assembler application (It’s better if your program save in the same folder). • Type “asm51 Test1.asm “ • This function will generate Test1.hex and Test1.lst. • Text1.hex is machine code which is needed to download to Atmel.

  12. Compiler

  13. Universal Programmer • 3 major things to be done using the programmer; • Erase the microcontroller • Load Hex file onto the microcontroller • Program and verify the microcontroller • Next few slides show the steps using the Universal Programmer

  14. Step 1 Open All-11 Universal Programmer & Tester

  15. Step 2 Click at device and choose ATMEL

  16. Step 3 Click at MPU/MCU and choose AT89C2051

  17. Step 4 Erase the microcontroller

  18. Step 5 Click run and close after the process.

  19. Step 6 Load a .Hex file

  20. Step 7 Browse to folder and choose on TEST1.HEX

  21. Step 8 Set the settings as shown and click ok

  22. Step 9 Finally, run program… now, your Atmel is downloaded with TEST1.HEX

  23. Video • Try run the circuit with the Atmel. • Press reset and the leds should blinking. • Now, add your circuit with a switch.

  24. Micro controller circuit (Atmel AT89C2051 with output and input)

  25. 19 18 17 16 15 14 13 12 A T M E L A T 8 9 C 2 0 5 1 1 4 5 11 9 8 7 6 3 2 Vcc 20 10 Input • Add a push on switch circuit as shown below 5 V 10uF 5 V P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0 Reset 10K ohm 220 ohm LED (Red) 33pF Oscillator 12Mhz crystal LED(Green) 220 ohm P3.7 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0 33pF 220 ohm Gnd Push on Button

  26. Now write source code below and save as Test2.asm • Redo the previously step of compiling and load onto atmel. ; Test2.asm ; Input :: Push on button ;Output :: LEDs $mod51 org 0h mov p3,#10000000b ;Set pin p3.7 as input again: jnb p3.7,on ;Jump to "on" if switch is pressed mov p1,#00000001b ;Green LED on ljmp again ;Always loop back to "again" on: mov p1,#00000010b ;Yellow LED on ljmp again ;Always loop back to "again" end

  27. Run the circuit. • LED will switch when the push on button is “On” Not pressed Pressed

  28. Video

  29. Sensor (Infra Detector)

  30. Build circuit below • Set the 10K ohm preset for input 2- to middle position. • By tuning the 10K ohm preset for input 2+ will trigger the output2. • If input 2+ is tuned to max, led will light on and vice versa when input 2+ is tuned to minimum. • If Inp2+ > Inp2- ; • out2 will at “HIGH” state • If Inp2+ < Inp2- ; • out2 will at “LOW” state 5 V 14 13 12 11 10 9 8 Out4 Inp4- Inp4+ Gnd Inp3+ Inp3- Out3 Out1 Inp1- Inp1+ Vcc Inp2+ Inp2- Out2 1 2 3 4 5 6 7 L M 2 3 4 5 V 220 ohm 10K Ohm preset 5 V 10K Ohm preset Multi turn preset Normal preset (Cheaper)

  31. Build circuit below 5 V • Now, modify your inp2+ with ir sensor as shown below. • Moving a pierce of paper (any white surface material) on top of the sensor will trigger the output. 14 13 12 11 10 9 8 Out4 Inp4- Inp4+ Gnd Inp3+ Inp3- Out3 Out1 Inp1- Inp1+ Vcc Inp2+ Inp2- Out2 1 2 3 4 5 6 7 L M 2 3 4 5 V 220 ohm IR Transmitter 5 V 10K Ohm preset 3.7K ohm IR Detector IR Detector IR Transmitter 5 V

  32. Different view Side view Top view With white line Without white line

  33. Video

  34. Micro controller (Circuit and Programming) + Sensor (Infra Detector)

  35. 19 18 17 16 15 14 13 12 A T M E L A T 8 9 C 2 0 5 1 1 4 5 11 9 8 7 6 3 2 Vcc 20 10 Micro controller Connect the micro controller and sensor together by red point shown in picture below. 5 V 10uF 5 V P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0 Reset 10K ohm 220 ohm LED 33pF Oscillator 12Mhz LED 220 ohm P3.7 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0 33pF 220 ohm Gnd Push on Button Connect to sensor circuit

  36. Sensor 5 V 14 13 12 11 10 9 8 Out4 Inp4- Inp4+ Gnd Inp3+ Inp3- Out3 Out1 Inp1- Inp1+ Vcc Inp2+ Inp2- Out2 1 2 3 4 5 6 7 L M 2 3 4 5 V 220 ohm 5 V 10K Ohm preset 3.7K ohm IR Detector IR Transmitter Connect to Micro controller circuit 5 V

  37. Combination • Connect both circuits together Micro controller Sensor Sensor + micro controller Make a connection by simply add a wire To the point shown previously slides.

  38. Video • Use Test2.asm as program for this circuit. • Triggering the infra detector will switch “on” the microcontroller.

  39. DC Motor (Motor driver L293B)

  40. Working in progress Check back on 9th November 2002

  41. Micro controller (Circuit and Programming) + Sensor (Infra Detector) + DC Motor (Motor driver L293B)

  42. Working in progress Check back on 9th November 2002

  43. Conclusion

  44. Conclusion Power Supply DC Motors Start and stop switch Line Sensors • Now, put everything in one piece of PCB in a structure manner. • Make it robust as it can be modified anytime. • Circuit above is only “hiasan”….

  45. Conclusion • Learn how to build a basic Atmel system. • Learn how to build a simple white detector sensor. • Learn how to combine the sensors to the microcontroller. • Hope, you can proceed with … blah blah..blah…. • CHECK BACK ON 9TH NOVEMBER 2002 FOR A COMPLETE AND CORRECT VERSION.

  46. The End!! Check back again on 9th November 2002

More Related