GAL16V8 :2- Latches, SR Latch

Today we will explore the basic of SR Latch and how to build one with a GAL16V8.

The wikipedia definition of a latch is ” a circuit that has two stable states and can be used to store state information“.

The latch we want to implement today is the SR LATCH with two nor gates. the circuit is as follows.

Image result for sr latch

This latch have two inputs, Set (S) and Reset (r), and two exits, Q, which is the stored state, and !Q, which is the inverse of the stored state. Easy.

The truth table of this circuit is as follows.

Truth table of SD Latch

As we can see, as long as only one of either Set or Reset is on, the Q output will store the value of Set.

Note that when Set and Reset are off, Q and !Q keep their values, that is where the storage property comes in.
Also in this specific latch made out of NOR gates, when both Set and Reset are ON both Q and !Q are disabled, thus both are 0, this is an unstable state and the end value of Q and !Q when both Set and Reset are OFF again will be a race condition on which one is set last.

Now How will this looks in CUPL code? Well, we only need to define the following two equations.

Q = !(R # QN);
QN = !(S # Q);

As you can see, we are only describing the inputs of the NOR gates here, in the CUPL file it will look similar to this.

Name SRLATCH;
partNo 00;
Date 16/06/2016;
Revision 01;
Designer Esteban;
Company estebon;
Assembly None;
Location None;
Device g16v8ms;

PIN 2 = R;
PIN 3 = S;

PIN 12 = Q;
PIN 13 = QN;

Q = !(R # QN);
QN = !(S # Q);

Now we burn our gal and wire as follows. See the Make it blink tutorial on how to program our gal.

Wiring of SR Latch

And finally we can test it, Notice how the output led match the button pressed.

SR Latch with GAL16V8

That is all on this, hope you find it useful.

GAL16v8 :1- Jumpstarting, I want my gal to do something now!

Well, you can’t hahahah. just kidding.

This is a quick guide and I am assuming you can understand some basic boolean logic.

First you need 3 things:

1- A GAL16V8 of course. From EBAY? Sure.

https://www.ebay.com/itm/10PCS-IC-LATTICE-DIP-20-GAL16V8D-15LP/162777611072?hash=item25e64d3b40:g:uTUAAOSwy~BaHNPZ

2- A GAL programmer, from our chinese friends. This is the one I bought and seems to work fine so far and is kind of cheap.

https://www.amazon.com/Genius-Universal-Programmer-EPROM-FLeASH/dp/B075TGDDJM

3- winCUPL, you can get it from here

https://www.microchip.com/design-centers/programmable-logic/spld-cpld/tools/software/wincupl

Fine, you installed all and got all the items. so what are we going to create? Well in this example we will create a pass thru and an inverter. basically a circuit like the following.

This is a circuit that have one Input, in leg 2 and two outputs, which is passthru in leg 12 and the negation operation in leg 13.

those follow the next boolean table

InputOutputOutput_Inverse
001
110

We are going to program this configuration with CUPL language using WinCUPL as follows.


Now Lets compile it using the Device Dependent Compile button, which will use the device specified in the Device tag, in this case g16v8 to create a jed file.

Success, now we will use the software that should have been included with your G540 Programmer as follows.

The next window will open and as long as it looks like this it should be good. just click ok.

Next step is to select your device, which if you bought the lattice gal GAL16V8D should be like this. First click the Select button and look for the device.

Finally, the programming window appear, place your gal in the programmer, (check that your programmer is conected to the pc) . Ensure the notch is in the correct direction and that the gal is placed at the base like this.

Then click Prog button and hopefully it will work.

Now Prepare a breadboard like this.

And test :3

the schematic is like this.

NOTES:

  • Resistor is 220 ohms
  • voltage is 5v, from an arduino :), bt any 5v source will do.
  • I didn’t put resistors in my LEDs but they may be needed ?

So this is the basic guide, I skip how to install the software, but hope it helps you to jumpstart into gals, I will explain more in detail in future post about this old and forgotten world of PLA (Programable logic Arrays) which GAL is part of :).

GAL 16V8 References :)

Have you decided you want to learn to code in gal but don’t know where to start. Well welcome, this page won’t explain a thing but here are nice links you can follow in your quest.

Good CUPL Language reference Guide http://ee-classes.usc.edu/ee459/library/documents/CUPL_Reference.pdf

GAL16V8 DataSheet http://ee-classes.usc.edu/ee459/library/datasheets/16v8.pdf

The cheap gal programmer I bought, I have tried with GAL 16V8 from Lattice and works fine so far. https://www.amazon.com/Genius-Universal-Programmer-EPROM-FLASH/dp/B075TGDDJM

Where to download winCUPL “for windows” with bugs, but is free. https://www.microchip.com/design-centers/programmable-logic/spld-cpld/tools/software/wincupl

Pastel de tres leches, 3 Milk cake

For English version, just scroll down.

Hoy traigo la receta para hacer pastel de tres leches 🙂

La lista de ingredientes es la siguiente

2 tazas de harina

1 barra de mantequilla

1/2 tazas de azucar

7 huevos

1/2 taza de leche

1/4 taza de agua

4 cucharadas de royal

2 latas de leche evaporada

3 latas de leche condensada lechera

500 g de crema

Media taza de brandy

Instrucciones para preparación

Romper los huevos y poner la clara (cosa transparente del huevo) en un contenedor aparte.

Capear la clara, (batirla con la batidora hasta que se haga espuma).

Mezclar en un tazon grande, la yema (cosa amarilla del huevo), harina, azúcar. Royal, mantequilla (yo la derrito en el horno de microondas pero no es necesario), leche, agua.

Mezclar todo y agregar la clara batida.

Seguir mezclando.

Calentar el horno a 176 grados centigrados. Hornear el pastel por 35 minutos.

En la licuadora mezclar la Leche clavel (leche evaporada) , lechera (leche condensada endulzada), la crema y el brandy.

Sacar el pastel del horno después de 35 minutos, dejar enfriar ponerle la mezcla de leches, y decorar al gusto 🙂

English version

Ingredients

2 cups of flour

1 bar of butter (1/2) cup

1/2 cups of sugar

7 eggs

1/2 cups whole milk (or whatever milk you like, I guess anything will do)

1/4 cups of water

4 tb spoon of baking powder

500 grams of sour cream

2 cans of condensed milk

2 cans of evaporated sweetened milk

1/2 cups of brandy

Preparation

Separate the eggs white and yolk, and foam the egg white with the mixer.

The mix in a container the flour, butter, sugar, egg yolk and white, milk, water and baking power.

Bake at 350 F for 35 mins

then in the blender and in a separate container mix the condensed milk, evaporated milk, sour cream and brandy.

When the cake finish baking take it out of the oven, let it cool down and then proceed to pour the milk, cream and brandy mix into it, wait a couple of hours for the bread of the cake to suck the milk/brandy mix and presto.

Finally eat the whole cake in one weekend and regret it on Monday.

One plus 5 dual lte Sim dual ATT

So if you found yourself locked out due to att disabling 2g in their network (in the US) and now you find that your dual Sim phone can only have one Sim working at a time, you may be looking for a solution, or a phone that can enable both Sims simultaneously again. 
So you probably have found the one plus one and wonder if this will serve for the purpose of having dual lte Sim enabled at the same time. 

The short answer is yes :), one plus 5 works with dual att Sims,  go for it. 

The long answer may start with, why is my current phone not able to work with dual lte Sims, what is the point of dual Sims then, or why did the manufacturer of the phone, in my case one plus, build it without the capability of dual lte. The answer is actually, is not a mistake from  the phone manufacturer, but rather from the soc manufacturer, (normally qualcomm). 
So the piece of hardware that can not handle dual lte is the soc (system on chip) which in mobile phones is the mind and heart of the phone, commonly containing graphic card, processor, storage controller and wireless connectivity (Bluetooth, lte, wifi). 

With that in mind, one plus two have a snapdragon 810, this model of chipset does not support dual lte Sim, On the other side, one plus 5 have a snapdragon 835, which does support dual lte Sim. 

Why is so hard to found if will it work? In part because there is a lot of confusion, from phone manufacturers and even within chipset manufacturers. Qualcomm documentation shows that both snapdragon 810 and 835 are lte dual active chipsets, but that is not true. 

I can not stand for any other phone other than one plus 5 because that is the only one I have tried, but I presume that any dual Sim phone that have a snapdragon 835 inside should work with dual lte Sims (dual att Sims in the US for example). 

Building a page in FABLE

Here is a fast video of a page of my tale being created in FABLE, The video is speed up 64x. Also I show to you the texture result that comes from the publish of this exercise as well as a video containing the end result. Next post I will talk about how to make it work on ios.

Fast creation.

Textures generated

second images

Result

 

Download the latest version from the official site

http://www.estebon.mx/fable

http://www.freefable.com

Fire Ant Box2d Level Editor feature texture optimizations

As many of us know, when the time comes to reduce the size of our applications the first thing that comes to our minds is textures, textures usually takes the biggest part in games or rich interactive applications.

Taking this into account, FABLE have a series of heuristics aimed to reduce the size of the textures, by resizing them, rotating them and so.

For example, lets take a look at the next group of elements for a page of my book. This elements are with the size that the artist sent to m. As you may guess, In the final version the flowers should be smaller than the cat and the window should fit the window in the background. But this is what I got, very big and highly detailed images for my page, which is cool. This image is scaled, the original size is 7023 x 8122.

Untitled-1

The next image is a screenshot of the page finished in the program, at the end, this page should look like this.

Untitled

Now comes some of the nice feature of the program, as you  may remember from the last post, Automatic splitting tool, the program takes care of importing and splitting the images so that is painless for the user, so you got this result very fast. Then you are ready to test it in you ipad project so you would be likely to click on publish. this action generates the following couple of files.

Untitled3

There is the classes for ipad and the textures, as you may see, the texture atlas looks way different from the original thing. next we can see it more neat.

NonRetina_pagina2_0

We can see that the flowers have a size that makes sense and everything seems to keep an aspect ratio. This texture was generated by the program automatically. Also we can see more optimizations. for example the program can rotate the images to a position where they reduce the amount of white space. Let’s take the example of the window, in the original image, the window was rotated in a diagonal way that makes it waste a  lot of space, in this version the program gets aware of that and rotate it to stay vertical so that it saves more space. This rotating technique can save between 10 an 15% of space.  BTW the size of the texture for retina display is 1024×1024. It is 57 times smaller than the first image I showed to you.

Here is a video of the page in the program

And here an example of the page running on ios simulator.

Thanks.

Download the latest version from the official site

http://www.estebon.mx/fable

http://www.freefable.com

Fire Ant Box2d Level Editor Introduction

Hi there, here is a very beloved piece of software in which I have been working lately. So, what exactly is Fire Ant Box2d Level Editor, FABLE for short.

Well as the name says, FABLE is a Box2D Level Editor, It gives you a GUI in which to develop Box2D environments, It is useful for building small Sketch’s as is useful for building full levels. Some of the features on the box are, the capability not only to build the physics environment, but also the ability to map the textures to each body. the tool is also capable of generating optimized texture atlas.

The develop environment currently supports a lot of user experience features as is as the Copy Paste capability, the undo redo stack, load and save files and the capability of exporting a XML file with the definition of the world and also objective C code for use in IOS projects.

As for the development tools it contains specific tools to create joints, bodies and fixtures, it contains a tool to create irregular polygons for both bodies and fixtures, it can handle all of the features of Box2D like collision levels and masks, densities, frictions, damping frequencies (for some joints like distance joints), motors, torque, angles, limits, and so on and so for.

It also contains playback controls for test the current environment and also for change the original environment state.

Another great feature is that for textures it can handle Layers, so you can distribute objects among layers, this is specially useful for levels that have more than one interaction layer or simply to handle in a better way the elements on the screen.

Here is a small screenshot of the GUI with some explanations.

image

Yes I know, the buttons are horrible, I drew them by myself Smile with tongue out.

Here you can see a bit of the functionality in this video, narrated with my melodious voice Open-mouthed smile.

FABLE Demo One

Well, that is everything for now, I’ll be publishing new entries with more small tutorials and also more new features to the program cheers and here is the link to the program.

Box2dLevelEditor Download

Also visit the new official site

http://www.estebon.mx/fable

http://www.freefable.com

And here are the FABLE file and the images just in case you want to try it by yourself.’’

http://estebon.mx/fireant/FableDemoOneData.zip

http://estebon.mx/fireant/FableDemoOneFile.ble

Let me know if it was useful to you