Creating New Devices I Creating New Devices III

Creating New Devices II


Diode

We'll use the following required attributes:

device Diode is
   attr refPrefix = "D";
   attr pkg_type = "th_disc_diode";
end device Diode;

The diode has the following schematic symbol:

As you can see, it has two pins to map, the anode and cathode.

device Diode is
   attr refPrefix = "D";
   attr pkg_type = "th_disc_diode";
   pin k = {1};
   pin a = {2};
end device Diode;

Let's go ahead and give it some more attributes.

device Diode is
   attr refPrefix = "D";
   attr pkg_type = "th_disc_diode";
   attr supplier = "digikey";
   attr cost = "0.16";
   pin k = {1};
   pin a = {2};
end device Diode;

It's always nice where we can find parts after the design flow is complete. Since we put this information into the device declaration, it will show up in a generated bill of materials later, making aquiring parts much simpler.


LED

Let's move onto the LEDs. Obviously we need to assign the refPrefix and footprint.

device LED is
   attr refPrefix = "LED";
   attr pkg_type = "th_disc_led";
end device LED;

And we also need to assign the pins: the cathode and anode, as shown in the image below:

Therefore, the device declaration becomes:

device LED is
   attr refPrefix = "LED";
   attr pkg_type = "th_disc_led";
   pin k = {1};
   pin a = {2};
end device LED;

Now, you may be wondering how you could add a "color" attribute to the LED device, but you want it to be different for each one you instance on the board. Don't worry, these attributes are by no means set in stone; later, when we begin instancing devices, you can add/change attributes for individual device instances. For now, however, we'll just make the attribute and give it a default value.

device LED is
   attr refPrefix = "LED";
   attr pkg_type = "th_disc_led";
   attr color = "red";
   pin k = {1};
   pin a = {2};
end device LED;

And, as with the Diode, we'll put the supplier and cost information about the device in the declaration.

device LED is
   attr refPrefix = "LED";
   attr pkg_type = "th_disc_led";
   attr color = "red";
   attr supplier = "digikey";
   attr cost = "0.48";
   pin k = {1};
   pin a = {2};
end device LED;


BJT

Now we declare the BJT.

device BJT is
   attr refPrefix = "Q";
   attr pkg_type = "th_disc_bjt";
end device BJT;

Now let's take a look at the schematic diagram:

There are three pins to declare, the emitter, the collector, and the base.

device BJT is
   attr refPrefix = "Q";
   attr pkg_type = "th_disc_bjt";
   pin e = {1};
   pin b = {2};
   pin c = {3};
end device BJT;

Now for the supplier and cost information.

device BJT is
   attr refPrefix = "Q";
   attr pkg_type = "th_disc_bjt";
   attr supplier = "Spark Fun";
   attr cost = "0.75";
   pin e = {1};
   pin b = {2};
   pin c = {3};
end device BJT;


Hopefully you're not getting too tired of making devices yet. Don't worry, this won't take much longer. After the next section, you'll learn a way to make this process a lot faster (especially after you have made several devices).

But until then, keep grinding-- the pain will be over soon enough.


Creating New Devices I Creating New Devices III