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.

[SOLVED] 7 exercises / assignments. Can you check if I have done them correct?

Status
Not open for further replies.

metals

Junior Member level 2
Junior Member level 2
Joined
Jan 25, 2011
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,441
Hello, So I have done some exercies / assignments but I dont have the correct answer for them. Can anyone please help me check if I have solved them correct? :) I would truly appreciate it.

No. 1

Question:
Type in the the new content after the asm-code have been executed.
Is the after column correct?

4.JPG


Code:
Var1 equ x20
Var2 equ x21
Var3 equ x22
Status equ x03
VarA equ x28
VarB equ x29
VarC equ x2A

[INDENT]movwf Var1
movwf Var3
bsf status,0
rrf Var3
rrf Var3


movlw x3B
addwf VarA,0
movwf VarB
xorfw VarC,1[/INDENT]



No. 2

Question:
implement the following pseudo code with assembly code:

Code:
if PortC bit2 ==1
(increment var1 by 1)
else
(increment var1 by 2)


My answer:


Code ASM - [expand]
1
2
3
4
btfsc PortC,2
incf var1,f
addlw x02
addwf var1,f



or


Code ASM - [expand]
1
2
3
4
5
btfss PortC,2
goto add
incf var1,f
add movlw x02
addwf var1,f





No. 3

Question:
which ASCII-character is being sent? Method is serial communication with RS232. There is a stop bit, start bit, and a parity.

2a.png


My answer:

2.png
ASCII character '&' which is 0100 0110



No. 4

implement the following pseudo code with assembly code:

Code:
if (var1 > 9) or (var1 < 4)
(increment PortC by 5)
else
(invert PortC)

My answer:


Code ASM - [expand]
1
2
3
4
5
6
7
8
9
10
movlw x09
cpfslt var1
goto add_5
comf portC
movlw x04
cpfsgt var1
goto add_5
comf portC
add_5 movlw x05
addwf portC





No. 5

Question:
You are about to send the ASCII-character 'G' with serial communication RS232 standard.
Draw in the picture below how it would look like.

44.png

My answer:
'G' in ASCII is 0100 0111

44a.png

Should a switch the high and low bits? like this 1 11100010 0?



No. 6

Question:
We want to send the ASCII-character 'B' with serial communication RS323 standard. The parity is odd. Draw the pattern in the following pic

33.png

My answer:

ASCII 'B' = 0100 0010

33a.png

or should I swap the High and low bits before I draw the pattern?


 

Attachments

  • 44.png
    44.png
    941 bytes · Views: 104

As normally if u r using UART module form controller thn u need not to consider start bit or stop bit. module which is being assign for perticular it will work prperly. so u needd to configure the correct register neetly.(if u r doing programming)
 

These are some exercises I got from school, and I have copied them just as they are written. I am not programming anything, just answering questions on a paper.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top