# Hints and tricks

 Back to MiscEl main page Write a message to author

• Entering kohm/Mohm/pF and other values with si prefixes
• Entering values in Miscel
• An easy way to enter values in inch
• Use inch in fields where the unit is mm
• Getting a small calculator
• Using a hotkey to open and layout the windows
• Doing math on a small microprocessor
• Revers engineer crc for a data block
• Estimate the temperature of a coil/transformer

• ### Entering kohm/Mohm/pF and other values with si prefixes

The MiscEl input fields does not have any selector to select between kilo/mega etc., this is not needed, because the letters can be used directly.
A few examples:
To enter the number 1500, all of the following are valid "1500", "1.5e3", "15e2", "1.5k", "1k5"
To enter the number 0.000033, all of the following are valid "0.000033", "33e-6", "33u", "33000n", "0.033m"
The most common letters used in electronic are:
• G = giga = 1000000000 = 1e9
• M = mega = 1000000 = 1e6 (Beware, upper case/lower case are very different values)
• k = kilo = 1000 = 1e3
• m = milli = 0.001 = 1e-3 (Beware, upper case/lower case are very different values)
• µ = micro = 0.000001 = 1e-6 (This is a bit tricky to type, but "u" can be used instead)
• n = nano = 0.000000001 = 1e-9
• p = pico = 0.000000000001 = 1e-12

### Entering values in Miscel

Nearly all input fields in MiscEl are calculating, i.e. anything that can be used in the calculator can be used in any input field.
Some examples:
• To enter the sqare root of 2 in a field, write "sqrt(2)"
• To enter 800 divided by 2pi, write "800/2/pi"
• To enter 2^8, write "power(2,8)"
It is also possible to define functions or variables in the calculator and then use them in input fields on other pages. A example:
In the Calculator write: "a" then right click and select "Create variable", now "a" must be assigned a value, this is also done in the calculator. Write "a:=6.567*3" and press ENTER.
"a" now has the value 19.701, this can be confirmed by selecting the "Variables" tab in the calculator or by writing "a" and pressing ENTER.
Now "a" can be used as a valid input value in nearly any input field in all the pages in MiscEl.

### An easy way to enter values in inch

When fields are expecting a value in meters your can use the form "inchValue*inch", i.e. to enter 5 inch your type "5*inch" in the input field. If your like to enter value in inch and want to have a bit less typing use the this:
• Open the "Calculator" page
• Write "i"
• Right click and select "Create variable"
• Press the "Variable" button, your can now see the "i", but it has no value
• Write "i:=inch" and press enter, the value of "i" changes to 25.4m
Now your can use "5*i" to enter 5 inch and it works everywhere in MiscEl.
Is is possible to use this kind of unit conversions with many other units (see the Const page in the calculator). Some of the possible values are: yd, mil, mile, ft
Remark: This trick is restricted to fields where your enter the value in meters

### Use inch in fields where the unit is mm

When fields are expecting a value in millimeters your can use the form "inchValue*inch*1000", i.e. to enter 5 inch your type "5*inch*1000" in the input field. If your like to enter value in inch and want to have a bit less typing use the this:
• Open the "Calculator" page
• Write "imm"
• Right click and select "Create variable"
• Press the "Variable" button, your can now see the "imm", but it has no value
• Write "imm:=inch*1000" and press enter, the value of "imm" changes to 25.4
Now your can use "5*imm" to enter 5 inch and it works everywhere in MiscEl.
Remark: This trick is restricted to fields where your enter the value in millimeters

### Getting a small calculator

The size of the MiscEl window is fixed, but some pages can have other sizes. The TinyCalc page is one off them. Place the cursor over the tab and press the left mouse button, then move the mouse with the button pressed and your will pull the TinyCalc out of the MiscEl frame and getting a small calculator, that can be placed anywhere on the screen. All windows can be pulled out, but only a few windows can be resized.

### Using a hotkey to open and layout the windows

MiscEl will remember what windows are open between runs, but it will always place them inside the MiscEl frame. If your want to have some predefined layuts, that can be activated by a keypress, it is time to open the HotKeys page.
The example here is a complex setup, to try it do the following:
• Press the "New" button
• Select the "-- Undef --" entry
• Click in the field that says "none" and press the "F8" key*
• Select the "Function" "Script" option
• Copy the program listed below into the "Function of the hotkey" field
• Press the F8 key and enjoy
*F8 is used in this trick, but any key can be used.

Program:

``` ShowProgramAt(PageWidth,0); ShowPageAt("Fo",0,0); Update; PageSetValue("Fo","PageControl","Analyze"); PageSetValue("Fo","Impedance curve","1"); Update; ShowPageAt("Curve plotter",0,PageHeight); ShowPageFront("Calculator"); ``` Now a press on the F8 key will open 3 windows and move two of them outside the MiscEl frame.

Here is the program again, this time with some explanation:
 `ShowProgramAt(PageWidth,0);` The MiscEl frame is moved to the right and top of the windows screen.PageWidth is the standard width of the MiscEl frame. `ShowPageAt("Fo",0,0);` The "Fo" page is shown at the top left of the windows screen `Update;` Give MiscEl and windows time to do the lines above `PageSetValue("Fo","PageControl","Analyze");` On the "Fo" page select the "Analyze" pagePageControl is the name used for all page selections in MiscElAnalyze is the text on the button to select `PageSetValue("Fo","Impedance curve","1");` On the "Fo" page put a checkmark in the "Impedance curve" checkbox `Update;` Give Miscel and windows time to update, i.e. show the "Curve plotter" page `ShowPageAt("Curve plotter",0,PageHeight);` Place the "Curve Plotter" page just below the "Fo" pagePageHeight is the standard heigth of the MiscEl frame `ShowPageFront("Calculator");` We also wants a "Calculator" in the MiscEl frame, and it must be in front

### Doing math on a small microprocessor

On small microprocessors, it can be difficult to do floating point math. To avoid this, it may be possible to do the math with integer calculations. The Integer Math pages helps with this.
Before doing this examples, check the "Config" page, "Use standard signed bits" and "Use standard unsigned bits" must be checkmarked

Some examples:
A value in the range 0..1023 needs to be multiplied with pi (3.141592654...). To do this with integers we multiply with an integer and then divide with another integer.
Select the "Real to Mult/Div" kind and enter "pi" in the value field. The result shows some possible solutions: 22/7, 179/57, 355/113, 102928/32763, which one to use depends on our number range. We know that that the max. input value is 1023. Checking the "Max. input" result, we can see that for 22/7 and 15 bit, we can accept input numbers up to 1489, i.e. 1023 is inside the range and the calculations can be done with 15 bits (i.e. 16 bit with sign). The maximum error in the calculations will be 402ppm.
If we need better precision, we can use 31 bits (i.e. 32 with sign) with 102928/32763, this allows a maximum input of 20863, and the error will not be more than -1.06e-9

A value in the range 0..1023 needs to be multiplied with pi (3.141592654...). To do this with integers we multiply with an integer and the divide with another integer, this time we want to do it fast, i.e. we do not have time for a divide, but want a shift operation.
Select the "Real to Mult/Div with x/2^n" kind and enter "pi" in the value field. The result shows many possible solutions: 3/1, 13/4, 25/8, 101/32, 201/64, 3217/1024..., which one to use depends on our number range. We know that that the max. input value is 1023. Checking the "Max. input" result, we can see that for 25/8 (/8 is 3 shift right operations) and 15 bit, we can accept input numbers up to 1310, i.e. 1023 is inside the range and the calculations can be done with 15 bits (i.e. 16 bit with sign). The maximum error in the calculations will be -0.53 %.
If we need better precision, we can use 31 bits (i.e. 32 with sign) with 1647099/524288 (/524288 is 2^19, i.e. 19 shift right operations), this allows a maximum input of 1303, and the error will not be more than -0.2 ppm