CrazyEngineers
  • Need some help regarding___PIC16f877 or c8051f320

    preeste

    Member

    Updated: Oct 26, 2024
    Views: 1.4K
    Hi Guys. I need some help with the following. I need to know how to generate a 1ms long burst of 120Khz square wave signal using the pic16f877 and the c8051f320 microcontroller by Silicon Labs. I was initially thinking of using the CCP modules to do this but I found an easier way on the internet:
    void squarewave(void) //generates a square wave of 138kHz
    unsigned int j;
    for(j=0;j<0XFF;j++)
    {
    P1_1 =~ (P1_1); //Please explain this line of code to me???
    }
    P1_1 = 0;
    }

    But how do you know that the above wave would generate a square wave and especially that of a frequency of 138kHz. Please help me modify this code for 120khz frequency. How would I then make certain that it’s also only a burst of 1ms.

    Thanks a lotJ
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Home Channels Search Login Register