CCP Modules - Capture Mode | LAB

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024
  • CCP Module - Capture Mode (LAB)
    Embedded Systems Tutorials - Microchip PIC Microcontrollers - MPLAB X
    [[ Tutorial #24 ]]
    You can read this exact same tutorial as a written article (in English) on my website.
    Through this link down below
    NA
    You can also check for downloadable content (code + schematics) herein in the description or on the website
    deepbluembedde...
    ===================================
    In this LAB, we'll create a basic firmware driver c-code to operate the CCP1 Module in the capture mode. To capture the 16-Bit value of Timer1 Module which will be running in the counter mode and incrementing by an external clock source (push button). The capture trigger event will be a single rising edge on the CCP1 pin / RC2
    ===================================
    Downloadable Files & Links
    ----------------------
    NA
    ===================================
    You can also follow this course (with extra info) on my website (In English)
    deepbluembedde...
    You can follow this course playlist on TH-cam (In Arabic)
    • Embedded Systems Cours...
    ===================================
    For More Information
    Visit my website @ DeepBlueMbedded.com
    [[ And / Or ]]
    Follow me on socials
    LinkedIn / khaled-magdy-
    Twitter / ii_deepblue_ii
    FaceBook / khaled.elrawy.359
    ===================================
    If you've any questions, feel free to leave a comment down below.
    I will always be glad to respond to your comments as soon as possible.
    ------------
    Good Luck ^^
    And don't forget to SUBSCRIBE for more tutorials from DeepBlue!
    If you find this content useful .. Then Share It With Your Network!
    #Embedded_Systems
    #PIC_Microcontrollers
    #CCP_Capture

ความคิดเห็น • 26

  • @mohamedabdelazeem8203
    @mohamedabdelazeem8203 4 ปีที่แล้ว

    Great job. could you recommend a book for more info and practice with pic ?

  • @Raghadhafez
    @Raghadhafez 11 หลายเดือนก่อน

    الله يباركلك يا رب

  • @bassammansour1361
    @bassammansour1361 3 ปีที่แล้ว +1

    why when i press count (one), 2 leds immediately glows ?

  • @hanymehana4998
    @hanymehana4998 2 ปีที่แล้ว

    مشكلة assigning to non-lvalue سببها ايه ياهندسه

  • @aravindanp8262
    @aravindanp8262 4 ปีที่แล้ว

    IF I press count button, led glow but getting off imediately . any solution sir?

  • @memozahran6395
    @memozahran6395 4 ปีที่แล้ว

    plz. need the CCP module files for both capture and capture modes ?

  • @alhassanomran244
    @alhassanomran244 3 ปีที่แล้ว

    ربنا يجزيك كل خير يا هندسه ، انا لسه شايف الفيديو حالا وشرحك ما شاء الله ممتاز ، ان شاء الله اتفرج على محتوى القناة كلها ، بارك الله فيك

  • @azaproinfo
    @azaproinfo 4 ปีที่แล้ว

    great explanation thanks

  • @abbeed1
    @abbeed1 4 ปีที่แล้ว

    الله يجزيك الخير

  • @doaamohamed1793
    @doaamohamed1793 4 ปีที่แล้ว

    ممكن اعرف جزئية T1OSCEN=1; T1SYNC=0; بيعملوا اية معلش؟

    • @DeepBlueMbedded
      @DeepBlueMbedded  4 ปีที่แล้ว

      اول سطر دا بيشغل او بيطفی اوبشن فالتايمر و هو الكريستالة الخارجية. احنا ينفع نشغل التايمر بكريستالة خارجية لو محتاجين دا ف تطبيق معين او كدة خصوصا كريستالة الريال تايم الصغيرة دی.
      اما السطر التانی ف دا بنختار اذا كنا نعمل سينك بين السيجنال ال جاية من برا ع البن بتاعت التايمر مع الكلوك الداخلية او لأ. او علی ما اتذكر يعنی و افتكر بردو ان مكنش ليها تأثير كبير سواء عملنا سينك او لا طالما سرعة تغير اللوجيك علی البن مش عالية لدرجة ان مش هتكون حتی جات كلوكاية واحدة من الانترنال اوسيليتور.

  • @ahmedbenamor4849
    @ahmedbenamor4849 4 ปีที่แล้ว

    Hi, can you use this capture mode of the PIC16F8xx to measure the duty cycle of an input signal?

    • @DeepBlueMbedded
      @DeepBlueMbedded  4 ปีที่แล้ว +2

      Yea. I've explained all sorts of measurements in embedded systems in a long lecture near the end of the course. Of which is the duty cycle, frequency, and everything you may imagine 😀
      I'm sure you'll enjoy it!

    • @ahmedbenamor4849
      @ahmedbenamor4849 4 ปีที่แล้ว

      @@DeepBlueMbedded Ok thanks i ll check that

  • @ahmedalashdya4048
    @ahmedalashdya4048 4 ปีที่แล้ว

    ياخي ليش العناوين بالانكليزي

    • @DeepBlueMbedded
      @DeepBlueMbedded  4 ปีที่แล้ว

      الدروس نفسها كانت عبارة عن مقالات على موقعى باللغة الانجليزية و عندما قمت بتحويلها الى فيديوهات نقلت العناوين كما هى هناك
      و مع الوقت قمت باضافة بعض الكلمات العربية للعناوين و لكن ليس لكل الفيديوهات للاسف
      الهدف من ذلك كان تنبيه الاجانب ان لغة الفيديو ليست انجليزية لانهم كانوا يعترضون بالتعليقات او يضعون ديسلايك
      ف تفهمت المشكلة وبدأت بحلها لكن لم افعل ذلك بكل الفيديوهات ف ارجو المعذرة و ان شاء الله بعملهم قريبا فى اى وقت فراغ

  • @mohammedahmed-br5jt
    @mohammedahmed-br5jt 5 ปีที่แล้ว

    شكرا جزيلا يا ااستاذ خالد على المجهود الكبير الذي تقدمه لنا.
    عندما اكتب المقاطعات يظهر لي خطأ حتى ولو قمت باستنساخ الكود الذي كتبته حضرتك ولصقه مباشرة. ارجو ان تساعدني ان امكنك ذلك.
    وهذا جزء من الرسالة التي تظهر
    Capture.c:49:6: error: variable has incomplete type 'void'
    ()void interrupt ISR
    ^
    Capture.c:49:15: error: expected ';' after top level declarator
    ()void interrupt ISR
    ^
    ;
    2 errors generated.

    • @DeepBlueMbedded
      @DeepBlueMbedded  5 ปีที่แล้ว

      ياريت لو تقدر تصورلی الكود سكرين شوت او ترفع الفايل ع جوجل درايف عشان اشوفه و ان شاء الله اقدر اساعدك

    • @mohammedahmed-br5jt
      @mohammedahmed-br5jt 5 ปีที่แล้ว

      #include
      #include "config.h"

      void main(void)
      {
      //--[ Configure The IO Ports ]--
      // Set The Output Port For The Capture Operation (CCPR1 register)
      TRISB = 0x00;
      PORTB = 0x00; // Initial State
      // Set The Output Port For The TMR1 Module (TMR1 register)
      TRISD = 0x00;
      PORTD = 0x00; // Initial State
      //--[ Configure The Timer1 Module To Operate In Counter Mode ]--
      TMR1 = 0;
      T1CKPS0 = 0;
      T1CKPS1 = 0;
      TMR1CS = 1;
      T1OSCEN = 1;
      T1SYNC = 0;
      TMR1ON = 1;
      //--[ Configure The CCP1 Module To Operate in Capture Mode ]--
      CCP1M0 = 1;
      CCP1M1 = 0;
      CCP1M2 = 1;
      CCP1M3 = 0;
      // Enable CCP1 Interrupt
      CCP1IE = 1;
      PEIE = 1;
      GIE = 1;
      // Create The Main Loop Of The System
      while (1)
      {
      // Read & Print Out The TMR1 Counts
      PORTD = TMR1;
      }
      return;
      }

      // Write The ISR Handler
      void interrupt ISR()
      {
      if (CCP1IF)
      {
      // If Capture Event Occurs, Write the CCPR1 register's value to PORTB
      PORTB = CCPR1;
      CCP1IF = 0;
      }
      }
      .انا استنسخت الكود من على موقع حضرتك وايضا يوجد نفس الخطأ
      قمت بفتح الفايل الملحق بالفديو ويظهر نفس الخطأ

    • @DeepBlueMbedded
      @DeepBlueMbedded  5 ปีที่แล้ว

      لو بتستخدم النسخة الحديثة من xc8 compiler ف غالبا هتواجه مشكلة فی الidentifier بتاع الانتربت
      يعنی بدلا من كتابة
      void interrupt ISR ()
      اصبح ينبغی عليك كتابته بالشكل التالی
      void __interrupt ISR ()
      جرب تعديل هذا السطر و أبلغنی لو اشتغل معك

    • @mohammedahmed-br5jt
      @mohammedahmed-br5jt 5 ปีที่แล้ว

      لم يشتغل
      لم اجد النسخة القديمة لهذا حملت النسخة الجديدة.

    • @DeepBlueMbedded
      @DeepBlueMbedded  5 ปีที่แล้ว

      طيب خير ان شاء الله .. خدلی سكرين شوت من رسالة الerror و حط الكود ع الدرايف بتاعك و هات لينكه اأكد عليه مرة كمان