Write a LED program that reads two 8 bit number

Status
Not open for further replies.

rajesh dubey

Newbie level 3
Joined
Mar 13, 2014
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
23
Write a program in assembly language that read two 8 bit numbers from port C and D , and turns on only one of the LED's connected to RB0,RB1 and RB2 respectively. If the number from C is greater than, less than or equal to 1 from D. Write meaningful comments :?:
 

Is this your school homework?
Assuming from the pin names you are using a PIC, you have almost writen the program.

1. read port C
2. read port D
3. if the value read from port C is the same as the one from port D, send the appropriate level to RB2
4. if the value read from port C is higher than the one from port D, send the appropriate level to RB0
5. if the value read from port C is less than the one from port D, send the appropriate level to RB1

Nobody can help you further than that without knowing the device you are using, what language you are using and how the LEDs are connected.

Brian.
 

Hello Brian,
Thank you for helping me.Iam using PIC16F887 in assembly language. LEDs are connected to RB0 ,RB1,RB2.If you have any other ideas regarding this program please help me.
 

You should remember to turn off the other not active LED outputs, when you set a new state.
 

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…