Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Reconfigure user input variable

Status
Not open for further replies.

shaswat

Advanced Member level 4
Joined
Jul 2, 2013
Messages
115
Helped
1
Reputation
2
Reaction score
1
Trophy points
18
Activity points
963
Hi,

I want to try to find out that is it possible to reconfigure this value into two of others variables.
e.g.
This is the user input value
Code:
0002DECE - 0002E03D
and I want to try to reconfigure it in two variables like
Code:
0002DECE
&
Code:
0002E03D
.

Does C language provide us some sort of function to do it ??

Thanks...
 

Easyrider83

Advanced Member level 5
Joined
Oct 11, 2011
Messages
1,608
Helped
373
Reputation
746
Reaction score
361
Trophy points
1,363
Location
Tallinn, Estonia
Activity points
8,577
0002DECE is 32-bit variable already. Doesn't matter what user enter. It will 32-bit as far, as electricity will supply the circuit. I thinks you do not understand some basic things or I didn't understood what do you mean.
 

shaswat

Advanced Member level 4
Joined
Jul 2, 2013
Messages
115
Helped
1
Reputation
2
Reaction score
1
Trophy points
18
Activity points
963
What about if it's only 16 bit variable?
 

shaswat

Advanced Member level 4
Joined
Jul 2, 2013
Messages
115
Helped
1
Reputation
2
Reaction score
1
Trophy points
18
Activity points
963
Actually what I am trying to do, this is the code memory allocated size by the module/function written in my project. Now what I have to do, I have to check out that how much amount of memory is been using by EACH function. So as its a lengthy and hectic work, I am thinking to just write a simple program so that I just entered the code size value like (0002DECE - 0002E03D) and it will tell me the exact memory usage of modules (e.g. in this case 16F).
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,361
Helped
4,724
Reputation
9,463
Reaction score
4,492
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
122,540
It's unclear what you are asking. Do you mean you want the text entered literally as "0002DECE - 0002E03D" to be converted into the calculation 0002DECE minus 0002E03D so you get the difference between them? The result of the calculation is negative so how do you want to handle that?

If you are simply looking for the address range occupied by a function, give it labels in it's start and end in your source code and subtract the labels.

Brian.
 

shaswat

Advanced Member level 4
Joined
Jul 2, 2013
Messages
115
Helped
1
Reputation
2
Reaction score
1
Trophy points
18
Activity points
963
Yes, this is exactly what I want but here with a slight difference. I know that the result will have some negative values, so I want to subtract from the last value to the first one. Means 0002E03D - 0002DECE. With this, I am able to find out exactly the value which I want.

I already found out the address range and yes this is the one of the example of one of my function address range. Instead of checking manually and hence time-consuming, I want to create an exe file in which I just enter the address range (as a user) and it will tell the exact segmentation usage bytes (367 in dec in this case).
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,361
Helped
4,724
Reputation
9,463
Reaction score
4,492
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
122,540
I can't help with the GUI but the principle will be:

1. input the two numbers as A and B
2. if (A > B) {C = B; B = A; A = C;} // swap so the bigger is B
3. result is B - A

make all the variables 'unsigned long' types.

If you use the Windows calculator, set it to scientific, hex mode. Do the subtraction, if the result starts with FF, press the +/- button. Select Decimal if needed.

Brian.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top