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?
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.
My answer:
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.
My answer:
'G' in ASCII is 0100 0111
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
My answer:
ASCII 'B' = 0100 0010
or should I swap the High and low bits before I draw the pattern?