Please help me about code and circuit is right?
here is code on KEIL
If it is wrong tell me what is wrong here?
____________________________
#include <AT892051.h>
sbit Buzzer=P1^7;
sbit PUSH_BUTTON=P3^0;
#define ON 0
#define OFF 1
void wait_a_second()
{
unsigned int x;
for(x=0;x<33000;x++);
}
main()
{
int i;
Buzzer=OFF;
for(;
{
while(PUSH_BUTTON==1)
{
}
for(i=1;i<30;i++)
{
Buzzer=ON;
wait_a_second();
Buzzer=OFF;
wait_a_second();
}
}
}
_________________________
What result you were expecting??
Circuit is looking fine but I have some doubt on reset resistor and capacitor. shouldn't resistor on power side and capacitor on ground side ????
I didnt see your code, but confirm that the capacitors connected to the Xtal are 33Pf and not 33 microfrad as i saw in your schematic. With 33 Microfarad capacitors at osc pins, nothing will work.
I didnt see your code, but confirm that the capacitors connected to the Xtal are 33Pf and not 33 microfrad as i saw in your schematic. With 33 Microfarad capacitors at osc pins, nothing will work.
Proteus doesn't entertain external crystal and capacitor.
see what is the osc freq set in the properties of 89c2051.
PS: All capacitors used is ideal, replace them with real ones
Thank you for helping me.
What result I want is if button is pressed buzzer is giving sound.
I wanna make a sensor circuit.
I am replacing button to any sensor and buzzer is replacing any alarm circuit .
Is it clear to understand now?
clear a bit.
Every sensor has different interface, different protocols and even different voltage levels.
have you checked the osc frequency?
And I am still ambiguous about your question?what exactly you want to get from this forum? your code is OK for button and buzzer, circuit is also right. what else????
On the proteus ,it doesn't work.So I am asking from this forum.
Can you explain about sensor interface and protocol more clearly?
How to check the osc frequency?
I have attached my proteus file.Please check out it??:lol: