Help
Advanced Member level 2
Hi...
Bellow is the hardware delay program, can you help me to explain 3Q:
1Q) Is it the TMOD set the Timer0 (bit 0-3) is low and Timer1 (bit 4-7) is high, Why?? Why use AND operation TMOD = TMOD & 0xF0 ??
2Q) Is it the TMOD set the bit1=M1 is high, Why?? Why use OR operation TMOD = TMOD | 0xF0 ??
3Q) What the different ET is 0 or 1, why would't have any different?? Is it we must set the interupt there?
Thank You...
Bellow is the hardware delay program, can you help me to explain 3Q:
Code:
#include <reg52.h>
/*------------------------------------------------------------------------*/
void main(void)
{
while(1)
{
unsigned char d;
for(d=0; d<20; d++)
{
TMOD &= 0xF0; // 1) TMOD = TMOD & 0xF0 ??
TMOD |= 0x01; // 2) TMOD = TMOD | 0x01 ??
ET0 = 0; // 3) ??
TH0 = 0x00;
TL0 = 0xFA;
TF0 = 0;
TR0 = 1;
while(TF0 == 0);
TR0 = 0; }
}
}
1Q) Is it the TMOD set the Timer0 (bit 0-3) is low and Timer1 (bit 4-7) is high, Why?? Why use AND operation TMOD = TMOD & 0xF0 ??
2Q) Is it the TMOD set the bit1=M1 is high, Why?? Why use OR operation TMOD = TMOD | 0xF0 ??
3Q) What the different ET is 0 or 1, why would't have any different?? Is it we must set the interupt there?
Thank You...