Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
1. Add two numbers residing in the memory locations FC40 and FC41. Place the sum in the memory location FC42. Execute the program by pressing the key F1

2. In chip programming, write a program in assembly using any simulator to do the following:
I. Send the first number (zero) to accumulator
II. Convert content of accumulator to the segment equivalence and store in memory (say memory x)
III. send the content of memory x to port 1
IV. Call a delay subroutine
V. Increment accumulator and repeat II - IV till you get to number 9
VI. Start afresh

3. Write a program to add 8 and 3 then send your result to port 1 of the micro controller and use eight LEDs to declare the result

What I have tried:

Don't have an idea chip programming and not good in c++
Posted
Updated 4-Jan-20 6:51am
v2

This is not a C or C++ problem, but an Assembly language problem.
Here is a tutorial: Assembly Programming Tutorial - Tutorialspoint[^]


It seems the question is about Siemens PLC programming, see: Siemens S7 PLC Simulation Software - Contrologica[^]
 
Share this answer
 
v3
Comments
Member 14706820 4-Jan-20 10:27am    
Thanks...
I was able to come up with this

Mov fc40, '3'
sub fc40, '0'

Mov fc41, '4'
Sub fc41, '0'

Add fc40, fc41
Add fc40, '0'

Mov fc42, fc40

------
The part of executing the program by pressing the key F1 is where I don't really understand.
Still attempting q2 and 3
RickZeeland 4-Jan-20 10:44am    
Apparently you are expected to use the TASM assembler, see: https://stackoverflow.com/questions/15116531/nasm-input-output-to-window
Member 14706820 4-Jan-20 10:54am    
Thank you so much... That was helpful... If I run into any more challenges in the other Qs I'll ask.. Thank you
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
 
Share this answer
 
Comments
Member 14706820 4-Jan-20 10:30am    
Thanks...
I was able to come up with this

Mov fc40, '3'
sub fc40, '0'

Mov fc41, '4'
Sub fc41, '0'

Add fc40, fc41
Add fc40, '0'

Mov fc42, fc40

------
The part of executing the program by pressing the key F1 is where I don't really understand.
Still attempting q2 and 3
OriginalGriff 4-Jan-20 10:53am    
'm not convinced any of that is actually right - it looks like no valid assembler I've seen. FC40, FC41, and FC42 look like Hex addresses to me, and should probably be preceded by "0x" (or start with "0" and end with "h") to let the assembler know.
And the Add syntax looks unlikely, particularly since the rest of the question starts talking about an accumulator, which is normally the target of an Add operation (and SUB, come to that) in processors that use them.

I'd suggest that you look at your uController instruction set again - I'm pretty sure that even not knowing which processor you are use that isn't right...
Member 14706820 4-Jan-20 11:03am    
In Q1 fc40, fc41 and fc42 seem to be just randomly chosen memory locations. Its to be answered just theoretically I guess
OriginalGriff 4-Jan-20 11:22am    
That still doesn't mean that the assembler doesn't need to know what you are passing and what "type" of number it is. How is it supposed to that
Add fc40, fc41
is using two memory locations, while
Add fc40, '0'
is only using one?

Seriously, check the processor instruction set again - I've used a lot of processors over the years and they all needed to be told absolutely what they are doing and with what!
Member 14706820 4-Jan-20 14:53pm    
According to the tutorial I saw, the sub and add of '0' is for conversion between ASCII and decimal... But I understand what you mean though. Please what do you suggest I do?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900