html5-img
1 / 18

Design & Technology Foundation - Electronic Control (II) (Micro-controller Programming)

Design & Technology Foundation - Electronic Control (II) (Micro-controller Programming). By Jasper Wong email: icjwong@polyu.edu.hk. Micro-controller Programming. Winice 8051/8052 8051 in-circuit emulator. Micro-controller Programming.

maik
Download Presentation

Design & Technology Foundation - Electronic Control (II) (Micro-controller Programming)

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. Design & TechnologyFoundation - Electronic Control (II)(Micro-controller Programming) By Jasper Wong email: icjwong@polyu.edu.hk 8051c/jw

  2. Micro-controller Programming • Winice 8051/8052 8051 in-circuit emulator 8051c/jw

  3. Micro-controller Programming General features of a microprocessor development system: • Memory Mapping • Observation and modification of CPU resources • Observation and modification of memory • Compilation of application program • Execution of application program (such as Go, Step, Cycle) • To set breakpoints • To trace application program • To offer prototype interface • User friendly operation interface • Real-time emulation of CPU 8051c/jw

  4. Micro-controller Programming Main features of the Winice System • To emulate 8051 family up to 16Mhz • Real-time emulation • 128k bytes emulation memory (64k program, 64k data memory) • Multi-function hardware breakpoints • Real-time trace and hardware qualify function • Logic analysis function • Use standard PC parallel/printer port interface • Programming ability • Multiprocessor emulation • Event triggering output function • Built-in symbolic debugger, high level language debugger 8051c/jw

  5. Micro-controller Programming Integrated hardware and software suggested processes: • Use In-circuit emulator(ICE) emulation memory for application software • Disable interrupt function of your program • Survey the main program first • Testing the I/O function • Observe your interrupt program by using ICE and make sure its function is normal • Enable interrupt • Use trace or breakpoint function of ICE • After this process, program a CPU for testing 8051c/jw

  6. Micro-controller Programming 8051 Emulator Window Environment 8051c/jw

  7. Micro-controller Programming Three Debugging Windows: • Program Watch Window - user program display area Functions include breakpoint setting, dump program to file, program execute point, change display address, stepping into, stepping over and full speed program running • Register Watch Window - display all values of CPU registers • Memory Watch Window - displays the assigned memory area 8051c/jw

  8. Micro-controller Programming • Training System (Winice emulator + training Kit) 8051c/jw

  9. Micro-controller Programming • Training Kit 8051c/jw

  10. Micro-controller Programming • Training Kit Circuit 8051c/jw

  11. Micro-controller Programming 8051 Programming • Data Byte Movement MOV direct, #data ; data  (direct) MOV Rn, #data ; data  (Rn) MOV A, #data ; data  (A) A 8-bit binary constant will move into a Special Function Register after execution of the first instruction. The second instruction will move a data into a particular register in the current selected Register Bank .The Accumulator will hold the value equal to #data after the instruction is executed. 8051c/jw

  12. Micro-controller Programming • Light up a Green LED --- Move P1, #AA • Light up a Red LED --- Move P1, #55 8051c/jw

  13. Micro-controller Programming • Read Switch Status Mov A, P0 Mov P1, A 8051c/jw

  14. Micro-controller Programming • Bit Operation CLR bit ;0B (bit),set a bit to 0. SETB bit ;1B (bit),set a bit to 1. CPL bit ;(bit) (bit),complement of a bit. Turn off a buzzer SETB P3.4 SETB P3.5 Turn on a buzzer CLR P3.4 CLR P3.5 8051c/jw

  15. Micro-controller Programming • Buzzer Circuit 8051c/jw

  16. Micro-controller Programming • Address Operation DJNZ Rn, addr DJNZ direct, addr The first instruction will decrease the content of the Rn register by one, if the content of the Rn register is not equal to zero after the decrement, the program flow will jump to the address specified by "addr". If the content of the Rn register is equal to zero after decrement, the program flow will be continued without jumping. The second one will decrement the content of the RAM at address specified by "direct" by one. If the new value is not equal to zero, then the instruction on the address specified by "addr" will be executed, otherwise the program flow will be continued without jumping. The range for this jumping is limited to + 128 bytes. 8051c/jw

  17. Micro-controller Programming • Arithmetic Operation ADD A, direct ; (direct)+(A) (A) ADD A, Rn ; (Rn)+(A) (A) ADD A, #data ; data+(A) (A) The value stored in "direct", the register Rn and the #data of the above instructions will ADD with the value in the Accumulator and the result is stored in the Accumulator. 8051c/jw

  18. Micro-controller Programming • Logical Operation ANL A, Rn ; (A)  (Rn)  (A) ANL A, #data ; (A)  data  (A) ANL A, direct ; (A)  (direct)  (A) ANL direct, A ; (direct)  (A)  (direct) ANL direct, #data ; (direct)  data  (direct) All the above instructions work with binary data format. The first three instructions will store the result on the Accumulator, the last two instructions will store the result in the RAM memory at address shown in "direct" or Special Function Register. 8051c/jw

More Related