electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

0.2m Sec


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> 0.2m Sec
Author Message
Help



Joined: 15 Feb 2005
Posts: 560
Helped: 4


Post26 Apr 2005 4:57   

0.2m Sec


Hi,

Anyone know how to calculate/get the -200 = 0.2ms?? Is it the -200 is the dec number??

TMOD = 0x02; /* TIMER0 at Mode 2 */
TH0 = -200; /* 0.2ms (200us) */
TL0 = -200;
TR0 = 1; /* start timer */

Thank You.
Back to top
IanP



Joined: 05 Oct 2004
Posts: 6490
Helped: 1542
Location: West Coast


Post26 Apr 2005 5:21   

Re: 0.2m Sec


Timer0(1) in MODE2 is a 8-bit counter (TL0(1), fed from clock/12) and at 11.0952MHz clock you need ≈184d reload value in TH0(1) to achieve 0.2ms ..

Last edited by IanP on 26 Apr 2005 8:13; edited 1 time in total
Back to top
Help



Joined: 15 Feb 2005
Posts: 560
Helped: 4


Post26 Apr 2005 5:45   

Re: 0.2m Sec


Hi,

What is ~184d reload?? how to calculate the value? -200??

Thank You..
Back to top
IanP



Joined: 05 Oct 2004
Posts: 6490
Helped: 1542
Location: West Coast


Post26 Apr 2005 6:12   

Re: 0.2m Sec


In assembly language sometimes negative values, such as -200, are represented by FF38 (65536-200)..

Reload value of 184d is calculated as follows:
11059200/12=921600 - clock frequency to TIMER0 in MODE2

1/(921600*X)=0.0002s
X=184.32 ≈ 184d
Back to top
Help



Joined: 15 Feb 2005
Posts: 560
Helped: 4


Post26 Apr 2005 7:16   

Re: 0.2m Sec


Hi

Reload value of 184d is calculated as follows:
Quote:
11059200/12=921600 - clock frequency to TIMER0 in MODE2

1/(921600*X)=0.0002s
X=184.32 ≈ 184d


How do you know is 0.2ms?? Can you explain mare what is X value for what??

Thank You
Back to top
IanP



Joined: 05 Oct 2004
Posts: 6490
Helped: 1542
Location: West Coast


Post26 Apr 2005 7:28   

Re: 0.2m Sec


X is just a sumbol used to solve an equasion; you can use A, B, C or Z, but it is still the reload value for TH1.

If the input pulse to TIMER0 equals to 1/ 921600 = 1.085µs then if you multiply this value by 184 the resultant time will be 1.085µs * 184 ≈ 0.2ms
Back to top
Help



Joined: 15 Feb 2005
Posts: 560
Helped: 4


Post26 Apr 2005 7:49   

Re: 0.2m Sec


Hi,

I still not understand the "reload value for TH1", the mode 2 have related to T1??

Thanks..
Back to top
IanP



Joined: 05 Oct 2004
Posts: 6490
Helped: 1542
Location: West Coast


Post26 Apr 2005 7:58   

Re: 0.2m Sec


Both timers, TIMER0 and TIMER1 are identical in modes 0, 1 and 2;
So for Timer0 the reload value will be for TL0 and TH0,
for TIMER1: TL1 and TH1 ..
Sorry for confusion ..
Back to top
Help



Joined: 15 Feb 2005
Posts: 560
Helped: 4


Post26 Apr 2005 8:04   

Re: 0.2m Sec


Hi,

Nvm, so..

TMOD = 0x02; /* TIMER0 at Mode 2 */
TH0 = -200; /* 0.2ms (200us) */
TL0 = -200;
TR0 = 1; /* start timer */

Now i setting is Timer0, so the you mean reload value is for TH0 is it??

Thanks..
Back to top
IanP



Joined: 05 Oct 2004
Posts: 6490
Helped: 1542
Location: West Coast


Post26 Apr 2005 8:10   

Re: 0.2m Sec


Initially you have to reload both TL0 and TH0 and after first overflow fromTL0 it will set TF0 and also reloads TL0 with TH0 ..
And the reload value of TH0 remains unchanged ..
Back to top
Help



Joined: 15 Feb 2005
Posts: 560
Helped: 4


Post26 Apr 2005 8:17   

Re: 0.2m Sec


Ya.. Is true the TH0 still remains unchanged at 0x38 because we already set it. So how about the 184 value?? for what??

Thanks..
Back to top
IanP



Joined: 05 Oct 2004
Posts: 6490
Helped: 1542
Location: West Coast


Post26 Apr 2005 8:27   

Re: 0.2m Sec


200 is the value for clock frequency of 12MHz;
184 is the value for clock frequency of 11,0592MHz ..
Back to top
Help



Joined: 15 Feb 2005
Posts: 560
Helped: 4


Post26 Apr 2005 8:39   

Re: 0.2m Sec


Oh.........,
Now i already understand, very thk u!!

Why use 11,0592MHz standard they use 12MHz is it??

Thank
Back to top
IanP



Joined: 05 Oct 2004
Posts: 6490
Helped: 1542
Location: West Coast


Post26 Apr 2005 8:43   

Re: 0.2m Sec


It look like that, as the input frequency to TIMER0 will be 1MHz (1µs) @ 12MHz crystal .. multiplied by 200 gives you 200µs ..
Back to top
Help



Joined: 15 Feb 2005
Posts: 560
Helped: 4


Post26 Apr 2005 9:31   

Re: 0.2m Sec


Hi,

Thank You vary much now i really understand already.

Do you have any web side, or reference book for explaining this type of code (timer, counter, interrupt, overflow and so on) and give some simple code... ??

Thank You..
Back to top
IanP



Joined: 05 Oct 2004
Posts: 6490
Helped: 1542
Location: West Coast


Post26 Apr 2005 10:33   

Re: 0.2m Sec


What I use as reference is a hard copy of "80C51-Based 8-bit Microcontrollers - Data Handbook" from Philips Semiconductors .. It is about 1400 pages ..
I'm not sure if you can download something like this from the net ..
Back to top
Google
AdSense
Google Adsense




Post26 Apr 2005 10:33   

Ads




Back to top
Help



Joined: 15 Feb 2005
Posts: 560
Helped: 4


Post26 Apr 2005 13:01   

Re: 0.2m Sec


Hi,

So, do you have any simple sample program for you own experience because now i like studying theory and no have practice... hai.. very hard.... Crying or Very sad ...

Thanks...

Added after 2 hours 5 minutes:

IanP wrote:
What I use as reference is a hard copy of "80C51-Based 8-bit Microcontrollers - Data Handbook" from Philips Semiconductors .. It is about 1400 pages ..
I'm not sure if you can download something like this from the net ..


Hi,

I already try to search for this data handbook but still get it. Inside the book have alot of sample is it?? Can you send it to me?? I hope this book can help me.... Smile ...

Thank You
Back to top
silvio



Joined: 31 Dec 2001
Posts: 801
Helped: 90


Post26 Apr 2005 17:27   

Re: 0.2m Sec


Help wrote:
Hi,

So, do you have any simple sample program for you own experience because now i like studying theory and no have practice... hai.. very hard.... Crying or Very sad ...

Thanks...

Added after 2 hours 5 minutes:

IanP wrote:
What I use as reference is a hard copy of "80C51-Based 8-bit Microcontrollers - Data Handbook" from Philips Semiconductors .. It is about 1400 pages ..
I'm not sure if you can download something like this from the net ..


Hi,

I already try to search for this data handbook but still get it. Inside the book have alot of sample is it?? Can you send it to me?? I hope this book can help me.... Smile ...

Thank You


Straight from Philips :

http://www.semiconductors.philips.com/acrobat_download/various/80C51_FAM_ARCH_1.pdf
http://www.semiconductors.philips.com/acrobat_download/various/80C51_FAM_HARDWARE_1.pdf
http://www.semiconductors.philips.com/acrobat_download/various/80C51_FAM_PROG_GUIDE_1.pdf

or you can get the genuine Intel MCS(R) 51 Microcontroller Family User's Manual
from here:
http://www.intel.com/design/mcs51/manuals/272383.htm

If you have spare time you can take a look at the all MCS51 INTEL's documentation:
http://www.intel.com/design/mcs51/docs_mcs51.htm
Back to top
wolfheart_2001



Joined: 17 Mar 2005
Posts: 92
Helped: 9


Post26 Apr 2005 18:20   

Re: 0.2m Sec


MCU operates with cycles , each cycle equal to clock_freq/12(12 clock pulses for one cycle)
if u use a 12MHZ crystal then each cycle equal (1/12000000 )*12=1us

the timer increment its value at each cycle.

since the timer increment not decrement then u use the 2's complement of 200( -200 will be intepreted to be the 2's comlement of 200), so after 200 increment for every 200 cycle and each cycle equal 1us(12MHZ crystal)
then u get a delay of 200us or .2ms.

but remember to enable the dedicted interrupt and remember the to take care how the int handler wil work.
Back to top
Help



Joined: 15 Feb 2005
Posts: 560
Helped: 4


Post27 Apr 2005 2:46   

Re: 0.2m Sec


Hi silvio & wolfheart_2001,

Do you have any idea where can i get the information that can teach me how to write a C-code in 8051 application note??

Thanks...
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> 0.2m Sec
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
rtc_get_time(hr,min,sec) (3)
16bit >10k samples/sec ADC? (2)
What does volt-µsec tell? (2)
Installation fails after 100 sec........... (2)
2Mega Pixel 15Frame/sec Transmit (2)
JNCIS SEC (JUNOS-331) Dumps Required (1)
What do I need to make a 555 to output a 1 sec pulse? (15)
help needed to sort out number of atoms/sec (1)
xtal(oscillator problem) - a way to generate 1 sec delay (2)
SIMCOM300-can't get constant 1 sec led or connect to network (1)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS