Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Grades indicator program help in assembly for AT89C51

Status
Not open for further replies.

Eshal

Advanced Member level 1
Advanced Member level 1
Joined
Aug 29, 2012
Messages
470
Helped
16
Reputation
32
Reaction score
15
Trophy points
1,298
Location
Nowhere :)
Visit site
Activity points
5,149
Hello to all!

I am designing a project for my semester. It is very simplest and a part of it is to indicate which grade a student get. For example, if student's percentage is below 60% then it is "E" grade and P1.0 should go high. If student's percentage is in between 60% and 70% then it is "D" grade and P1.1 should go high. If student's percentage is in between 70% and 80% then it is "C" grade and P1.2 should go high. If student's percentage is in between 80% and 90% then it is "B" grade and P1.3 should go high and finally if student's percentage is above than 90% then it is "A" grade and P1.4 should go high.

I am stuck how to use code in assembly in order to declare the range, for example, for percentage between 60% and 70%? Means any value in between this will be the grade "D" and P1.1 will go high and and LED will show this as an indicator. So how to write this range in the assembly?

Thank you very much.
 

Hello sir.

It is a long process sir. I mean I will use keyboard in order to feed the input in the form of percentage then an program inside the controller will recognize what percentage I have fed and correspondingly it will turn on the light on the port.

I just want to know how to tell controller the range of the of the percentage? Like if I were using the C language then it is easy to use the instruction like this,
if (percentage>60 && percentage<70) {printf" grade D"}.

How would I write the above statement in assembly language for 8051?
 

Code:
if (percentage>60 && percentage<70) {printf" grade D"}.
Either include 60 or 70 like this.
Code:
if (percentage>=60 && percentage<70) {printf" grade D"}.
If you can code in C, compile it and see the generated assembly code. Write your assembly code using code lines from it.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top