Building a Hexadecimal Display using AHDL

qgc18e0000001qdf

Here is the code for a Binary-to-Hexadecimal Decoder for seven-segment displays implemented on Altera’s Hardware Decription Language (AHDL), the language for building logic blocks inside Altera’s Quartus II.

An optional invert input (named N) is provided to invert the decoder outputs, which is often necessary if you plan to emulate your device using a FPGA and it happens to have its output display with inverted logic activation. This code also serves as a example on how to program a logic function by using its truth table directly in AHDL.

To use this code in your Quartus II project, open up your project, then click

“File -> New”,

choose “AHDL File”, copy and paste this code and then click

“File -> Create / Update -> Create Symbol Files for Current File”

to create its symbol file. After that, you may add the decoder to your schematics as if you were adding a common component to your circuit using the Symbol Tool dialog. The symbol should be located under the Project library.

For more information about using AHDL and Quartus, you may read this guide, Using AHDL in the Quartus II Software. There is a lot of other resources available online teaching how to use Quartus II out there. Some of them can be found on the following links:



Altera, The Programmable Solutions Company, the stylized Altera logo,
specific device designations, and all other words that are identified
as trademarks and/or service marks are, unless noted otherwise, the
trademarks and service marks of
Altera Corporation in the U.S. and
other countries. Other linked content from here are copyrighted from its respective owners. The AHDL code provided above belongs to the
public domain.

Wireless energy made true at the IDF2008

tesla-wardenclyffe-tower-shot
“Something like this technology could be embedded in tables and work surfaces, so as soon as you put down an appropriately equipped device it would immediately begin drawing power.”

Images taken from the Intel Developer Forum 2008, the event where the wireless power technology was showcased, along with additional information about the topic are available here, here and here.

The system, called a “wireless resonant energy link“, transmits energy through strongly coupled resonators, much like how a singer can shatter glass singing at the same particular resonance frequency of the target material.

But frankly, like someone pointed out, I would too think twice before standing on the same room as that transmitter while it is doing its magic. What could possibly (and unnoticeably) happen if you somehow get inbetween those daunting antennas?

And just in case you are wondering what the picture on the top right is all about, it is an artistic representation of the Wardenclyffe Tower, a wireless eletricity demonstration tower that Nikola Tesla began building in 1901, but which was never completed. Could at least a tiny fraction of Tesla‘s dreams finally come true with some efforts from a chip maker company?

Lojas de Componentes Eletrônicos em São Carlos

transistor2
Adoro o Google.

Hoje, enquanto observava no Google Analytics o que as pessoas estavam procurando no Google quando caiam nesse blog, encontrei alguém procurando pelas keywords são carlos componentes eletrônicos. Bem, sei que esta pessoa poderia estar procurando por qualquer outro tipo de coisa, mas esta query me fez perceber que são poucos os lugares listando lojas do gênero da região. Pois bem, aqui está uma curta referência às lojas onde geralmente compramos componentes aqui na cidade de São Carlos:

Eletrônica Pinhé
Rua General Osório, 67, São Carlos-SP
Fone: (16) 3372-7207 Site: http://www.pinhe.com.br/

Para quem está ruim de mapa, fica perto da Estação Ferroviária. Se quiser ir de ônibus, pegue qualquer um que pare na Praça da Estação, procure a Rua General Osório e suba, passando pela linha do trem. Mudaram de endereço recentemente, e não tenho certeza se este endereço é o antigo ou o mais atual. De qualquer modo, o novo endereço é apenas alguns metros adiante do antigo.

CaAndMa
Av. Grécia, 700, São Carlos-SP
Fone: (16) 3375-7778

Ótima loja de componentes eletrônicos, acho que é a mais completa por aqui. A única coisa que atrapalha é a localização, e não tenho conhecimento dos ônibus que passam ali por perto. Componentes ativos, passivos, microcontroladores, telas lcd, enclosures, conectores, cabos… Infelizmente, perdi a nota fiscal com endereço e telefone e estou sem uma lista telefônica para buscá-la novamente. Fica de esquina com a Rua Henrique Grégori, na Vila Prado.

Eletrônica Gaspar
Av. São Carlos, 2615, São Carlos-SP
Fone: (16) 3371-4014 / 3371-3412

Não é exatamente uma loja de componentes eletrônicos, mas possui vários tipos de conectores, inclusive o plug P1 stereo que não encontrava em nenhum lugar. Não sei se trabalham com componentes eletrônicos propriamente ditos, é melhor telefonar antes e perguntar.

Universidade Federal de São Carlos
Departamento de Computação

Se você é aluno da federal e precisa de alguns poucos componentes para algum projeto acadêmico, vá até o Departamento de Computação e converse com algum funcionário, explique seu projeto e veja se eles não podem fornecer alguns para você. Mas não abuse. Provavelmente a USP São Carlos, vulgo CAASO (argh!) pode ter uma oferta semelhante, mas não pude confirmar.

PS: Além destas, num próximo post listarei as principais lojas virtuais de componentes eletrônicos nas quais comprei e tenho confiança, e colocarei o link para o post aqui.

The Art of Electronics

art-of-electronics

Apesar de sua última edição ter sido escrita em 1989, o livro The Art of Electronics ainda continua como um dos mais populares da área. Tendo como principal audiência estudantes de graduação, hobbistas, inventores e experimentadores, assume um tom leve e informal, tornando sua leitura mais acessível e agradável, sendo ao mesmo tempo bastante denso na quantidade de informação que possui.

O interessante deste livro é que ele não pressupõe do leitor um conhecimento prévio em cálculo, sendo porém muito mais aproveitoso se o leitor o possuir.

Este livro está disponível na biblioteca comunitária da Universidade Federal de São Carlos, no piso 3 (Direita – Bloco 2, Estante G621.381 / H816a.2).

Para quem deseja realmente aprender eletrônica utilizando este livro, não se pode deixar de lado o Student Manual for The Art of Electronics, guia com exercícios, experimentos e textos explicativos direcionado ao estudante, expandindo o livro original.

HOROWITZ, Paul; HILL, Winfield. The art of electronics. 2 ed. Cambridge: Cambridge University Press, 1989. 1125 p. www.artofelectronics.com.

HOROWITZ, Paul; HAYES, Thomas. Student Manual for The Art of Electronics; Cambridge: Cambridge University Press, 1989. 614p.

Partes destes livros estão disponíveis eletronicamente e podem ser consultadas pela Amazon ou pelo Google Books. O livro original custa cerca de R$220 na Livraria Cultura, enquanto o Student Manual, cerca de R$110. Nem preciso dizer que, apesar de excelente, recomendo muito mais alugar do que comprar este livro devido ao seu preço proibitivo.

Configuring WinPic800

WinPic800 is a free (as in beer) PIC programmer software compatible with the Tait-style of hardware programmers. In addition, it is also compatible with the programmer I detailed in my last post.

However, due to the variety of styles and designs of the same programmer out in the web, one has to carefully configure soft programmers so they can talk with a hardware device. To configure WinPic800 to work with the parallel schmitt trigger programmer, please follow this instructions:

  • Download the latest version of WinPic800
  • Download the hardware definition file for this device
  • Locate the directory where you installed WinPic800
  • Put the downloaded .hwp file inside the Hardware folder
  • Open WinPic800, go to Devices > Settings > Hardware
  • Select the Tait Schmitt device entry and click OK

Now you may plug the hardware on the parallel port, insert a PIC on the programmer, turn it on and then click on Device > Detect Device. The name of the microcontroller on the programmers socket should be shown on screen.

Componentes eletrônicos grátis!

D1290-Free-Beer-Posters


Sabia que a maioria das empresas fabricantes de componentes eletrônicos disponibiliza amostras grátis de seus produtos ao mundo inteiro, incluindo ao Brasil? Gratuitas mesmo, pagam tudo, os componentes, os impostos e todo o frete até sua casa.

Alguns dos fabricantes que disponbilizam este recurso e que entregam no Brasil são a Intersil, Analog Devices, Linear Technology, National Semiconductors e a Maxim. A Maxim, no entanto, cobra o valor do sedex do escritório deles em São Paulo até sua casa. O restante é por conta deles, o que não é um mau negócio, já que os componentes da Maxim são bastante difíceis de se encontrar no Brasil, principalmente sua linha de conversores DC-DC, que podem chegar a preços ridiculosamente altos, inviabilizando qualquer projeto de garagem.

Para conseguir as amostras, no entanto, é preciso falar a verdade; você terá mais chances de receber seu pedido em casa se informar a empresa onde trabalha (caso possa pedir em nome dela), a universidade onde estuda (caso seja estudante) ou indicar se é apenas hobbista na área. É interessante dar detalhes sobre seu projeto também, pois os fabricantes não são bobos para dar componentes de graça para qualquer um. A esperança deles é que seu protótipo um dia alcance a linha de produção e aí sim eles possam faturar horrores vendendo grandes lotes de componentes para a fábrica que decidir produzir seu projeto.

Ah, e para quem gostou do assunto, além de componentes eletrônicos, há muito mais coisas disponíveis de graça que podem ser solicitadas via internet por aí. Sites e blogs interessantes se destinam unicamente a divulgar este tipo de novidade, como o AmostrasGratis.org, e o Freebies Blog. O Google, nessa hora, também é seu amigo.

Battery-Powered Parallel PIC Programmer

744px-Microchip_logo.svg_

For those who don’t know, PICs are essentialy tiny computers, with built-in internal memory, processor, input/output controllers, comparators and other peripherals packaged inside a single silicon chip.

744px-Microchip_logo.svg Last year, on the Microsoft Academic Cell for Robotics of the Federal University of São Carlos, I needed something to introduce our members to the eletronics world. So we decided to begin by using Microchip‘s PICmicro microcontrollers to build simple but functional circuits, a nice way to gather knowledge ranging from basic analog electronics to low-level microcontroller programming in the same time, while also having some fun.

But then, we needed a programmer. Not the person, but the hardware required to store a software program inside the microcontroller in order to instruct it into doing something useful, thus effectively programming the device.

After spending some time googling around for custom-built programmers, and after seeing they were quite simple to design, we decided to build or own as a good starting exercise. We just needed something simple, reliable, that wasn’t too expensive and that could be easily built by students.

 

Requirements

    To keep the budget factor low, we decided on a David Tait‘s design which uses the computer parallel port and a parallel cable as a transmission line. Before designing the device, there were some initial modifications we decided to have in our circuit:

    BH4AA-PCIt would run entirely on batteries. Having a separate power supply for the programmer is just asking for more wires around and having more wires around usually equals having more mess on the work desk. Also adding to the fact that power supplies here aren’t so cheap for a student budget, creating a self-powered device was the most suitable option for us.

    But since we wanted something simple and cheap, but still reliable and expensible, some extra care was needed, because, if power supplies weren’t cheap, good batteries aren’t either. Efficiency should be a main goal, because if we had to replace batteries everytime, then the savings on the power supply wouldn’t justify the increased cost in the long run.

     

The Design

    To improve efficiency, our circuit uses a schmitt trigger buffer for translating parallel port voltages into TTL-compatible voltages. Also, the proper use of transmission line terminations allows the device to work with longer parallel cables. Actually, I have been using 2m cables myself and didn’t run into any issues yet.

    296-TO92-3, TO-226AA To regulate the unpredictable alkaline voltages down to a nice constant 5v, we also couldn’t rely on a standard linear regulator like the 7805 because it requires at least 7.5v to work properly. In other words, using it would require at least 5 cells with at least 90% of charge left available in our circuit. Too wasteful. In turn, a LDO regulator would be fantastic, as it works with voltages as low as 5.4 volts.

    Just for clarification, I couldn’t just plug 4 or 3 cells in series because newly replaced alkaline batteries can source voltages as high as 1.68v per cell rather than they nominal 1.5v, resulting in almost 7v of microcontroller killing voltage. Also, 9v batteries were avoided for their low mAh capacity, as the device should be able to power-up other circuits trough its ICSP connections during programming.

     

    To enter programming mode, most PICs needs a voltage source somewhere around 12v present on the MCLR pin. In the past, however, a real current source was required for EEPROM programming, but for the newer, flash-memory based chips, the current doesn’t actually matters, only the voltage does, as it only purpose is to signal the device to enter programming mode.

    Because of the very experimental nature of this project, we sacrified the ability to program EEPROM chips and aimed only for the flash-memory chips (it may work with EEPROMs, but we just haven’t tested it yet). So, if we need a voltage that is almost the triple of our available voltage, but don’t need any actual current, its the perfect scenario for employing a charge pump circuit.

    voltagedoubler Charge pumps are very efficient voltage converters, but with very finite impedance, they can’t source much current. Those circuits use capacitors a "buckets" to pump charge from one place to another, producing higher voltages at the expense of lower output currents. It didn’t take long before we noticed that Intersil offers free samples of their 7660S "Super voltage converter chips", which is great, although the 7660 family is very popular and available from several manufacturers all around the world.

    Nevertheless, we went on and asked Intersil for some of the 7660 samples.

     

Schematic

    All considerations taken into account, below is the final schematic for the device, featuring the LP2950-CZ LDO regulator and the ICL7660 in the "voltage tripler" configuration.

     

    Battery-Powered Parallel PIC Programmer (sch)

 

Parts list

    Qty Device (Description) Value Parts
    1 Power Switch DIP Switch SW1
    1 LED5MM Green LED1
    1 LED5MM Red LED2
    6 Small Signal Diode 1N4148 D1, D2, D3, D4, D5, D6
    1 Resistor (0.25w) 270 R17
    2 Resistor (0.25w) 100 R14, R15
    2 Resistor (0.25w) 1k R1, R11
    4 Resistor (0.25w) 4k7 R3, R4, R5, R8
    9 Resistor (0.25w) 10k R2, R6, R7, R9, R10, R12, R13, R16, R18
    3 Ceramic Capacitor 100nF C3, C8, C11
    2 Ceramic Capacitor 470pF C9, C10
    2 Eletrolytic Capacitor 1uF C1, C2
    4 Eletrolytic Capacitor 10uF C4, C5, C6, C7
    2 Transistor PNP BC557C T1, T2
    1 Transistor NPN BC548 T3
    1 Voltage Converter ICL7660CPA IC3
    1 Schmitt Trigger Inverter 74HC14N IC5
    1 LDO Voltage Regulator LP2950CZ-5.0 IC1
    1 SIL Pin Header 3-way J2
    1 SIL Pin Header 3-way J1
    1 SIL Socket 20-way J3
    1 DIL Socket 18-way DIL18
    1 DIL Socket 20-way DIL20
    1 Serial Connector DB9 Female DB9
    1 Parallel Connector DB25 Female DB25
    1 Battery Clip 4xAA Cell Holder  

 

Building

    The samples from Intersil arrived only a few weeks later, carefully packed inside a hard plastic box filled with foam, ensuring the chips had some comfort during their long travel overseas.

    Well, that box was really too useful to be discarded, so we figured out a nicer destiny for them. At the time I didn’t yet have my fellow Dremel rotary tool, so I just cut its top off with a knife and made some holes on the sides for screwing a DB-25 connector (for the parallel port) and a DB-9 connector (for the ICSP connections). Here are the final pictures of the programmer mounted inside the Intersil’s sample’s box (sorry for the crappy resolution):

 

Layout

    And finally, here is the perfboard (pre-punched circuit board) layout we used for placing components on the box. Please note this layout should not be used for PCBs.

    Battery-Powered Parallel PIC Programmer (brd)

Downloads

    All Eagle files can be obtained here. For more information on how to setup a software programmer to work with this hardware, please see the next post, configuring WinPic800.

 

 

The Microchip name and logo is a registered trademark of Microchip Technology Incorporated in the U.S.A. and other countries. The schematic presented here is copyright of its original author, licensed under the terms of the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.