The page is is a test bench for the symbols in the Miscellaneous Logic library. The selectors provide the user with all possible options for each and every symbol. But note that, all options do not apply to all symbols.
This page can also be used when you are drawing a logic schematic that contains the Miscellaneous logic family. Once you get the symbol you want in the test area, and adjusted with the proper annotation, the complete instance is available below the selection area. This code can then be inserted directly into your drawing script. There will be a few things, like the Drawing Object and Symbol Coordinates, that need changing. But the rest can just be used as is.
This is not a comprehensive library of the Miscellaneous logic devices. Devices are only added as I find a need for them. For information on how to add a symbol to th library, see the section at the botton of this page labeled Adding a Symbol to the Logic Library
Miscellaneous Logic Symbols |
Description: This function draws the specified logic device centered at point Lib_L_Center_X, Lib_L_Center_Y. Most logic devices contain multiple instances of a particular logic function, so the Device Section selector below will change dynamically based on which device is selected. Power and Ground connections are considered a separate Device Section.
The Device Option input is a logical OR
of:
Lib_L_Normal (110) | Lib_L_DeMorgan (210),
Lib_L_Right (410) | Lib_L_Left (810)
| Lib_L_NoSwap (1610) | Lib_L_Swap (3210)
Lib_L_None (6410) | Lib_L_S (12810)
| Lib_L_LS (25610) | Lib_L_F (51210) | Lib_L_HC (102410) | Lib_L_HCT (204810).
For example, to create an Option_Val to pass to the
calling routine for the "DeMorgan Equivalent of a
LS device pointing to the Left",
you would use:
var Option_Val = Lib_L_DeMorgan | Lib_L_Left | Lib_L_LS; // = 2 + 4 + 16 + 128 = 150.
Don't use quotes and only include the information in blue. The ordering of the
options is unimportant. The actual values are defined
in js_Symbols/Logic.js.
Notes:
- Currently, the destinction between Lib_L_Right and Lib_L_Left, only exist for gates. Higher Level logic devices, like Flip-Flops, can only be drawn to the Right.
- Not all logic devices have DeMorgan Equivalents.
- Not all logic devices have S/LS/F/HC/HCT Equivalents.
- Pin Order, below, only applies to gates with 3, or more, inputs, e.g. the 7410 has 3 inputs and 6 different pin permeations, the 7420 has 4 inputs and 24 different pin permeations.
- Use of this symbol library requires the inclusion of the "js_Symbols/Logic.js" and "js_Symbols/jsDraw2D.js" drawing libraries.
Test Bench |
Parameter | Description | Example | |
---|---|---|---|
Dwg_Obj | jsGraphics Object that points to the drawing. |
0 10 30 50 70 90 110 140 170 200 320 300 280 260 240 220 200 180 160 140 120 100 80 60 40 2 3 SN75188 U1 A |
|
Lib_L_RefDes | Reference Designator ("U1", "U2", etc.) quoted string. | ||
Lib_L_Dev | Device Name ("7400", "7402", etc.) quoted sting. OC = Open Collector. | ||
Lib_L_Option |
Pin Order
|
||
Lib_L_Sect | |||
Lib_L_RC | For MC8602 Mono-Stable Only
→ R-Refdes
R-Value
C-Refdes
C-Value
|
||
Center_X | Symbol Center X Position |
Show/Hide Grid (10x10), Center Mark (Orange), Pins (purple dot). |
|
Center_Y | Symbol Center Y Position |
Return: The draw function will return, in an array, the X and Y points for each of the displayed pins. This can be different depending on which logic device is specified. For example, the "7400" would return the X,Y points for the two input pins (In1 and In2) and one output pin (Out). The "7474" would return the X,Y points for D, Clk, Set, Clr, Q, and Q-Bar.
Return points are always ordered the same. Starting at the Top-Left of the symbol and working from Top to Bottom, Left to Right. For example, the return points for the "7476" would be ordered:
Usage: The selections from the table above, are used to create the example below. After selecting and entering your specific information, the example can be used directly, with a copy/paste. The items in Red are the only ones that need to be adjusted to your specific needs. The lines in Green are just comments and can be deleted. Due to space limitations, some of the lines below may be split onto more than one line.
U1A_Option_Val = Lib_Misc_Normal | Lib_Misc_Right | Lib_Misc_NoSwap;
U1A_Rtn = Misc_Logic( Dwg_Obj, "75188", U1A_Option_Val, "U1", "A", Start_X, Start_Y );
U1A_In_X = U1A_Rtn[0]; U1A_In_Y = U1A_Rtn[1]; U1A_Out_X = U1A_Rtn[2]; U1A_Out_Y = U1A_Rtn[3];
Fixes Required for the Misc Library |
These are items that are still outstanding in the Misc Library. When they are fixed, they will be marked. Some of these items are for obsolete parts and are not a priority.
- The Left facing MC724P - Quad 2-Input NOR Gate is incorrect. For Normal, the line is missing. For Demorgan, the bubble and line are missing.
- The MC792P - Triple 3-Input NOR Gate does not work.
- Need to add a MC789 - Hex Inverter.
- The MC3001 - Quad 2-Input AND gate Left and Swap do not work together.
- The MC3459 - Quad 2-Input NAND Gate does not exist.
- The MC8602 - Dual Retriggerable Monostable does not show R and C and only shows one body. Needs two bodies. Instantiation code does not have the return values. Needs Lib_L_Option removed.
- The IS1XX LED Displays need rotated versions.
- The NE555 does not generate the correct instantiation code. This has been corrected.
- The MC1488, MC1489, SN75188, SN75189 Pin Swapping and DeMorgan Equivalent are not implemented.
Adding a Symbol to the Logic Library |
Adding a symbol to the logic library is a relatively complex operation. So this section is not only for those who are interested in my method of drawing. It is also for me. I don't always remember all the steps necessary to add a symbol. So this makes sure I cover all the necessary areas. I am actually writing this as I am adding some symbols.
The symbol library is driven by the requirements for logic symbol generation. Each time you add a symbol, you are not just adding a picture. Each logic symbol is a dynamic drawing with pin numbers, device name, and lable added, based on selections made when calling the symbol. When a symbol is being drawn, the symbol options must be deciphered. Normally, these options are passed to the symbol library from the instantiation in the drawing script. What complicates the symbol even more is that the X and Y coordinates of each symbol pin are returned from the symbol instantiation. This is an aid when wiring from symbol to symbol.
Often, adding a symbol is quick and easy, if the symbol already matches and existing symbol. For example, a SN7400 and a CD4011 are both Quad 2-Input NAND Gate packages. They may be different technologies, and their pin numbers may differ, but the basic symbol is the same. You then only have to account for different pin numbers.
Line numbers in the Javascript and HTML code will not be listed because, the line numbers continue to change as you add symbols.
Below are the three files that need to be modified, when adding a logic device. They are listed in the order that they should be modified.
- Logic.js - This is the file that is linked to, in any HTML
file that requires a schematic diagram. The other two files below, are support files for
testing and verifying any logic symbol created.
- Add a Logic Device Array. At the beginning of the Javascript file are the Logic Device Arrays. Every logic symbol requires one of these arrays. Associated with each array is a comment that describes the content of the array. The ordering of the array elements is important. The array starts with Device Name. Each Device Name is prefixed with "U", e.g U7400. The "U" is arbitrary and is only used because variable names that start with numbers are not allowed. This is followed by the numeric Type. That is followed by the "Number Of Pins". This is important because it defines the next series of array elements. Overall, each array can only have "Number Of Pins", plus 3, entries.
- Adjust the function "Make_Part_Name". This function takes care of adding a prefix to the beginning of a symbol name. I the symbol being added is part of an already existing group (e.g. 74xx or 40xx) there is nothing to be changed.
- Adjust the function "Logic_Gate". This function does most of
the work and is used by every symbol in the library. There are two sections to this function.
- The first section, starting with "if ( Lib_L_Sect == "PWR" )" is for drawing the Power/Ground symbol for each symbol. Most of the logic parts only require a single power pin (VCC) and a single ground pin (GND). Only if there are more than two power and ground connections, or you want the standard power and ground connections connections to says something other then VCC/GND, should anything need to be added.
- The second section starts at the end of the PWR section. It contains a "if" statement for each symbol in the library. Each of these "if" statements then contain multiple "if" statements, to decipher the specifications in the drawing command. In many cases, the "if" statement can contain several device names. This happens when the the same logic symbol is used for multiple devices. If the new symbol matches an symbol that already exists just add the symbol name to the "if" statement and your done with this file.
- Logic_Samples.js - This file is responsible for drawing the test symbol. All of the selections from Logic.html are passed to this file to draw the symbol. This file must decode the selections and and pass them on to the symbol drawing file, Logic.js.
- Logic.html - This is the file you are now reading. The reason it exists is to provide a test area for all the available symbols. Every available symbol can be selected and viewed. And, all of the available symbol options can be applied.
Physical |
Description:
Parameter | Description | Example | |
---|---|---|---|
Lib_S_Dwg_Obj | jsGraphics Object that points to the drawing. |
0 10 30 50 70 90 110 140 170 320 300 280 260 240 220 200 180 160 140 120 100 80 60 40 U10 SN7410 |
|
Lib_P_RefDes | Select the RefDes or enter your own. || Other: |
||
Lib_P_RefDes_Loc | Select the RefDes Location. Over Under Left Right Body | ||
Lib_P_Name | Enter the device Name: | ||
Lib_P_Name_Loc | Select the Name location. Over Under Left Right | ||
Lib_P_Type | Device Type ("Dip-8", "Dip-14", etc.) quoted sting. | ||
Lib_P_Rot (CCW) | Device Rotation (0, 90, 180, 270). | ||
Lib_P_Start_X | Symbol Start X Position |
Show/Hide Grid (10x10), Center Mark (Orange), Pins (purple dot). |
|
Lib_P_Start_Y | Symbol Start Y Position |
Return: Nothing to return.
Usage:
U10_Rtn = Physical( Dwg_Obj, "U10", "Over", "SN7410", "Under", "D14", 0, U10_Center_X, U10_Center_Y );
U10P1_X = U10_Rtn[0]; U10P1_Y = U10_Rtn[1]; U10P2_X = U10_Rtn[2]; U10P2_Y = U10_Rtn[3];
U10P3_X = U10_Rtn[4]; U10P3_Y = U10_Rtn[5]; U10P4_X = U10_Rtn[6]; U10P4_Y = U10_Rtn[7];
U10P5_X = U10_Rtn[8]; U10P5_Y = U10_Rtn[9]; U10P6_X = U10_Rtn[10]; U10P6_Y = U10_Rtn[11];
U10P9_X = U10_Rtn[16]; U10P9_Y = U10_Rtn[17]; U10P10_X = U10_Rtn[18]; U10P10_Y = U10_Rtn[19];
U10P11_X = U10_Rtn[20]; U10P11_Y = U10_Rtn[21]; U10P12_X = U10_Rtn[22]; U10P12_Y = U10_Rtn[23];
U10P13_X = U10_Rtn[24]; U10P13_Y = U10_Rtn[25]; U10P14_X = U10_Rtn[26]; U10P14_Y = U10_Rtn[27];
MAX232 - RS232 to TTL/CMOS Interface |
Parameter | Description | Example | |
---|---|---|---|
Lib_S_Dwg_Obj | jsGraphics Object that points to the drawing. |
0 10 30 50 70 90 110 140 170 320 300 280 260 240 220 200 180 160 140 120 100 80 60 40 C1+ C1- VS+ C2+ C2- VS- RS232 - TTL T1 T1 T2 T2 R1 R1 R2 R2 1 3 2 4 5 6 14 11 7 10 13 12 8 9 MAX232 U1 |
|
Lib_S_RefDes | Reference Designator in quotes. | Select from the dropdown menu or enter your own. || Other: |
|
Lib_L_Option | Display Option |
Right || Left:
Body || Power: |
|
Lib_S_Start_X | Symbol Start X Position |
Show/Hide Grid (10x10), Center Mark (Orange), Pins (purple dot). |
|
Lib_S_Start_Y | Symbol Start Y Position |
Return:
Usage: The selections from the table above, are used to create the example below. After selecting and entering your specific information, the example can be used directly, with a copy/paste. The items in Red are the only ones that need to be adjusted to your specific needs. The lines in Green are just comments and can be deleted. Due to space limitations, some of the lines below may be split onto more than one line.
U1_Rtn = MAX232( Dwg_Obj, "U1", "Left", "Body", U1_Center_X, U1_Center_Y );
U1_C1P_X = U1_Rtn[0]; C1P_Y = U1_Rtn[1]; C1N_X = U1_Rtn[2]; C1N_Y = U1_Rtn[3];
U1_VSP_X = U1_Rtn[4]; VSP_Y = U1_Rtn[5]; C2P_X = U1_Rtn[6]; C2P_Y = U1_Rtn[7];
U1_C2N_X = U1_Rtn[8]; C2N_Y = U1_Rtn[9]; VSN_X = U1_Rtn[10]; VSN_Y = U1_Rtn[11];
U1_T1In_X = U1_Rtn[12]; T1In_Y = U1_Rtn[13]; T1Out_X = U1_Rtn[14]; T1Out_Y = U1_Rtn[15];
U1_T2In_X = U1_Rtn[16]; T2In_Y = U1_Rtn[17]; T2Out_X = U1_Rtn[18]; T2Out_Y = U1_Rtn[19];
U1_R1In_X = U1_Rtn[20]; R1In_Y = U1_Rtn[21]; R1Out_X = U1_Rtn[22]; R1Out_Y = U1_Rtn[23];
U1_R2In_X = U1_Rtn[24]; R2In_Y = U1_Rtn[25]; R2Out_X = U1_Rtn[26]; R2Out_Y = U1_Rtn[27];
- Annotation - Pin Numbers, Reference Designator, Device and Technology are 11px.
- Inversion Bubbles - 10 px diameter.
- Open Collector Output - Diamond with underscore on body.
- Buffers and Inverters - 50 px wide (Right facing -20, +30), 50 px wide (Left facing -30, +20)
- Gates - 70 px wide (-30, +40)