Displaying 1-100 in 16X2 LCD using 8051 assembly language

Status
Not open for further replies.

netdeamon

Newbie level 6
Joined
Jun 7, 2013
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,396
I am using timer in 8051. Somebody told me that timer control (measuring time between two pulses and such) in assembly is more accurate than using timer in C.

So now I am struck with displaying the number 1-100 using assembly.
I can do 1-9.
But what should be my logic to display 1-100 in assembly?
I am using 89v51RD2 phillips chip.
 

The behavior or accuracy of the timer/capture/compare module is independent of the language used to configure the module.

It is true, Assembly Language is more deterministic especially concerning delays, latency, ISR times, etc.

However, once the timer module and its associated features have been configured, it operates independently of the firmware/app currently running.

The pulse interval obtained by timer module is indifferent to whether it was configured from firmware derived from Assembly Language or C Language.


As to your LCD routines, the technique to display a single digit/characters is not much different from displaying a string of digits/characters.

The following tutorial covers LCD routines in both C and Assembly Languages and provides source code in both:

LCD interfacing with Microcontrollers tutorial


BigDog
 


What I am doing is starting the counter at one pulse and stopping it at another.
And I calculate the time duration between it.
So it dosent matter if I write the code in C or in assembly? The time duration will remain same?
 

What I am doing is starting the counter at one pulse and stopping it at another.
And I calculate the time duration between it.
So it dosent matter if I write the code in C or in assembly? The time duration will remain same?

If you utilize the timer capture mode, there will be NO difference.

Once the Timer2 is properly configure in Capture Mode, when a transition occurs on T2EX, the value of timer2 is immediately stored in RCAP2L and RCAP2H and an interrupt is generated.

The interrupt can be serviced by either an ISR written in C or Assembly Language, which ever is more convenient and does not affect the value stored in RCAP2L and RCAP2H.

Timer is indifferent to being configured by firmware generated from C or Assembly Language.

Reference: **broken link removed**, Section: 6.5.1 Capture mode, Page: 33

BigDog
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…