Question

1=Write a program in C to get 16-bit data from Port-D and send it to ports...

1=Write a program in C to get 16-bit data from Port-D and send it to ports Port-B

2-Write instructions in C to toggle both bits RD7 and RD0 continuously

3-Write instructions in C to get the status of RB2 and put it on RB0

4-Code a simple program in C to send 3499H to Port B and Port D.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)

DDRD = B11111110; // sets Arduino pins 1 to 7 as outputs, pin 0 as input
DDRD = DDRD | B11111100; // this is safer as it sets pins 2 to 7 as outputs
// without changing the value of pins 0 & 1, which are RX & TX

2)

BCF TRISD, 0
BCF TRISD, 7
H2 BTG PORTD, 0
BTG PORTD, 7
BRA H2

3)

BSF TRISB, 2
BCF TRISB, 0
AGAIN BTFSS PORTB, 2
BRA OVER
BSF PORTB, 0
BRA AGAIN
OVER BCF PORTB, 0
BRA AGAIN

4)

MOVLW 0x3499
MOVWF PORTB
MOVWF PORTD

PLEASE UPVOTE

Add a comment
Know the answer?
Add Answer to:
1=Write a program in C to get 16-bit data from Port-D and send it to ports...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT