manoj madhavan
Banned
![Full Member level 1](/styles/images/ranks/elevel1.gif)
- Joined
- May 1, 2010
- Messages
- 119
- Helped
- 5
- Reputation
- 10
- Reaction score
- 5
- Trophy points
- 1,308
- Location
- India, Kerala, Moolamattom
- Activity points
- 0
Thanks to all
Please Help me to fix an error in my asm code
Hope somebody help me
This is the code
------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------
See the attachments
Thanks in advance
Manoj Soorya
Please Help me to fix an error in my asm code
Hope somebody help me
This is the code
------------------------------------------------------------------------------------------
Code:
#include <reg52.h>
#define ON 0
#define OFF 1
#define true 1;
#define false 0;
sbit LED = P1^0;
sbit sw =P3^0;
void Tmr0Init();
void Tmr0() interrupt 1
{
unsigned char cnt;
cnt++;
if(cnt==500) {
LED = ~LED;
cnt=0;
}
TH0 = 0xDC;
TL0 = 0x00;
}
void Tmr0Init(void)
{
TMOD=TMOD&0xF0;
TMOD=TMOD|0x01;
TH0 = 0xDC;
TL0 = 0x00;
ET0 = 1;
}
void main(void)
{
Tmr0Init();
EA = 1;
for(;;)
{
if(sw == 0)
{
k=debounce(50);
if(k==0){
LED=0;
TR0 = 1;
}
}
else{
LED = 1;
}
}
}
int debounce(unsigned int a)
{
unsigned int i,j;
j=sw;
for(i=0;i<=a;i++)
{
for(i=0;i<=256;i++);
}
if(sw == j)
{
return true;
}
else
{
return false;
}
}
----------------------------------------------------------------------------------
See the attachments
Thanks in advance
Manoj Soorya
Attachments
Last edited by a moderator: