• Coded an Altera FPGA board in System Verilog such that it could use the on board ADC to convert the voltage signal into a digital signal, that was displayed on a seven segment display as well as on a computer screen.
• Utilized a UART (USB to serial) to receive the voltage signal that was to be displayed on a computer.
• Controlled the selection of channel for analog input by transmitting the serial data through the UART from the computer keyboard.
Не так давно Гор Нишанов представил свой доклад: C++ Coroutines a negative overhead abstraction. В этом докладе Гор упомянул, что предложенный дизайн корутин позволяет их использовать практически в любых окружениях, в том числе и с "бедным" C++ рантаймом.
Я решил попробовать запустить корутины в следующих окружениях: обычное приложение, драйвер ОС Windows, EFI приложение. Только в одном из этих окружений есть полноценный C++ рантайм и поддержка исключений, в остальных ничего этого нет. Более того, EFI приложение вообще выполняется до старта ОС.
Я хочу рассказать о том, как мне удалось запустить корутины в этих окружениях, поговорим о том, какие проблемы существуют в асинхронном системном программировании и как их можно обойти.
1. Loops (while and for) allow repeating a block of code multiple times based on a condition. Key loop components are the condition, statement list, and condition update.
2. Nested loops involve loops within other loops, allowing multiple levels of repetition. Variables used in inner loops may shadow those in outer loops.
3. Loop scopes determine variable visibility. Variables declared within loops are local to the loop and not accessible outside. Variables declared before loops can be accessed within and outside loops.
The document discusses new C++11 features including:
1. Uniform initialization syntax using curly braces {} which can initialize objects in a clear and consistent way compared to parentheses () or equals =.
2. Initializer lists and how they allow initializing objects from a list of values. However, initializer lists may prefer certain constructors unintuitively.
3. How uniform initialization helps prevent narrowing conversions and most vexing parse issues that could occur in C++98 code.
Exception handling in C++ allows programs to handle runtime errors and unexpected situations called exceptions. Code that could cause exceptions is placed in a try block. If an exception occurs, it is thrown to a catch block that handles the exception. C++ supports multiple catch blocks to handle different exception types based on the parameters passed to throw. This allows catching specific exceptions while resuming normal execution when no exception occurs.
This document discusses different types of simulation for digital circuits including analog simulation using a SPICE engine, digital simulation, and event-driven simulation. It also covers testbenches, including generating stimulus, monitoring outputs, and exhaustively testing designs. Key topics covered include clocks, finite state machine testing, and force/release in testbenches.
Pro typescript.ch03.Object Orientation in TypeScriptSeok-joon Yun
The document discusses object-oriented programming concepts in TypeScript such as classes, inheritance, polymorphism, and mixins. It provides code examples of implementing interfaces and classes to demonstrate inheritance and composition. Mixins are discussed as a way to reuse behavior across class hierarchies by applying multiple base classes to a derived class using a mixin function. The examples show how to define mixin behaviors as classes and apply them to implementing classes to achieve multiple inheritance in TypeScript.
Антон Бикинеев, Writing good std::future< C++ >Sergey Platonov
В докладе Антон расскажет о грядущих мажорных изменениях языка, которые, не войдя в Стандарт 17-го года и оставшись в Technical Specifications, будут ждать своего мержа в 20-м, а также быть уже реализованными в некоторых компиляторах. Осветятся также минорные, уже одобренные фичи следующего Стандарта, как языковые, так и библиотечные. Антон расскажет об их целях, покажет методы использования, а также осветит некоторые гайдлайны и трики.
Не так давно Гор Нишанов представил свой доклад: C++ Coroutines a negative overhead abstraction. В этом докладе Гор упомянул, что предложенный дизайн корутин позволяет их использовать практически в любых окружениях, в том числе и с "бедным" C++ рантаймом.
Я решил попробовать запустить корутины в следующих окружениях: обычное приложение, драйвер ОС Windows, EFI приложение. Только в одном из этих окружений есть полноценный C++ рантайм и поддержка исключений, в остальных ничего этого нет. Более того, EFI приложение вообще выполняется до старта ОС.
Я хочу рассказать о том, как мне удалось запустить корутины в этих окружениях, поговорим о том, какие проблемы существуют в асинхронном системном программировании и как их можно обойти.
1. Loops (while and for) allow repeating a block of code multiple times based on a condition. Key loop components are the condition, statement list, and condition update.
2. Nested loops involve loops within other loops, allowing multiple levels of repetition. Variables used in inner loops may shadow those in outer loops.
3. Loop scopes determine variable visibility. Variables declared within loops are local to the loop and not accessible outside. Variables declared before loops can be accessed within and outside loops.
The document discusses new C++11 features including:
1. Uniform initialization syntax using curly braces {} which can initialize objects in a clear and consistent way compared to parentheses () or equals =.
2. Initializer lists and how they allow initializing objects from a list of values. However, initializer lists may prefer certain constructors unintuitively.
3. How uniform initialization helps prevent narrowing conversions and most vexing parse issues that could occur in C++98 code.
Exception handling in C++ allows programs to handle runtime errors and unexpected situations called exceptions. Code that could cause exceptions is placed in a try block. If an exception occurs, it is thrown to a catch block that handles the exception. C++ supports multiple catch blocks to handle different exception types based on the parameters passed to throw. This allows catching specific exceptions while resuming normal execution when no exception occurs.
This document discusses different types of simulation for digital circuits including analog simulation using a SPICE engine, digital simulation, and event-driven simulation. It also covers testbenches, including generating stimulus, monitoring outputs, and exhaustively testing designs. Key topics covered include clocks, finite state machine testing, and force/release in testbenches.
Pro typescript.ch03.Object Orientation in TypeScriptSeok-joon Yun
The document discusses object-oriented programming concepts in TypeScript such as classes, inheritance, polymorphism, and mixins. It provides code examples of implementing interfaces and classes to demonstrate inheritance and composition. Mixins are discussed as a way to reuse behavior across class hierarchies by applying multiple base classes to a derived class using a mixin function. The examples show how to define mixin behaviors as classes and apply them to implementing classes to achieve multiple inheritance in TypeScript.
Антон Бикинеев, Writing good std::future< C++ >Sergey Platonov
В докладе Антон расскажет о грядущих мажорных изменениях языка, которые, не войдя в Стандарт 17-го года и оставшись в Technical Specifications, будут ждать своего мержа в 20-м, а также быть уже реализованными в некоторых компиляторах. Осветятся также минорные, уже одобренные фичи следующего Стандарта, как языковые, так и библиотечные. Антон расскажет об их целях, покажет методы использования, а также осветит некоторые гайдлайны и трики.
Евгений Крутько, Многопоточные вычисления, современный подход.Platonov Sergey
The document discusses parallel computing in modern C++. It introduces native threads, standard threads in C++11, thread pools, std::async, and examples of parallelizing real applications. It also covers potential issues like data races and tools for detecting them like Valgrind and ThreadSanitizer. Finally, it recommends using std::async, std::future and boost::thread for flexibility and OpenMP for ease of use.
This project is all about the wireless operation of a DC Motor. In this project, we will control the speed of a DC Motor. Direction of the rotation will also be controlled. Wireless facility is provided with the help of Bluetooth connectivity. An android handset is required to control the operation. As the name suggests that “Speed and Direction Control of DC Motor using Android Mobile Application” is controlling the speed of a DC motor with any mobile phone containing some medium of connectivity such as Bluetooth. Various terms related to this project can be discussed as follows. Since we are concern with the wireless application that is why we are using here a mobile phone to control the whole process. Now the question is why should we use a mobile phone? Which is the most suitable mobile phone? So the answer is that mobile is used only for a Bluetooth connection. We need not to carry an extra device for transmitting the data. This transmitter is already inbuilt in a mobile phone. Now come with the question of most suitable mobile phone, so it can be observed that Android phones are the most widely used phones. Android phones are very easy from the operating point of view. I-phones and windows phones are not as popular as the Android phones. So the Android phone will be used here.
This document discusses dynamically creating functions in Python using metaprogramming techniques. It explores different approaches to programmatically defining functions with a variable number of arguments. The key challenges are correctly handling variable names, argument counts, closure variables, and memory allocation for the new function objects. After several attempts, the document arrives at a working solution that uses the types module to construct CodeType objects and FunctionType objects, ensuring all necessary function attributes like variable names and closure information are properly defined.
Rust LDN 24 7 19 Oxidising the Command LineMatt Provost
The document discusses various techniques for building command line utilities in Rust, including handling broken pipes, reading input byte-by-byte or line-by-line, reading from stdin or files, and handling non-UTF8 arguments. It provides code examples of reading from stdin, handling broken pipes gracefully, and collecting command line arguments as OsStrings to support non-UTF8 values. The document concludes by advertising open jobs at Yelp and providing contact information.
A Slipshod Check of the Visual C++ 2013 Library (update 3)Andrey Karpov
Someone suggested to me recently that I check the libraries from Visual Studio 2013. I haven't found
anything of much interest, just a few small errors and slip-ups. They wouldn't make an interesting,
attractive article, but I've still decided to describe all those defects. I just hope it will help make the
libraries a bit better and stimulate the authors to carry out a more thorough analysis. I don't have the
project files necessary to build the libraries, so my analysis had to be superficial and I could have missed
a lot.
The document discusses the Rust programming language, highlighting its features like concurrency, safety, and package management. It covers Rust's syntax including expressions, attributes, pattern matching and generics. The document also discusses how Rust handles concurrency through tasks and channels to enable safe parallelism and communication between threads.
The document discusses JavaScript concepts including hashmaps, window functions, execution contexts, and variable scoping. It provides code examples of hash functions, window and function declarations, variable assignments within nested functions, and the use of execution contexts and scopes to resolve variable references.
The Ring programming language version 1.4 book - Part 21 of 30Mahmoud Samir Fayed
This document provides information about low level functions in Ring that interface with C and the Ring virtual machine. It discusses the callgc() function to manually call the garbage collector, the varptr() function to get a pointer to a C variable, the space() function to allocate memory, nullpointer() to pass a null pointer, object2pointer() and pointer2object() to convert between Ring objects and C pointers, ptrcmp() to compare pointers, and functions like ringvm_cfunctionslist() to get lists of C functions and ringvm_functionslist() to get a list of Ring functions from the bytecode. These low level functions provide interfaces between Ring and C to integrate Ring with C libraries and code.
ITGM #9 - Коварный CodeType, или от segfault'а к работающему кодуdelimitry
Доклад с ITGM #9 рассказывающий про реальный пример поиска и исправления Segmentation fault при генерации функции на Python в одном проекте
(Доклад вместе с http://www.slideshare.net/AndreyZakharevich)
Introduction to Verilog & code coverageJyun-Kai Hu
This document provides an introduction and overview of Verilog HDL including:
- Basic syntax like initial blocks and modules
- Data types like reg and wire
- Assignment types like continuous and non-blocking
- Simulation concepts like event queues and scheduling
- Using the VCS tool for simulation and analyzing code coverage metrics like toggle, branch, condition, and FSM coverage.
The document discusses coroutines in Python. It describes how coroutines can have multiple entry points using the await keyword, and how the Python interpreter suspends and resumes coroutine execution. It also provides an example coroutine program that defines two coroutines that print messages before and after sleeping for different durations. The document then analyzes the coroutine execution using the inspect module and disassembler to illustrate how coroutine frames and the execution stack work.
Towards Reusable Components With Aspects [ICSE 2008]Kevin Hoffman
Does obliviousness increase overall modularity? This presents the results of an empirical study that focuses on the tradeoffs between obliviousness and modularity. The results may surprise you!
This document contains code for a C++ program that manages traveler details. It includes functions for an administrator menu with options to display traveler lists, search, edit, and delete traveler details. There are also functions for a guest menu to input and display traveler details. Structures are used to store traveler information including name, destination, address, phone number, etc.
The document discusses functions in C++. It covers function prototypes, definitions, parameters, return types, and passing arguments to functions. Examples are provided of defining, declaring, calling functions, and common errors like missing return types or incorrect parameter types. Predefined functions from headers like sqrt() from cmath and rand() from cstdlib are also demonstrated.
This document discusses binary vulnerabilities and methods for identifying and exploiting them. It covers topics like stack overflows, heap overflows, integer overflows, and pointer vulnerabilities. It also discusses vulnerability metrics, identifiers, and tools that can be used for analysis like fuzzers, symbolic execution, and decompilers. Exploitation techniques like bypassing protections and transferring control are also mentioned.
OSX/Flashback
El sistema operativo Apple OS X, al igual que todos los sistemas operativos, puede convertirse en una víctima de software malicioso. Antes de la aparición de OSX/Flashback, hubo varios casos documentados de malware dirigido a OS X; pero hasta ahora, OSX/Flashback fue el que cobró la mayor cantidad de víctimas. En este artículo se describen las características técnicas más interesantes de la amenaza, en especial el método utilizado para espiar las comunicaciones de red y los algoritmos para la generación dinámica de nombres de dominio. También se incluye una línea de tiempo con los puntos más importantes del malware, cuyo ciclo de vida persistió durante tantos meses.
The document describes a program to simulate the sliding window protocol for Go back n. It generates random numbers to determine the total number of frames and window size. Frames up to the window size are transmitted and acknowledgements are received. If an acknowledgement is not received, the frames are retransmitted. This continues until all frames are successfully transmitted.
Design of 17-Bit Audio Band Delta-Sigma Analog to Digital ConverterKarthik Rathinavel
• Systematically designed a delta sigma ADC with CIFF modular architecture in MATLAB Simulink with an ENOB of 19-bits.
• Designed a decimation filter to remove noise in the digital output of the delta sigma modulator.
• Observed the effect of non-idealities on the modulator such as finite gain, finite bandwidth, slew rate, analog noise and capacitor mismatch.
• Designed a Wilkinson Combiner at 30 GHz using microstrip transmission line and then at 60 GHz using coplanar waveguide.
• Simulated the Layout of the testbench using the EM Simulator at RF.
Sine Wave Generator with controllable frequency displayed on a seven segment ...Karthik Rathinavel
• Designed a Sine Wave Generator Hardware, whose frequency could be controlled using a quadrature encoder.
• Coded the FPGA board in System Verilog to display a count (going from 0 to 9999) on to a seven segment board. This count that was displayed, was same as the frequency of the sine wave generated.
• Incorporated a brightness control feature for all the digits being displayed. This was done by changing the duty cycle using a push button for the PWM control.
• Included an additional feature of increasing the count and the frequency by tens, hundreds or thousands, instead of increasing by just one.
Ece 523 project – fully differential two stage telescopic op ampKarthik Rathinavel
• Designed a two stage op-amp with first stage as a telescopic amplifier and second stage being a common source, in Cadence.
• Simulated the loop characteristics of the amplifier to have atleast 100 MHz Unity Gain Bandwidth, 65 dB gain and 60º phase margin (both differential loop and Common Mode) for three temperature (27,-40,100) corners.
• Extracted the layout of the design in Virtuoso (after passing DRC an LVS) and simulated the differential loop performances of the extracted netlist.
• Designed a third order Butterworth filter with 100 KHz corner frequency using the op-amp.
Евгений Крутько, Многопоточные вычисления, современный подход.Platonov Sergey
The document discusses parallel computing in modern C++. It introduces native threads, standard threads in C++11, thread pools, std::async, and examples of parallelizing real applications. It also covers potential issues like data races and tools for detecting them like Valgrind and ThreadSanitizer. Finally, it recommends using std::async, std::future and boost::thread for flexibility and OpenMP for ease of use.
This project is all about the wireless operation of a DC Motor. In this project, we will control the speed of a DC Motor. Direction of the rotation will also be controlled. Wireless facility is provided with the help of Bluetooth connectivity. An android handset is required to control the operation. As the name suggests that “Speed and Direction Control of DC Motor using Android Mobile Application” is controlling the speed of a DC motor with any mobile phone containing some medium of connectivity such as Bluetooth. Various terms related to this project can be discussed as follows. Since we are concern with the wireless application that is why we are using here a mobile phone to control the whole process. Now the question is why should we use a mobile phone? Which is the most suitable mobile phone? So the answer is that mobile is used only for a Bluetooth connection. We need not to carry an extra device for transmitting the data. This transmitter is already inbuilt in a mobile phone. Now come with the question of most suitable mobile phone, so it can be observed that Android phones are the most widely used phones. Android phones are very easy from the operating point of view. I-phones and windows phones are not as popular as the Android phones. So the Android phone will be used here.
This document discusses dynamically creating functions in Python using metaprogramming techniques. It explores different approaches to programmatically defining functions with a variable number of arguments. The key challenges are correctly handling variable names, argument counts, closure variables, and memory allocation for the new function objects. After several attempts, the document arrives at a working solution that uses the types module to construct CodeType objects and FunctionType objects, ensuring all necessary function attributes like variable names and closure information are properly defined.
Rust LDN 24 7 19 Oxidising the Command LineMatt Provost
The document discusses various techniques for building command line utilities in Rust, including handling broken pipes, reading input byte-by-byte or line-by-line, reading from stdin or files, and handling non-UTF8 arguments. It provides code examples of reading from stdin, handling broken pipes gracefully, and collecting command line arguments as OsStrings to support non-UTF8 values. The document concludes by advertising open jobs at Yelp and providing contact information.
A Slipshod Check of the Visual C++ 2013 Library (update 3)Andrey Karpov
Someone suggested to me recently that I check the libraries from Visual Studio 2013. I haven't found
anything of much interest, just a few small errors and slip-ups. They wouldn't make an interesting,
attractive article, but I've still decided to describe all those defects. I just hope it will help make the
libraries a bit better and stimulate the authors to carry out a more thorough analysis. I don't have the
project files necessary to build the libraries, so my analysis had to be superficial and I could have missed
a lot.
The document discusses the Rust programming language, highlighting its features like concurrency, safety, and package management. It covers Rust's syntax including expressions, attributes, pattern matching and generics. The document also discusses how Rust handles concurrency through tasks and channels to enable safe parallelism and communication between threads.
The document discusses JavaScript concepts including hashmaps, window functions, execution contexts, and variable scoping. It provides code examples of hash functions, window and function declarations, variable assignments within nested functions, and the use of execution contexts and scopes to resolve variable references.
The Ring programming language version 1.4 book - Part 21 of 30Mahmoud Samir Fayed
This document provides information about low level functions in Ring that interface with C and the Ring virtual machine. It discusses the callgc() function to manually call the garbage collector, the varptr() function to get a pointer to a C variable, the space() function to allocate memory, nullpointer() to pass a null pointer, object2pointer() and pointer2object() to convert between Ring objects and C pointers, ptrcmp() to compare pointers, and functions like ringvm_cfunctionslist() to get lists of C functions and ringvm_functionslist() to get a list of Ring functions from the bytecode. These low level functions provide interfaces between Ring and C to integrate Ring with C libraries and code.
ITGM #9 - Коварный CodeType, или от segfault'а к работающему кодуdelimitry
Доклад с ITGM #9 рассказывающий про реальный пример поиска и исправления Segmentation fault при генерации функции на Python в одном проекте
(Доклад вместе с http://www.slideshare.net/AndreyZakharevich)
Introduction to Verilog & code coverageJyun-Kai Hu
This document provides an introduction and overview of Verilog HDL including:
- Basic syntax like initial blocks and modules
- Data types like reg and wire
- Assignment types like continuous and non-blocking
- Simulation concepts like event queues and scheduling
- Using the VCS tool for simulation and analyzing code coverage metrics like toggle, branch, condition, and FSM coverage.
The document discusses coroutines in Python. It describes how coroutines can have multiple entry points using the await keyword, and how the Python interpreter suspends and resumes coroutine execution. It also provides an example coroutine program that defines two coroutines that print messages before and after sleeping for different durations. The document then analyzes the coroutine execution using the inspect module and disassembler to illustrate how coroutine frames and the execution stack work.
Towards Reusable Components With Aspects [ICSE 2008]Kevin Hoffman
Does obliviousness increase overall modularity? This presents the results of an empirical study that focuses on the tradeoffs between obliviousness and modularity. The results may surprise you!
This document contains code for a C++ program that manages traveler details. It includes functions for an administrator menu with options to display traveler lists, search, edit, and delete traveler details. There are also functions for a guest menu to input and display traveler details. Structures are used to store traveler information including name, destination, address, phone number, etc.
The document discusses functions in C++. It covers function prototypes, definitions, parameters, return types, and passing arguments to functions. Examples are provided of defining, declaring, calling functions, and common errors like missing return types or incorrect parameter types. Predefined functions from headers like sqrt() from cmath and rand() from cstdlib are also demonstrated.
This document discusses binary vulnerabilities and methods for identifying and exploiting them. It covers topics like stack overflows, heap overflows, integer overflows, and pointer vulnerabilities. It also discusses vulnerability metrics, identifiers, and tools that can be used for analysis like fuzzers, symbolic execution, and decompilers. Exploitation techniques like bypassing protections and transferring control are also mentioned.
OSX/Flashback
El sistema operativo Apple OS X, al igual que todos los sistemas operativos, puede convertirse en una víctima de software malicioso. Antes de la aparición de OSX/Flashback, hubo varios casos documentados de malware dirigido a OS X; pero hasta ahora, OSX/Flashback fue el que cobró la mayor cantidad de víctimas. En este artículo se describen las características técnicas más interesantes de la amenaza, en especial el método utilizado para espiar las comunicaciones de red y los algoritmos para la generación dinámica de nombres de dominio. También se incluye una línea de tiempo con los puntos más importantes del malware, cuyo ciclo de vida persistió durante tantos meses.
The document describes a program to simulate the sliding window protocol for Go back n. It generates random numbers to determine the total number of frames and window size. Frames up to the window size are transmitted and acknowledgements are received. If an acknowledgement is not received, the frames are retransmitted. This continues until all frames are successfully transmitted.
Design of 17-Bit Audio Band Delta-Sigma Analog to Digital ConverterKarthik Rathinavel
• Systematically designed a delta sigma ADC with CIFF modular architecture in MATLAB Simulink with an ENOB of 19-bits.
• Designed a decimation filter to remove noise in the digital output of the delta sigma modulator.
• Observed the effect of non-idealities on the modulator such as finite gain, finite bandwidth, slew rate, analog noise and capacitor mismatch.
• Designed a Wilkinson Combiner at 30 GHz using microstrip transmission line and then at 60 GHz using coplanar waveguide.
• Simulated the Layout of the testbench using the EM Simulator at RF.
Sine Wave Generator with controllable frequency displayed on a seven segment ...Karthik Rathinavel
• Designed a Sine Wave Generator Hardware, whose frequency could be controlled using a quadrature encoder.
• Coded the FPGA board in System Verilog to display a count (going from 0 to 9999) on to a seven segment board. This count that was displayed, was same as the frequency of the sine wave generated.
• Incorporated a brightness control feature for all the digits being displayed. This was done by changing the duty cycle using a push button for the PWM control.
• Included an additional feature of increasing the count and the frequency by tens, hundreds or thousands, instead of increasing by just one.
Ece 523 project – fully differential two stage telescopic op ampKarthik Rathinavel
• Designed a two stage op-amp with first stage as a telescopic amplifier and second stage being a common source, in Cadence.
• Simulated the loop characteristics of the amplifier to have atleast 100 MHz Unity Gain Bandwidth, 65 dB gain and 60º phase margin (both differential loop and Common Mode) for three temperature (27,-40,100) corners.
• Extracted the layout of the design in Virtuoso (after passing DRC an LVS) and simulated the differential loop performances of the extracted netlist.
• Designed a third order Butterworth filter with 100 KHz corner frequency using the op-amp.
Designed a Switched Capacitor Low Pass Filter with a sampling frequency of 60 Hz.
Simulated the filter to have a ripple within 0.2 dB under 3.6 MHz and a stopband attenuation of atleast -51 dB after 7.2 MHz.
Applied dynamic range optimization, Dynamic Range Scaling and Chip Area scaling to get maximum output swing while occupying minimum area on chip.
Tested the filter with non-idealities of the amplifier, such as finite gain, bandwidth, offset voltage, charge injection, etc.
The document contains examples of Verilog code including:
1. A 2-D flip-flop synchronizer module and testbench.
2. Three different finite state machine (FSM) design techniques using single, two, and three always blocks.
3. A generic pipeline/repeater module and testbench.
4. Simple D flip-flop modules with synchronous and asynchronous resets and testbenches.
5. A mod-M counter module that generates a tick pulse and testbench.
6. A clock pulse generator module.
The document describes implementing up, down, and up/down counters using Verilog code. It includes:
1) Code for a 4-bit up counter that counts from 0 to 15 when the clock signal changes.
2) Code for a 4-bit down counter that counts from 15 to 0 when the clock signal changes.
3) Code for a 4-bit up/down counter that counts up when the up signal is high and down when the down signal is high, controlled by the clock.
This document describes a grey code counter module with logic to increment or decrement the counter values using a grey code sequence. The module contains registers to store the current and historical counter values. It also includes functions to increment, decrement, and convert between grey code and numeric representations of the counter values.
The document discusses UART (Universal Asynchronous Receiver/Transmitter) and RS-232 communication standards. It describes the voltage levels used, the need for a converter chip between UART and RS-232, synchronous vs asynchronous transmission, baud rates, frame formats, and provides VHDL code for a UART transmitter and receiver implementation including state machines and registers.
Arduino based keyboard and display interfacingAkash1900
This document contains code for interfacing with a PS/2 keyboard and driving an 8x7 LED matrix display. It defines constants for keyboard scan codes and LED matrix pins. Arrays store the bitmaps for letters, punctuation, and other characters to display. Functions are defined to read keyboard input, lookup characters from codes, and handle display updating and scrolling based on keyboard input.
This document describes the history and features of the MDP-Plus expert advisor (EA). It was originally based on the MillionDollarPips EA and has undergone several versions with updates and improvements made by Capella. Key features of MDP-Plus v2.1.2 include trailing stops, support for no dealing desk brokers, optimized settings, and customization of indicators and order settings. The EA uses moving averages, Bollinger Bands, and other indicators to determine entry signals and manage open positions.
How do I draw the Labview code for pneumatic cylinder(air pistion). .pdffootstatus
How do I draw the Labview code for pneumatic cylinder(air pistion). (Start with banana-plug>>
Pneumatic cylinder(air pistion) moves back and forward certain times or certain seconds>> end)
Solution
#include
#include
#include
#include
#include \"RTClib.h\"
#define LOG_INTERVAL 1 // milsec betweens entries
#define SYNC_INTERVAL 100
uint32_t syncTime =0;
RTC_DS1307 RTC; // Real Time Clock
// On the Ethernet Shield, CS is pin 4. Note that even if it\'s not
// used as the CS pin, the hardware CS pin (10 on most Arduino boards,
// 53 on the Mega) must be left as an output or the SD library
// functions will not work.
const int chipSelect = 10;
//switch inputs and variables
const int kPinReedSwitch1 = 22;
const int kPinReedSwitch2 = 24;
const int relayPin = 26;
int strokedown = 0;
int inc = 0;
int precountA =0;
int precountB = 0;
int count = 0;
int runcycles = 20;
int reset = 0;
int initial = 1;
int start =1;
int LinearPot1Pin = A0; // select the input pin for the potentiometer
float sensorValue = 0.0; // variable to store the value coming from the sensor
int MC_travel = 0;
int on =0;
//logging file
File logfile;
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void error(char *str)
{
Serial.print(\"error: \");
Serial.println(str);
while(1);
}
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// Input pins for Arduino
pinMode(kPinReedSwitch1, INPUT_PULLUP);
pinMode(kPinReedSwitch2, INPUT_PULLUP);
pinMode(relayPin, OUTPUT);
Serial.print(\"Initializing SD card...\");
// make sure that the default chip select pin is set to
// output, even if you don\'t use it:
pinMode(53, OUTPUT);
// see if the card is present and can be initialized:
if (!SD.begin(10,11,12,13)) {
Serial.println(\"Card failed, or not present\");
// don\'t do anything more:
return;
}
Serial.println(\"card initialized.\");
// creating a new file for data logger
char filename[] = \"LOGGER00.CSV\";
for (uint8_t i = 0; i < 100; i++){
filename[6] = i/10 + \'0\';
filename[7] = i%10 + \'0\';
if(! SD.exists(filename)){
logfile = SD.open(filename, FILE_WRITE);
break;
}
}
if (!logfile) {
error(\"couldnt create file\");
}
Serial.print(\"Logging to:\");
Serial.println(filename);
logfile.println(\"MC Travel\");
// LCD initialization
lcd.begin(20,4);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(\"Count: \");
lcd.setCursor(0,1);
lcd.print(\"MC Travel: in\");
}
void loop()
{
for(int i = 1; i < 2; i++ )
//an initialization routine just to get cylinder to \"home\"
//although should never really be away from home
{
digitalWrite(relayPin, HIGH);
delay(200);
digitalWrite(relayPin, LOW);
delay (2000);
}
while( count <= runcycles){
if( start ==1 && digitalRead(kPinReedSwitch1)==HIGH){
digitalWrite(relayPin, HIGH);
}
else if (digitalRead(kPinReedSwitch1) == LOW)
// turns on relay when reed switch A is triggered
// Logic reversed because of pullup resistors
{
strokedown = 1;
precountA =1;
start=0;// .
The document contains Verilog code for a single cycle processor including modules for a program counter, accumulator, ALU, adder, multiplexers, controller, data memory, instruction memory, and a test bench. It describes the design and implementation of the datapath and controller for a simple CPU using Verilog that performs arithmetic and logical operations on data stored in memory locations.
This document contains programs for a PIC microcontroller that implement various functions including:
1) Scanning a 4x4 keypad and displaying the pressed number on a 7-segment display.
2) Using an ADC to read pressure sensor data and transmit it via RS-232.
3) Transmitting and receiving data between two PICs via RS-232.
4) Blinking LEDs on ports and driving a buzzer.
5) Reading an ADC and displaying the value on an LCD.
6) Implementing a timer and counting seconds on an LCD.
7) Using I2C to communicate with a device.
8) Scanning a keypad and unlock
Behavioral modeling of sequential logic modules: Latches, Flip Flops, counters and shift registers applications
Synchronous Sequential Circuits: Analysis and synthesis of synchronous sequential circuits: Mealy and Moore FSM models for completely and incompletely specified circuits, State Minimization-Partitioning Minimization Procedure, sequence detector with verilog HDL modeling Design of a Modulo-8 Counter using the Sequential Circuit Approach and its verilog implementation. One-Hot Encoding
Lecture#8 introduction to array with examples c++NUST Stuff
The document discusses arrays in C++. It defines arrays as structures that hold a collection of related data items of the same type. Arrays have a fixed size that is set when they are declared. Individual elements in an array are accessed using an index number inside square brackets. The document provides examples of declaring, initializing, and accessing values in arrays. It also demonstrates using a constant variable to set the size of an array and looping through arrays to sum elements or print a histogram.
This document defines functions for displaying numeric values on a 7-segment display using an Arduino. It sets latch, clock, and data pins as outputs to control the display. The disNum() function takes in a numeric value, position, and decimal flag and outputs the corresponding 7-segment display value. The showNum() function takes a double value, converts it to long, extracts each digit, and calls disNum() to display the number on the 7-segment display one position at a time.
The document discusses loops and their logic in programming. It describes the different types of loops - for, while, and do-while loops. It provides examples of how each loop works, including their basic structure and flow. It also discusses nested loops, the break and continue statements, and provides examples of programs to write using loops.
This document provides an overview of key concepts for programming Arduino boards including comments, variables, logic operators, and loops. It explains that comments are lines of text preceded by // or between /* and */. Variables can be boolean, integer, character, or strings, and are declared with keywords like boolean or int followed by the variable name. Common logic operators include = for assignment, == for comparison, && for AND, and || for OR. The Arduino setup function is used to initialize pins and serial communication. The loop function repeats code continuously. For, while, and basic repetition are covered with for loops iterating with a counter variable and while loops checking a condition.
The document contains Verilog code for several digital logic circuits including a 32-bit barrel shifter, 8-bit Booth multiplier, 32-bit ripple carry adder, 32-bit simple adder, and 32-bit carry lookahead adder. Test benches with stimulus are provided to test the functionality of each circuit.
The document summarizes new features in C# 4.0 including optional and named parameters, dynamic typing, tuples, complex numbers, parallel programming, and thread-safe data structures. It also mentions code contracts, memory-mapped files, and the Managed Extensibility Framework.
The IoT Academy IoT Training Arduino Part 3 programmingThe IOT Academy
This document provides an overview of basic Arduino code structure and programming concepts. It explains that Arduino programs have two main sections - setup() and loop(). Setup() is used to initialize inputs and outputs, and loop() contains the repeating code. It also covers digital input/output functions, variables, conditional statements, boolean logic, and interrupts. Examples are provided for blinking LEDs, reading sensors, and creating simple programs.
The document discusses various operators in C++ including assignment operators, increment and decrement operators, logical operators, and the common mistake of confusing the equality operator (==) and the assignment operator (=).
It provides examples of how to use assignment operator abbreviations, preincrement and postincrement operators, logical operators like AND (&&), OR (||), and NOT (!) in conditions. It also demonstrates the different repetition structures like while, for, and do-while loops. Finally, it cautions about accidentally using the assignment operator instead of equality operator in conditions.
The document provides code and instructions for three Arduino projects using an LCD screen:
1) A "Hello World" display that prints text to the LCD screen.
2) A weather station that reads temperature and humidity from a sensor and displays the readings.
3) An optional "Magic 8 Ball" project that displays random answers when shaken.
Similar to Digital Voltmeter displaying voltage level on a seven segment display and computer (20)
Low Noise Amplifier at 2 GHz using the transistor NE85639 in ADSKarthik Rathinavel
• Systematically designed a LNA and its biasing using non-ideal components such as Microstrip TLs resistors, capacitors etc.
• Calculated the S parameters of the Transistor and simulated the gain and bandwidth to be 10 dB and 1 GHz respectively.
• Achieved a Noise Figure of 3.2 dB and s11 of -20 dB in the final design.
• Designed a single stage folded cascode op-amp which had atleast 50 dB gain and 135 MHz Unity Gain Bandwidth for the three temperature corners (typical, slow and fast), in Cadence.
• The op-amp had a phase margin of atleast 64º and an output swing of atleast 1.46 V for the temperature corners (27,-40,100).
• Designed a common mode feedback for the amplifier and achieved a common mode accuracy of 0.01 V.
Differntial Input to Single Ended Output, Two stage Op-ampKarthik Rathinavel
This document summarizes a project to design a differential input, single ended output two-stage operational amplifier. The design approach was to bring all transistors into saturation at a common mode voltage of 0V and meet gain, phase margin, and unity gain frequency specifications. A compensation capacitor was increased to move the dominant pole in while a nulling resistor eliminated the effect of a zero, improving phase margin and unity gain frequency. Simulation results met all specifications, with an open loop gain of 67.97dB, phase margin of 75.3 degrees, and unity gain frequency of 15.29MHz. The input common mode range was -0.852V to 0.181V and output swing was -0.771V to 0
Continuous Low Pass Filter Realization using Cascaded stages of Tow-Thomas Bi...Karthik Rathinavel
Designed a Continuous Low Pass Filter using three stages of cascaded Tow-Thomas Bi-quads which met the following specifications:-
Pass band: DC to fp = 20 kHz, gain between 0 dB & 1 dB.
Stop band: f > fs = 40 kHz, gain below -50 dB
Found the transfer function, poles and zeros of the required filter using MATLAB. Used Cadence to plot the frequency response of the gain of the overall transfer function using ideal op-amps and non-ideal op-amps.Used dynamic optimization and dynamic range scaling of the elements (resistors and capacitors) such that the output of each stage had a good output swing.
1. The document describes a project that transmits digital signals through light pulses using LEDs and photodiodes. A microcontroller generates pulses that drive an LED, transmitting the signal through light. A photodiode receives the light and the microcontroller interprets and plots the signal.
2. The transmitter code generates pulses by alternating the output pin between high and low with delays. The receiver reads the photodiode voltage and sends it to a computer to plot the square wave signal graphically, showing accurate signal transmission.
3. Testing without the LED showed noise in the receiver between 1.28-1.32 volts, demonstrating the need for an optical signal to transmit data distinctly.
1) The document describes a project using an audio signal to modulate the intensity of an LED. A summing amplifier combines the audio signal with a bias voltage to vary the LED's brightness accordingly.
2) Light from the LED falls on a phototransistor, which amplifies the signal. With headphones, the transmitted audio could be heard clearly, demonstrating successful wireless transmission.
3) While proof-of-concept was achieved, the document discusses using lasers and fiber optics to transmit signals over greater distances with higher information content.
1) The document describes a project to modulate an audio signal onto a LED by varying the current through the LED.
2) The authors designed a summing amplifier circuit to modulate the audio signal onto the LED current and analyzed the input, modulated, and transmitted signals.
3) Their results showed they were successfully able to modulate the audio signal and transmit it across the LED, though the transmitted signal strength was low which could be addressed with a current amplifier.
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Sinan KOZAK
Sinan from the Delivery Hero mobile infrastructure engineering team shares a deep dive into performance acceleration with Gradle build cache optimizations. Sinan shares their journey into solving complex build-cache problems that affect Gradle builds. By understanding the challenges and solutions found in our journey, we aim to demonstrate the possibilities for faster builds. The case study reveals how overlapping outputs and cache misconfigurations led to significant increases in build times, especially as the project scaled up with numerous modules using Paparazzi tests. The journey from diagnosing to defeating cache issues offers invaluable lessons on maintaining cache integrity without sacrificing functionality.
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...IJECEIAES
Medical image analysis has witnessed significant advancements with deep learning techniques. In the domain of brain tumor segmentation, the ability to
precisely delineate tumor boundaries from magnetic resonance imaging (MRI)
scans holds profound implications for diagnosis. This study presents an ensemble convolutional neural network (CNN) with transfer learning, integrating
the state-of-the-art Deeplabv3+ architecture with the ResNet18 backbone. The
model is rigorously trained and evaluated, exhibiting remarkable performance
metrics, including an impressive global accuracy of 99.286%, a high-class accuracy of 82.191%, a mean intersection over union (IoU) of 79.900%, a weighted
IoU of 98.620%, and a Boundary F1 (BF) score of 83.303%. Notably, a detailed comparative analysis with existing methods showcases the superiority of
our proposed model. These findings underscore the model’s competence in precise brain tumor localization, underscoring its potential to revolutionize medical
image analysis and enhance healthcare outcomes. This research paves the way
for future exploration and optimization of advanced CNN models in medical
imaging, emphasizing addressing false positives and resource efficiency.
Discover the latest insights on Data Driven Maintenance with our comprehensive webinar presentation. Learn about traditional maintenance challenges, the right approach to utilizing data, and the benefits of adopting a Data Driven Maintenance strategy. Explore real-world examples, industry best practices, and innovative solutions like FMECA and the D3M model. This presentation, led by expert Jules Oudmans, is essential for asset owners looking to optimize their maintenance processes and leverage digital technologies for improved efficiency and performance. Download now to stay ahead in the evolving maintenance landscape.
Advanced control scheme of doubly fed induction generator for wind turbine us...IJECEIAES
This paper describes a speed control device for generating electrical energy on an electricity network based on the doubly fed induction generator (DFIG) used for wind power conversion systems. At first, a double-fed induction generator model was constructed. A control law is formulated to govern the flow of energy between the stator of a DFIG and the energy network using three types of controllers: proportional integral (PI), sliding mode controller (SMC) and second order sliding mode controller (SOSMC). Their different results in terms of power reference tracking, reaction to unexpected speed fluctuations, sensitivity to perturbations, and resilience against machine parameter alterations are compared. MATLAB/Simulink was used to conduct the simulations for the preceding study. Multiple simulations have shown very satisfying results, and the investigations demonstrate the efficacy and power-enhancing capabilities of the suggested control system.
2. if (number1 == 0)
begin
get_adc_data <= 1;
end
else if (number1 == 1)
begin
get_adc_data <= 0;
end
else if (number1 == 1500000)//3 or above
begin
number1 <= 0;
get_adc_data <= 1;
end
number1 <= number1 +1;
end
end
/////////////////////////////////End of making a getadc
pulse//////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
///////////////////
///////////////////////State Machine for
Sclk//////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////
logic [1:0] tecount;
//
always_ff@(posedge c0_sig or negedge reset)
begin
if (!reset)
begin
Sclk <= 1;
tecount <=0;
end
else
begin
if (tecount <2)
begin
tecount <= tecount+1;
Sclk <= Sclk;
end
else ///tecount hits 2
begin
tecount <= tecount; ////tecount stays at 2
if (Sclk==1)
begin
if (Present_State == Start)
Sclk <= ~Sclk;
else ///Sclk present state is anything else like stop or
idle
Sclk <= Sclk;
3. end
else////Sclk is a zero
begin
Sclk <= ~Sclk;
end
end
end
end
////////////////////////End of State Machine
1/////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////
///////////////////////State Machine for
Bitcount//////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////
logic [4:0] bit_count;
logic [4:0] bit_count_next;
//
always_ff@(negedge Sclk or negedge reset) begin
if (!reset)
begin
bit_count <= 17;
bit_count_next <= 16;
///Sclk <= 1;
end
else
begin
bit_count <= bit_count_next;
end
bit_count_next <= bit_count_next;
end
always_comb
begin
if (bit_count==17)
begin
////Do we really need this?
if (Sclk==1 && Present_State == Start)
bit_count_next = 16;
else
bit_count_next = 17;
end
else if (bit_count==16)
begin
bit_count_next = 15;
end
else if (bit_count==15)
begin
bit_count_next = 14;
4. end
else if (bit_count==14)
begin
bit_count_next = 13;
end
else if (bit_count==13)
begin
bit_count_next = 12;
end
else if (bit_count==12)
begin
bit_count_next = 11;
end
else if (bit_count==11)
begin
bit_count_next = 10;
end
else if (bit_count==10)
begin
bit_count_next = 9;
end
else if (bit_count==9)
begin
bit_count_next = 8;
end
else if (bit_count==8)
begin
bit_count_next = 7;
end
else if (bit_count==7)
begin
bit_count_next = 6;
end
else if (bit_count==6)
begin
bit_count_next = 5;
end
else if (bit_count==5)
begin
bit_count_next = 4;
end
else if (bit_count==4)
begin
bit_count_next = 3;
end
else if (bit_count==3)
begin
bit_count_next = 2;
end
else if (bit_count==2)
begin
5. bit_count_next = 1;
end
else if (bit_count==1)
begin
bit_count_next = 0;
end
else //if (bit_count==0)
begin
bit_count_next = 17;
end
end
////////Din is now good to go
//assign Add0 = 1'b0;
//assign Add1 = 1'b0;
//assign Add2 = 1'b0;
always_comb
begin
unique case (bit_count)
14 : Din = Add2;
13 : Din = Add1;
12 : Din = Add0;
endcase
end
//////////////////////////End of State Machine for
Bit_Count///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
///////////////////
///////////////////////////Final State Machine for looking at Present
State////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////
typedef enum { Idle, Start, Stop } ADC;
ADC Present_State;
ADC Next_State;
//
logic recount;
logic adc_data_ready;
//
always_ff@(posedge c0_sig or negedge reset) //RUNNING ON 3MHz CLOCK!!
begin
if (!reset)
begin
Present_State <= Idle;
recount <=0;
end
else
begin
if (recount <= 0)
6. begin
recount<=1;
Present_State <= Present_State;
end
else/// (recount == 1)
begin
Present_State <= Next_State;
recount <= 1;
end
end
end
always_comb
begin
cs_n = 1;
if (Present_State == Idle)
begin
cs_n = 1;
adc_data_ready = 0;
if (get_adc_data == 1)
begin
Next_State =Start;
end
else///get adc data is 0
begin
Next_State =Idle;
end
end
else if (Present_State == Start)
begin
cs_n = 0;
adc_data_ready = 0;
if (bit_count == 0 && Sclk==1)
////Really Needs to be checked??
Next_State = Stop;
else //bitcount is between
17 to 1 both included
Next_State = Start;
end
else // (Present_State == Stop)
begin
cs_n = 1;
adc_data_ready = 1;
Next_State = Idle;
end
end
//////////////////////////////////////////End of Final State
Machine////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
8. end
else if (bit_count == 7)
begin
voltage_value_address[6] <= Dout;
end
else if (bit_count == 6)
begin
voltage_value_address[5] <= Dout;
end
else if (bit_count == 5)
begin
voltage_value_address[4] <= Dout;
end
else if (bit_count == 4)
begin
voltage_value_address[3] <= Dout;
end
else if (bit_count == 3)
begin
voltage_value_address[2] <= Dout;
end
else if (bit_count == 2)
begin
voltage_value_address[1] <= Dout;
end
else if (bit_count == 1)
begin
voltage_value_address[0] <= Dout;
end
end
end
///////////////////////////////////End of Shift
Register////////////////////////////////////////////////////////////////////////
/////////
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////
////////////////////////////////////ROM/////////////////////////////////////////
//////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////
wire clock_sig = get_adc_data; ///Rom Updation
occurs once in 0.5secs(not system clock?)
//wire address_sig = voltage_value_address;
logic [11:0] voltage_reading;
//
Rom_for_voltage_levels Rom_for_voltage_levels_inst (
.address ( voltage_value_address ),
.clock ( clock_sig ),
.q ( voltage_reading )
);
9. //////////////////////////////////End of
ROM/////////////////////////////////////////////////////////////////////////////
//////////////////
////////////////////////////////////////////////////////////////////////////////
/////
/////////////////////////////Separating
digits/////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
///
logic [3:0] thousands_digit;
logic [3:0] hundreds_digit;
logic [3:0] tens_digit;
logic [3:0] ones_digit;
assign en2 = 1'b0;
assign pwm_out = 1'b0;
always@(posedge inclk0_sig)
begin
thousands_digit = voltage_reading/1000;
hundreds_digit = (voltage_reading%1000)/100;
tens_digit = ((voltage_reading%1000)%100)/10;
ones_digit = ((voltage_reading%1000)%100)%10;
end
////////////////////////////////////End of Separtaing
deigits////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
///////////////
///////////////// State Machine present state of digit becomes new state every
clock edge///////////////
////////////////////////////////////////////////////////////////////////////////
///////////////
logic [3:0] muxo;
logic [3:0] present_state_digit;
logic [3:0] next_state_digit;
//
always_ff@(posedge c1_sig)
present_state_digit <= next_state_digit;
///Saving the state
//////////////Making it go to the next state. Incrementing present
state/////////////////////
always_comb
begin
unique case (present_state_digit)
4'b0000 : next_state_digit = 4'b0001;
//Ones Digit State
4'b0001 : next_state_digit = 4'b0010;
//Idle State
4'b0010 : next_state_digit = 4'b0011;
//Tens Digit State
4'b0011 : next_state_digit = 4'b0100;
//Idle State
10. 4'b0100 : next_state_digit = 4'b0101;
//Hundreds Digit State
4'b0101 : next_state_digit = 4'b0110;
//Idle State
4'b0110 : next_state_digit = 4'b0111;
//Thousands State
4'b0111 : next_state_digit = 4'b1000;
//Idle State
4'b1000 : next_state_digit = 4'b0000;
//Circles Back
endcase
end
// MUX: Displaying Output of each of three digits; one after the other
always_comb
begin
if (present_state_digit == 0)
begin
muxo = ones_digit;
// mux out is first digit
sel = 3'b000;
en3 = 1'b1;
D_P = 1;
end
else if (present_state_digit == 1)
//Idle between States
begin
muxo = 9;
// mux out is random
sel = 3'b111;
//Nothing Happens
en3 = 1'b0;
D_P = 1;
end
else if (present_state_digit == 2)
begin
muxo = tens_digit;
// mux out is tens digit
sel = 3'b001;
// if (voltage_reading < 10)
// Zero Supression for Tens Digit
// en3 = 1'b0;
// else
en3 = 1'b1;
D_P = 1;
end
else if (present_state_digit == 3)
//Idle between States
begin
muxo = 9;
// mux out is random
sel = 3'b111;
//Nothing Happens
en3 = 1'b0;
D_P = 1;
end
else if (present_state_digit == 4)
11. begin
muxo = hundreds_digit; //
mux out is hundreds digit
sel = 3'b011;
// if (voltage_reading < 100)
// Zero Supression for Hundreds Digit
// en3 = 1'b0;
// else
en3 = 1'b1;
D_P = 1;
end
else if (present_state_digit == 5)
//Idle State
begin
muxo = 9;
// mux out is random
sel = 3'b111;
//Nothing Happens
en3 = 1'b0;
D_P = 1;
end
else if (present_state_digit == 6)
begin
muxo = thousands_digit; //
mux out is thousands digit
sel = 3'b100;
// if (voltage_reading < 1000)
// Zero Supression for Thousands Digit
// en3 = 1'b0;
// else
en3 = 1'b1;
D_P = 0;
end
else if (present_state_digit == 7)
//Idle State
begin
muxo = 9;
// mux out is random
sel = 3'b111;
//Nothing Happens
en3 = 1'b0;
D_P = 1;
end
else
begin
muxo = 9;
//Doesn't Matter
sel = 3'b011;
//Going nowhere
en3 = 1'b0;
//Also Output is disabled
D_P = 1;
end
end
///////////////////////bcd to seven segment
decoder///////////////////////////////
12. always_comb begin
casez (muxo) //gfedcba
4'b0000 : seven_segment = 7'b1000000; //seven
segment display of 0
4'b0001 : seven_segment = 7'b1111001; //seven
segment display of 1
4'b0010 : seven_segment = 7'b0100100; //seven
segment display of 2
4'b0011 : seven_segment = 7'b0110000; //seven
segment display of 3
4'b0100 : seven_segment = 7'b0011001; //seven
segment display of 4
4'b0101 : seven_segment = 7'b0010010; //seven
segment display of 5
4'b0110 : seven_segment = 7'b0000010; //seven
segment display of 6
4'b0111 : seven_segment = 7'b1111000; //seven
segment display of 7
4'b1000 : seven_segment = 7'b0000000; //seven
segment display of 8
4'b1001 : seven_segment = 7'b0010000; //seven
segment display of 9
4'b1111 : seven_segment = 7'b0000000; //Doesn't
Matter Not Going to Display
default : seven_segment = 7'b1000000; //seven
segment displaying 0
endcase
end
//
////////////////////////////////////////////////////////////////////////////////
///////////////
////////////////////////////Binary Number to
ASCII///////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////
logic [7:0] ASCII_Number_thousands;
logic [7:0] ASCII_Number_hundreds;
logic [7:0] ASCII_Number_tens;
logic [7:0] ASCII_Number_ones;
//
always_comb
begin
ASCII_Number_thousands = thousands_digit + 48;
ASCII_Number_hundreds = hundreds_digit + 48;
ASCII_Number_tens = tens_digit + 48;
ASCII_Number_ones = ones_digit + 48;
end
/////////////////////////////////End of Binary to
ASCII/////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////
////////////////////////////////MUX: For Char
Select///////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////
logic [7:0] char_mux_output;
logic [3:0] char_mux_sel;
13. logic [3:0] char_mux_sel_next;
//
always_ff@(posedge c2_sig or negedge reset)
begin
if (!reset)
char_mux_sel <= 6;
else
char_mux_sel <= char_mux_sel_next;
///Incrementing the state
end
//
always_comb
begin
if (char_mux_sel == 0)
begin
char_mux_output = ASCII_Number_thousands; //
sel ASCII number Thousand
if (bit_mux_sel_present==9)
char_mux_sel_next = 1;
else
char_mux_sel_next = 0;
end
else if (char_mux_sel == 1)
begin
char_mux_output = 46;
// sel decimel-point (.)
if (bit_mux_sel_present==9)
char_mux_sel_next = 2;
else
char_mux_sel_next = 1;
end
else if (char_mux_sel == 2)
begin
char_mux_output = ASCII_Number_hundreds; //
sel ASCII number Hundred
if (bit_mux_sel_present==9)
char_mux_sel_next = 3;
else
char_mux_sel_next = 2;
end
else if (char_mux_sel == 3)
begin
char_mux_output = ASCII_Number_tens;
// sel ASCII number Tens
if (bit_mux_sel_present==9)
char_mux_sel_next = 4;
else
char_mux_sel_next = 3;
end
else if (char_mux_sel == 4)
begin
char_mux_output = ASCII_Number_ones;
// sel ASCII number ones
if (bit_mux_sel_present==9)
char_mux_sel_next = 5;
else
char_mux_sel_next = 4;
14. end
else if (char_mux_sel == 5)
begin
char_mux_output = 10;
// sel Line Feed
if (bit_mux_sel_present==9)
char_mux_sel_next = 6;
else
char_mux_sel_next = 5;
end
else //if (char_mux_sel == 6)
begin
char_mux_output = 13;
// sel Carrage return
if (bit_mux_sel_present==9)
char_mux_sel_next = 0;
else
char_mux_sel_next = 6;
end
end
///////////////////////////////End of Char MUX
Select////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////
////////////////////////////////Bit Mux going to
USB///////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////
logic [3:0] bit_mux_sel_present;
logic [3:0] bit_mux_sel_next;
//
always_ff@(posedge c2_sig or negedge reset)
begin
if (!reset)
bit_mux_sel_present <= 9;
else
bit_mux_sel_present <= bit_mux_sel_next;
///Incrementing the state
end
//
always_comb
begin
unique case (bit_mux_sel_present)
0 : bit_mux_sel_next = 1;
1 : bit_mux_sel_next = 2;
2 : bit_mux_sel_next = 3;
3 : bit_mux_sel_next = 4;
4 : bit_mux_sel_next = 5;
16. //
always_ff@(posedge c2_sig or negedge reset)
begin
if (!reset)
begin
present_state_receiver <= Stopo;
// next_state_receiver <= Stopo;
count_to_seven <= 0;
end
else
begin
if (present_state_receiver == Stopo)
begin
present_state_receiver <= next_state_receiver;
count_to_seven <= 0;
end
else //if (present_state_receiver == Starto)
begin
if (count_to_seven < 7)
begin
count_to_seven <= count_to_seven +1;
present_state_receiver <= present_state_receiver;
end
else //count_to_seven is 7
begin
count_to_seven <= 0;
present_state_receiver <= Stopo;
end
end
end
end
always_comb
begin
if (present_state_receiver == Stopo)
begin
if (TXD == 0 && count_to_seven == 0)
begin
next_state_receiver = Starto;
save_this = 1;
end
else
begin
next_state_receiver = Stopo;
save_this = 0;
end
end
else //if (present_state_receiver == Starto)
begin
if (count_to_seven < 8 )
begin
save_this = 1; //save it to a shift
next_state_receiver = Starto;
end
else /// It's done saving data because count is 8 or something
begin
save_this = 0; //change this and make it
17. stick to it
next_state_receiver = Stopo;
end
end
end
///////////////////////End of State Machine for Receiving Data From
Laptop//////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////
////////////////////////////Shift Register for Collecting Data
Received////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////
logic [7:0] ASCII_number_received;
//
always_ff@(posedge c2_sig or negedge reset)
begin
if (!reset)
ASCII_number_received <= 0;
else
begin
if (save_this == 1)
begin
if (count_to_seven < 7)
begin
if (count_to_seven == 0)
begin
ASCII_number_received[0] <= TXD;
end
else if (count_to_seven == 1)
begin
ASCII_number_received[1] <= TXD;
end
else if (count_to_seven == 2)
begin
ASCII_number_received[2] <= TXD;
end
else if (count_to_seven == 3)
begin
ASCII_number_received[3] <= TXD;
end
else if (count_to_seven == 4)
begin
ASCII_number_received[4] <= TXD;
end
else if (count_to_seven == 5)
begin
ASCII_number_received[5] <= TXD;
end
else if (count_to_seven == 6)
begin
18. ASCII_number_received[6] <= TXD;
end
else if (count_to_seven == 7)
begin
ASCII_number_received[7] <= TXD;
end
end
else //count is 7
begin
ASCII_number_received[0] <= ASCII_number_received[0];
ASCII_number_received[1] <= ASCII_number_received[1];
ASCII_number_received[2] <= ASCII_number_received[2];
ASCII_number_received[3] <= ASCII_number_received[3];
ASCII_number_received[4] <= ASCII_number_received[4];
ASCII_number_received[5] <= ASCII_number_received[5];
ASCII_number_received[6] <= ASCII_number_received[6];
ASCII_number_received[7] <= ASCII_number_received[7];
end
end
else //if (save_this == 0) DONT SAVE
begin
ASCII_number_received[0] <= ASCII_number_received[0];
ASCII_number_received[1] <= ASCII_number_received[1];
ASCII_number_received[2] <= ASCII_number_received[2];
ASCII_number_received[3] <= ASCII_number_received[3];
ASCII_number_received[4] <= ASCII_number_received[4];
ASCII_number_received[5] <= ASCII_number_received[5];
ASCII_number_received[6] <= ASCII_number_received[6];
ASCII_number_received[7] <= ASCII_number_received[7];
end
end
end
/////////////////////////////////End of Shift Register for Collecting
Data/////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////
//////////////////////////////////////////////Selecting
Channel///////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////
////////////////////////LEDS On FPGA Indicating Which channel is
selected////////////////////////////////////////////////////
always_comb
begin
case (ASCII_number_received)
48: LED_TEST = 1;
49: LED_TEST = 2;
50: LED_TEST = 4;
51: LED_TEST = 8;
19. 52: LED_TEST = 16;
53: LED_TEST = 32;
54: LED_TEST = 64;
55: LED_TEST = 128;
default : LED_TEST = 1;
endcase
end
/////////////////////////////////End of Indicating Channel
Selection/////////////////////////////////////////
logic Add0;
logic Add1;
logic Add2;
//
always_comb
begin
if (ASCII_number_received == 48)
begin
Add0 = 0;
Add1 = 0;
Add2 = 0;
end
else if (ASCII_number_received == 49)
begin
Add2 = 0;
Add1 = 0;
Add0 = 1;
end
else if (ASCII_number_received == 50)
begin
Add2 = 0;
Add1 = 1;
Add0 = 0;
end
else if (ASCII_number_received == 51)
begin
Add2 = 0;
Add1 = 1;
Add0 = 1;
end
else if (ASCII_number_received == 52)
begin
Add2 = 1;
Add1 = 0;
Add0 = 0;
end
else if (ASCII_number_received == 53)
begin
Add2 = 1;
Add1 = 0;
Add0 = 1;
end
else if (ASCII_number_received == 54)
begin
Add2 = 1;
Add1 = 1;
Add0 = 0;
20. end
else if (ASCII_number_received == 55)
begin
Add2 = 0;
Add1 = 0;
Add0 = 1;
end
else //if (ASCII_number_received == 0)
begin
Add2 = 0;
Add1 = 0;
Add0 = 0;
end
end
//////////////////////////////////////End of Selecting
Channel///////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////
/////////////////////////////////////////////////END OF
MODULE///////////////////////////////////////////
endmodule