The MC145151-2 is a phase-locked frequency synthesizer integrated chip. It has N13~N0 14 pins for controlling the output frequency.
Which N13, N11 has been grounded, N12 vacant.
From the PDF file of MC145151-2, find the section on control frequency, the screenshot is as follows:
According to the illustration, it can be seen that the control relationship of N10~N0 to the output frequency is as follows:
011 1000 1000 : Output 5000 KHz
011 1000 1001 : Output 5001 KHz
011 1000 1010 : Output 5002 KHz
..............................
..............................
..............................
101 0111 1100 : Output 5500 KHz
The analysis shows that the minimum: 0x0388, the largest: 0x057C.
two,It is now required to control the N10~N0 pins using the SCM button count method so that the output frequency is 5000~5500KHz.
The microcontroller is STC89C52.
Design add, subtract, clear three keys;
Connect P2.2~P2.0 and P0.7~P0.0 to N10~N0;
Output 11-bit binary number here, minimum: 0x0388, maximum: 0x057C.
According to the above requirements, the design procedure is as follows.
//=================================
#include
Sbit K_ADD = P3^3; //+
Sbit K_SUB = P3^4; //-
Sbit K_000 = P3^5; //Clear
//----------------------------
Void delay_ms(unsigned int n)
{
Unsigned char j;
While(n--) for(j = 0; j "230; j++);
}
//----------------------------
Void main()
{
Unsigned int m;
m = 0x0388;
While(1) {
P2 = (m/256);
P0 = (m % 256);
If (K_000 == 0) {
Delay_ms(10);
If (K_000 == 0) {
m = 0x0388;
While(K_000 == 0);
} }
If (K_ADD == 0) {
Delay_ms(10);
If (K_ADD == 0) {
m++;
If (m †0x057C) m = 0x057C;
While(K_ADD == 0);
} }
If (K_SUB == 0) {
Delay_ms(10);
If (K_SUB == 0) {
M--;
If (m < 0x0388) m = 0x0388;
While(K_SUB == 0);
} } }
}
Whether the above program is correct can be tested by connecting 11 external LEDs P2.2~P2.0 and P0.7~P0.0.
wired backlight gaming keyboard
Gaming keyboard with laser curving keypad, led backlit, blue , red, green colors are available,suspension button design, perfect Mechanical hand feeling !
Gaming Keyboard,Wired Rgb Game Keyboard,Wire Smart Keyboard,Game Controller
MICROBITS TECHNOLOGY LIMITED , https://www.hkmicrobits.com