Need some help regarding___PIC16f877 or c8051f320

preeste

preeste

@preeste-Q3d5XK Oct 26, 2024
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

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform