1 / 30

PIC Discussion

PIC Discussion. By: Eng. Tamar Jomaa. C programming-part2. Outlines: 7-Segment EEPROM Timers Interrupt Lab#9:Application to Interrupt. One press on RB0  automatic counter from 0 to 9 (increment by 1) One press on RB1  automatic counter from 0 to 9 (even numbers)

ping
Download Presentation

PIC Discussion

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. PIC Discussion By: Eng. Tamar Jomaa

  2. C programming-part2 Outlines: 7-Segment EEPROM Timers Interrupt Lab#9:Application to Interrupt

  3. One press on RB0 automatic counter from 0 to 9 (increment by 1) One press on RB1 automatic counter from 0 to 9 (even numbers) One press on RB2 automatic counter from 0 to 9 (odd numbers) 7-Segment Example#1

  4. 7-Segment Solution: Example#1

  5. EEPROM • In Micro C: • EEPROM_write(address,data) • EEPROM_read(address) Write 0x10 in address 0x5. Example#1

  6. EEPROM Solution: Example#1

  7. EEPROM Fill all EEPROM locations with 0x55. Example#2

  8. EEPROM Write 0x07 in address 0x05, then read data from address 0x05 to portB . Example#3

  9. EEPROM Program to take the data existed on PORT A and display it on PORT B: first, the data must be taken from PORT A and stored in the EEPROM address location 0X10, and then be taken again from EEPROM and be displayed on PORT B. Example#4

  10. EEPROM Solution: Example#4

  11. Timers PIC16f84A PIC16f877A

  12. Timers

  13. Timers Display the value of TMR0 in portB. Example#1

  14. Timers Solution: Example#1 PSA=1, so tmr0 will count 1:1 External clock source on RA4

  15. Timers another Solution: Example#1 External clock source on RA4 PSA=0, so tmr0 will count according to prescale 001≡ 1:4 increase by one ever 4 clocks.

  16. Timers another Solution: Example#1 internal clock source as oscillator PSA=0, so tmr0 will count according to prescale 000≡ 1:2 increase by one ever 2 clocks.

  17. Interrupt Connect 4 LEDs to bins (RA0,RA1,RA2 and RA3) of portA, and then toggle these LEDs using the interrupt on(RB4-RB7), so that RB4 controls RA0, RB5 controls RA1 and so on. Example#1

  18. Interrupt Example#1

  19. Interrupt Flasher on RA0 then use the interrupt method to control the flashing speed. Use interrupt on change RB. Example#2

  20. Interrupt Example#2

  21. Interrupt If RB4 is pressed the counter will count F,E,D,….0 If RB4 is pressed the counter will count A,9,8,…..0 If RB6 is pressed the counter will count 5,4,3,…..0 The default counting from: 70 Example#3

  22. Interrupt Example#3

  23. Interrupt • PortB= value of TMR0 • PSA=111  TMR0 increase by one every 256 push on RA4 • If TMR0 goes from FF to 00 Interrupt occurs and RA0 toggle. Example#4

  24. Interrupt Example#4

  25. Lab#9: • Application to Interrupt Iqama project • If the crier (muezzen) after doing the athan pushes the button related to that athan, two seven segments will decrease from (25,20,10 or 5 minutes) according to the pray time, and when they reach zero then the iqama time comes. • LED will flashing indicating that the crier (muezzen) must do the iqama now. • The buttons will be connected on bins (RB4, RB5, Rb6 and RB7) respectively, and will be accessed using interrupt method. Iqama project

  26. Lab#9: • Application to Interrupt Iqama project

  27. Lab#9: • Application to Interrupt Iqama project

  28. Lab#9: • Application to Interrupt Modified Iqama project by adding another push button for the Fajer. When the program finish display 25 in the two 7segments as flasher. (5 marks) Iqama project

  29. Lab#9: • Application to Interrupt • Do the modified Iqama project software and hardware. • Attach the CD for the MicroC code and simulation and send to me hard copy report. • Only 3 students in every group. Iqama project

  30. Be free to ask any question. Eng. Tamar Jomaa

More Related