Shop

I sell on Tindie

Saturday, February 19, 2022

Word Generator in Multisim - 7 Segment Counter

Using the Word Generator for 7 Segment Counter Circuit

Date: 2/28/2022

Authors: Bits4Bots Team

We have designed simple 4 bit counter circuits using dip switches and ones using BCD to 7-segment decoder IC's. Here we use the Word Generator instrument in Multisim to send digital words or (bit patterns) into the digital circuit. 

  • Start by placing the Word Generator instrument onto the workspace. Locate this component on the right panel 0101 icon.
  • Next add at least one (1) 7 segment cathode display (any color)
  • Add at BCD to 7 Segment decoder. We used the 4511BP_5V
Power and ground the circuit according to the IC pinouts. See image. 


Wire the circuit by connecting the segments A-G to the decoder. The output pins (0-7) on the Word Generator are used to connect the BCD of the 4511BP chip. The enable (EN) - (~LE in Multisim)  pin is grounded. The LT and BI pins are connected to power. 


Double click the Word Generator component to configure the settings. 

Recommended settings:
  1. Frequency: 60Hz
  2. Controls: Cycle
  3. Display: Binary
  4. Trigger: Internal

Click the "set" tab to configure the following

  1.  Preset Pattern: Up Counter *starting at zero (0)
  2. Display Type: Hex
  3. Buffer Size: 0400 by default
  4. Output Voltage Level: 4.5V - High and 500mV - Low by default



Now run the simulation by clicking the green icon in the Multisim ribbon.


Further learning: Try adding a switch to control the trigger externally. Also add a second 7 segment display and cascade it to count up to 6 bits (63). If you are really into electronics how about adding three (3) 7 segment displays and counting up to 8 bits (255).




🖰 Drag and drop the snippet below and simulate it on your own.

Word Generator Snippet

If you enjoyed this project follow us here and on Instagram.



References: 

  1. https://www.digikey.com/en/maker/projects/how-to-interface-a-seven-segment-display-with-an-arduino/9c05f147618c4fe3b8bb79acce5c60e3
  2. https://zone.ni.com/reference/en-XX/help/375482B-01/multisim/wordgenerator/#:~:text=Multisim%2014.2%20Help,word%20generator%20to%20the%20circuit.
  3. https://images.slideplayer.com/19/5767463/slides/slide_22.jpg

PIC Driven LCD Display 20x4 Multisim

Demo of how the PIC16F84A MCU controls the LCD display

Date 2/19/2022
Author: Bits4Bots Team

A simulation of a PIC16F84A that controls a scrolling “Bits4Bits” text on a LCD display. The text shifts from left to right until the MCLR pin is grounded in the software by pressing the "spacebar" on the keyboard.

  • The PIC reads an 8-bit character from its internal EEPROM
  • The text data must be loaded beforehand by loading an external file named Bits4Bots.mch
  • The PIC then sends instructions to the LCD display component to control the text being displayed.

Function: PIC mid-range 8 Bit Microcontroller


Assembly language is used to program the PIC. Right click the IC in the Multisim workspace to view the code. 
The source code view shows the assembly or C source code for the MCU program.
If you are building this circuit, set the MCLR pin to VCC (high). The Master Clear pin is an optional external reset that is activated by pulling the pin low. During normal operation, it needs to be pulled high typically through a resistor to VCC.

Along with its selection of MCUs, Multisim contains a number of peripheral devices.

The MCU Group contains RAM and ROM devices that are designed to function specifically with the MCUs.

Watch us modify this Multisim MCU LCD Display on YouTube. 
Tell us what sample file you would like to see in our next blog.

To help you with your personal text message consider visiting https://www.rapidtables.com/convert/number/ascii-to-hex.html to quickly convert ASCII to Hex. Save the file in Notepad software with the extension .mch *Try saving different messages to load into the LCDDisplay sample .ms14 file. In our demo we used a message that says 
Bits4Bots 🠊  42 69 74 73 34 42 6F 74 73, 
Subscribe 🠊53 75 62 73 63 72 69 62 65 , and 
Follow us on Instagram 🠊 46 6F 6C 6C 6F 77 20 75 73 20 6F 6E 20 49 6E 73 74 61 67 72 61 6D . 

The MCP Memory view is where the Hex code can be changed manually. The main focus for quickly changing the original code is the EEPROM. It stands for electrically erasable programmable read-only memory and is a type of non-volatile memory.

Just double click in the Hex box to create a new message. It can be saved as new .mch file or a file can be imported as well as cleared from the memory.

The contents of the MCU Memory View change depending on the type of MCU. It may, for example, contain internal memory information, register views and configuration information.



👈 Drag and drop this snippet to your Multisim workspace to practice.

To learn more visit the links below.









Reference material: 


Tuesday, February 15, 2022

Binary up and down counter - Arduino

 

Arduino Code:

So you want to know how to build a binary counter using an Arduino microcontroller? In this tutorial you will learn how to count up and count down using two push buttons and eight leds. *You will also need resistors to prevent the leds from burning out (shame on me for not including them in the circuits)
I will not go over every detail but the code will be provided so that you can build your own counter. I will try my best to explain the working of this circuit...here goes.
First start by opening your programming software. I used  Arduino Software.  The beginning of the code defines the led pins and push buttons. My code used pin 2 & 3 for the up and down counter (known as interrupt pins on the Arduino Uno & a few other boards).  The buttons are then set to HIGH so that when they are pushed, the state is changed to LOW.(Pull-up resistor)

For the eight binary pins use pins (5-12).  Also included is a variable to store the number of times a button is pushed. This is very important for how the micro controller works to output the binary number. With that in mind debouncing the buttons are essential in correctly identifying when in fact there was or was not a button press which increments and decrements the counter. 
In the setup the stateChangeDetection (int state, int = i , and int = 0) is telling the program the state will either be HIGH or LOW and then whether or not to start on HIGH or LOW. It then uses this declared state throughout the remainder of the program.

The attachInterrupt syntax is as follows attachInterrupt(pin, ISR, mode) ;  please read more about it at the link provided.  

 The i++ will increment the counter i.e 0000 0000 becomes 0000 0001 when the up button is pressed and back to 0000 0000 if the down counter is pressed. The code loop basically converts the number of button pushes, stores it as a string, gets the length of the string and then outputs it to the leds. Please note that for convenience I choose the the red led for the LSB (least significant bit).
binarymakecounterhw.ino
Download File

Breadboard Setup:

The setup of the breadboard is as follows:
  1. Ground the left side of the button (wire the bottom left pin to ground) repeat step one for the second button.
  2. The top right pin of the button should connect to 3 (count up) and pin 2 (count down)
  3. Ground each led pin. (flat side)
  4. Starting with the red led connect the anode (+) side to pin 5 *include a resistor(680 ohms is ideal). Repeat steps until all leds are connected to the Arduino.
  5. Be sure to add jumpers across the board bus lines to have power down both strips of the prototype bread board. I used the 3.3V and GND for the voltage supply.
I hope that you were able to follow these steps to successfully build or modify your own circuit. Please leave a comment for question, concerns, or thank you's.

Please Visit again soon. Check out more projects before you go!

Sunday, February 13, 2022

Azure Sphere Samples - Blinking blue led

Updated post from 9/7/2019 

How to change from red, to green and blink the blue led on the Azure Sphere MT3620 starter kit. 

  • Azure Starter Kit
  • Microsoft Visual Studio
  • Watch YouTube Video (recommended for connection)
  • GitHub files
  • or Azure Blink Template
Picture
Photos credit: Bits4Bots LLC. Azure Sphere Starter Kit
So, the correlation to the RBG pins are 8, 9 , and 10. This change must be made in first the header of the .C file and the .C file itself.
This is assuming you already have your board in azsphere device prep-debug mode in the CMD window.
******************************************************If you are looking for an easy way to get going with the starter kit you're in luck! I recently started playing with the kit myself and was successful in the HelloWorld blink test. In the Azure sample code the GPIO color choice is red of the RBG.
There is also a YouTube video by Hackster that shows the code for GPIO 9, which is the green of the RBG. Today my friend you will have the information to blink the blue of the RBG, GPIO 10. 

App_manifest.json

Picture
​{
  "SchemaVersion": 1,
  "Name" : "AzureSphereBlink1",
  "ComponentId" : "dafede3f-b746-46ce-xxxx-xxxxxxxxxxx"//blocked out my personal info
  "EntryPoint": "/bin/app",
  "CmdArgs": [ ],
  "Capabilities": {
    "AllowedConnections": [ ],
    "Gpio": [ 10 ],
    "Uart": [ ],
    "WifiConfig": false
  },
  "ApplicationType":"Default"
}


Main.c

​#include <stdbool.h>
#include <errno.h>
#include <string.h>
#include <time.h>

#include <applibs/log.h>
#include <applibs/gpio.h>

int main(void)
{
    //Inspired by GitHub Azure Sphere Samples designed by Bits4Bots LLC  
//This minimal Azure Sphere app repeatedly toggles GPIO 10, which is the blue channel of RGB
    // LED 1 on the MT3620 RDB.
    // Use this app to test that device and SDK installation succeeded that you can build,
    // deploy, and debug an app with Visual Studio, and that you can deploy an app over the air,
    // per the instructions here: https://docs.microsoft.com/azure-sphere/quickstarts/qs-overview
    //
    // It is NOT recommended to use this as a starting point for developing apps; instead use
    // the extensible samples here: https://github.com/Azure/azure-sphere-samples
    Log_Debug(
        "\nVisit https://github.com/Azure/azure-sphere-samples for extensible samples to use as a "
        "starting point for full applications.\n");

    int fd = GPIO_OpenAsOutput(10, GPIO_OutputMode_PushPull, GPIO_Value_High);
    if (fd < 0) {
        Log_Debug(
            "Error opening GPIO: %s (%d). Check that app_manifest.json includes the GPIO used.\n",
            strerror(errno), errno);
        return -1;
    }

    const struct timespec sleepTime = {1, 0};
    while (true) {
        GPIO_SetValue(fd, GPIO_Value_Low);
        nanosleep(&sleepTime, NULL);
        GPIO_SetValue(fd, GPIO_Value_High);
        nanosleep(&sleepTime, NULL);
    }
}
I hope you found this tutorial useful. All of the information on this site is licensed under the creative commons. Share and share alike. Please gives us a mention or share our page with a friend. Thanks.
How would you implement the built-in sensors & leds in your design. How do you feel about cryptography? About 5G? 

About Raspberry Pi Pico W (WiFi Onboard)

July 1st 2022 💖We love new arrivals! The  Raspberry Pi Pico W  is a new tiny platform based on the  RP2040  silicon and it provides connect...

Popular Post