Switch Control and Time Delay
1. LEDs and switches
2. Keypad and LEDs
3. Keypad and 8-segment LED C language and Assembly Code for Freescale MC9S08AW60
Verilog HDL is introduced for modeling digital hardware at different levels of abstraction. Key concepts discussed include:
- Module instantiation, assignments, and procedural blocks for behavioral modeling.
- Concurrency is modeled using an event-based simulation approach with a time wheel concept.
- Switch level and gate level modeling using built-in primitives like transistors and logic gates.
- User-defined primitives (UDPs) allow custom logic to augment pre-defined primitives.
The document discusses microcontrollers and the PIC16F877 microcontroller in particular. It provides the following key points:
- A microcontroller is a single-chip computer containing a processor, memory, and input/output peripherals. Microcontrollers can store and run user-written programs.
- The main parts of a microcontroller include a CPU, RAM, ROM, I/O lines, timers, and analog-to-digital and digital-to-analog converters.
- The PIC16F877 is chosen for its low cost, reliability, ease of use, and ability to perform a wide range of tasks using C language software.
7.1 Data types and time delay in 8051 C
7.2 I/O programming in 8051 C
7.3 Logic operations in 8051 C
7.4 Data conversion programs in 8051 C
7.5 Accessing code ROM space in 8051 C
7.6 Data serialization using 8051 C
The 8051 microcontroller has an 8-bit architecture and uses assembler directives like DB, ORG, and EQU to define data and constants. It allows individual bits of I/O ports to be accessed using instructions like SETB, CLR, JNB, and JB, enabling control of devices with bit-level granularity. Read-modify-write instructions also allow reading, modifying, and writing port values in a single operation.
The document outlines the syllabus for an Introduction to Microprocessors lab course. The syllabus includes topics such as studying the 8085 and 8086 microprocessor systems, developing programs to find the largest/smallest number, convert temperatures, compute squares, and sort numbers, and interfacing components like RAM, keyboard controllers, DMA controllers, and UARTs/USARTs to microprocessors. The document then provides details on studying the 8085 microprocessor system including its architecture, address and data buses, control signals, and functional description. It also provides details on studying the 8086 microprocessor system including its features, pin descriptions, and operating modes.
The document contains questions and explanations about C programming keywords and concepts like pointers, arrays, structures, unions, and bit manipulation. It provides definitions and examples for keywords like #define, #include, #pragma, #asm, #ifdef, and #endif. It also gives solutions to questions about pointers, counting bits to access specific bits or bytes of memory at a particular address, and explaining differences between array parameters and pointers in function definitions in C.
The document describes various arithmetic instructions for Allen-Bradley, Siemens, and ControlLogix PLCs. It defines instructions like ADD, SUB, MUL, and DIV and explains how they perform basic arithmetic operations by taking values from source operands and storing the result in a destination operand. The document also discusses arithmetic status bits that provide information about the result of the last instruction executed.
The document provides an overview of Verilog, including:
1) Why HDLs like Verilog are needed for designing large, complex hardware systems.
2) Basic Verilog syntax such as modules, ports, parameters, nets, registers, operators, assignments.
3) How to model hardware features in Verilog like combinational logic, sequential logic, timing, case statements.
This is 2nd lecture of course on Microprocessor theory and Interfacing. This lecture discusses the Internal architecture of 8085 microprocessor in detail along with it's pin description.
This document contains lecture notes on Verilog syntax and structural modeling. It discusses various Verilog concepts like commenting code, numbers and identifiers, vectors, arrays, parameters and defines, gate primitives, and hierarchy. It provides examples of modeling half adders and full adders structurally and behaviorally using primitives, modules, and always blocks. The document emphasizes choosing descriptive names and commenting code to explain the purpose or motivation behind design decisions.
Lecture 03 Arithmetic Group of InstructionsZeeshan Ahmed
Course on Microprocessor Theory and Interfacing. This is 4th lecture on 8085 microprocessor which include arithmetic instructions like add, subtract, BCD addition in detail.
The document discusses C programming for PIC microcontrollers. It covers the standard structure of a C program, including comments, header files, configuration bits, functions, and function bodies. It also discusses various C data types like unsigned char, signed char, unsigned int, and signed int. Examples are provided to illustrate how to use these data types and write C programs that toggle ports on a PIC microcontroller. The outcomes are for students to understand C programming languages for PIC18, the structure of C programs for PIC18, and common C data types used for PIC microcontrollers.
This document discusses switch level modeling in Verilog. It describes different types of transistor switches that can be used as primitives in Verilog, including nmos, pmos, rnmos, rpmos, and cmos switches. It also covers bidirectional switches like tran, tranif1, and examples of how to use the switches to model basic logic gates and memory cells like a RAM cell. Time delays can be specified for switches. Switch level modeling allows designing circuits using transistors directly in Verilog.
The document discusses various arithmetic instructions in assembly language including INC, DEC, ADD, SUB, MUL, DIV.
It explains the syntax and usage of each instruction, showing how they can increment, decrement, add, subtract, multiply or divide operands in registers or memory. Examples are given to illustrate how to perform basic arithmetic operations like addition and multiplication of numbers entered by the user.
The document discusses shift register instructions in Allen-Bradley PLCs and PACs. It describes how shift register instructions allow the contents of a register to move bits left or right through a bit array. Specifically, it outlines the parameters and functionality of bit shift left and bit shift right instructions, including how they shift bits in an array one position per rung transition using status bits in a control file.
Hardware description languages (HDLs) allow designers to describe digital systems at different levels of abstraction in a textual format. The two most commonly used HDLs are Verilog and VHDL. Verilog is commonly used in the US, while VHDL is more popular in Europe. HDLs enable simulation of designs before fabrication to verify functionality. Digital designs can be modeled at the gate level, data flow level, or behavioral level in Verilog. Verilog code consists of a design module and test bench module to stimulate inputs and observe outputs.
The document describes the design and simulation of basic logic gates and a 2-to-4 decoder using Verilog HDL. It includes the block diagrams, truth tables, and Verilog code for AND, OR, NAND, NOR, XOR, XNOR and NOT gates. Testbenches are provided to simulate and verify the gate designs. The 2-to-4 decoder section provides the block diagram, theory of operation, and Verilog code using dataflow, behavioral and structural modeling styles. A testbench is also included to simulate the 2-to-4 decoder design.
The document discusses modules and ports in Verilog. It describes that a module defines distinct parts including module name, port list, port declarations, and optional parameters. Ports provide the interface for a module to communicate with its environment. There are two methods for connecting ports to external signals - by ordered list where signals must appear in the same order as ports, and by name where the order does not matter as long as port names match. Hierarchical names provide unique names for every identifier by denoting the design hierarchy with identifiers separated by periods.
The document contains sample test papers for a diploma subject on microprocessors. It covers topics like 8085 architecture, assembly language programming, interfacing I/O devices like 8255, 8155 and 8253 with 8085. The questions are in multiple choice and descriptive form evaluating student's understanding of microprocessor fundamentals, I/O interfacing, assembly language programming and applications.
The document provides an overview of digital circuits and microcomputers. It defines key digital logic terms and concepts like binary numbers, logic gates, Boolean algebra, and Karnaugh maps. It also describes the functional blocks of a microcomputer like CPU, memory, and I/O. Memory types like RAM, ROM, and mass storage are discussed. Assembly language programming and compilers are briefly covered.
Programming ATmega microcontroller using Embedded CVarun A M
Embedded C is a subset of C used for microcontrollers. It uses header files specific to microcontrollers and removes input/output functions like scanf and printf since sensors provide input and ports provide output. Control structures like if/else statements and loops remain the same. Programs configure ports as inputs or outputs using Data Direction and Port registers and read/write values to Port registers to set pin values. An example blinks an LED connected to port B by setting the port high, waiting, and setting it low in a loop.
Computer organization and architecture lab manual Shankar Gangaju
This document contains information about a computer organization and architecture lab. It includes details about the lab report format, integer representation using fixed point, two's complement, addition and subtraction algorithms and hardware. It also discusses logical operations, and provides MATLAB code examples for 4-bit binary addition, subtraction, multiplication and restoring division algorithms.
The document discusses common digital logic circuits including decoders, encoders, demultiplexers and multiplexers. It provides an overview of how these circuits work at a block level and then goes into more detail on decoders, describing their functionality, truth tables, and implementations including how to build larger decoders from smaller ones. Standard MSI decoder chips are also presented.
The document provides an overview of Verilog, including:
1) Why HDLs like Verilog are needed for designing large, complex hardware systems.
2) Basic Verilog syntax such as modules, ports, parameters, nets, registers, operators, assignments.
3) How to model hardware features in Verilog like combinational logic, sequential logic, timing, case statements.
This is 2nd lecture of course on Microprocessor theory and Interfacing. This lecture discusses the Internal architecture of 8085 microprocessor in detail along with it's pin description.
This document contains lecture notes on Verilog syntax and structural modeling. It discusses various Verilog concepts like commenting code, numbers and identifiers, vectors, arrays, parameters and defines, gate primitives, and hierarchy. It provides examples of modeling half adders and full adders structurally and behaviorally using primitives, modules, and always blocks. The document emphasizes choosing descriptive names and commenting code to explain the purpose or motivation behind design decisions.
Lecture 03 Arithmetic Group of InstructionsZeeshan Ahmed
Course on Microprocessor Theory and Interfacing. This is 4th lecture on 8085 microprocessor which include arithmetic instructions like add, subtract, BCD addition in detail.
The document discusses C programming for PIC microcontrollers. It covers the standard structure of a C program, including comments, header files, configuration bits, functions, and function bodies. It also discusses various C data types like unsigned char, signed char, unsigned int, and signed int. Examples are provided to illustrate how to use these data types and write C programs that toggle ports on a PIC microcontroller. The outcomes are for students to understand C programming languages for PIC18, the structure of C programs for PIC18, and common C data types used for PIC microcontrollers.
This document discusses switch level modeling in Verilog. It describes different types of transistor switches that can be used as primitives in Verilog, including nmos, pmos, rnmos, rpmos, and cmos switches. It also covers bidirectional switches like tran, tranif1, and examples of how to use the switches to model basic logic gates and memory cells like a RAM cell. Time delays can be specified for switches. Switch level modeling allows designing circuits using transistors directly in Verilog.
The document discusses various arithmetic instructions in assembly language including INC, DEC, ADD, SUB, MUL, DIV.
It explains the syntax and usage of each instruction, showing how they can increment, decrement, add, subtract, multiply or divide operands in registers or memory. Examples are given to illustrate how to perform basic arithmetic operations like addition and multiplication of numbers entered by the user.
The document discusses shift register instructions in Allen-Bradley PLCs and PACs. It describes how shift register instructions allow the contents of a register to move bits left or right through a bit array. Specifically, it outlines the parameters and functionality of bit shift left and bit shift right instructions, including how they shift bits in an array one position per rung transition using status bits in a control file.
Hardware description languages (HDLs) allow designers to describe digital systems at different levels of abstraction in a textual format. The two most commonly used HDLs are Verilog and VHDL. Verilog is commonly used in the US, while VHDL is more popular in Europe. HDLs enable simulation of designs before fabrication to verify functionality. Digital designs can be modeled at the gate level, data flow level, or behavioral level in Verilog. Verilog code consists of a design module and test bench module to stimulate inputs and observe outputs.
The document describes the design and simulation of basic logic gates and a 2-to-4 decoder using Verilog HDL. It includes the block diagrams, truth tables, and Verilog code for AND, OR, NAND, NOR, XOR, XNOR and NOT gates. Testbenches are provided to simulate and verify the gate designs. The 2-to-4 decoder section provides the block diagram, theory of operation, and Verilog code using dataflow, behavioral and structural modeling styles. A testbench is also included to simulate the 2-to-4 decoder design.
The document discusses modules and ports in Verilog. It describes that a module defines distinct parts including module name, port list, port declarations, and optional parameters. Ports provide the interface for a module to communicate with its environment. There are two methods for connecting ports to external signals - by ordered list where signals must appear in the same order as ports, and by name where the order does not matter as long as port names match. Hierarchical names provide unique names for every identifier by denoting the design hierarchy with identifiers separated by periods.
The document contains sample test papers for a diploma subject on microprocessors. It covers topics like 8085 architecture, assembly language programming, interfacing I/O devices like 8255, 8155 and 8253 with 8085. The questions are in multiple choice and descriptive form evaluating student's understanding of microprocessor fundamentals, I/O interfacing, assembly language programming and applications.
The document provides an overview of digital circuits and microcomputers. It defines key digital logic terms and concepts like binary numbers, logic gates, Boolean algebra, and Karnaugh maps. It also describes the functional blocks of a microcomputer like CPU, memory, and I/O. Memory types like RAM, ROM, and mass storage are discussed. Assembly language programming and compilers are briefly covered.
Programming ATmega microcontroller using Embedded CVarun A M
Embedded C is a subset of C used for microcontrollers. It uses header files specific to microcontrollers and removes input/output functions like scanf and printf since sensors provide input and ports provide output. Control structures like if/else statements and loops remain the same. Programs configure ports as inputs or outputs using Data Direction and Port registers and read/write values to Port registers to set pin values. An example blinks an LED connected to port B by setting the port high, waiting, and setting it low in a loop.
Computer organization and architecture lab manual Shankar Gangaju
This document contains information about a computer organization and architecture lab. It includes details about the lab report format, integer representation using fixed point, two's complement, addition and subtraction algorithms and hardware. It also discusses logical operations, and provides MATLAB code examples for 4-bit binary addition, subtraction, multiplication and restoring division algorithms.
The document discusses common digital logic circuits including decoders, encoders, demultiplexers and multiplexers. It provides an overview of how these circuits work at a block level and then goes into more detail on decoders, describing their functionality, truth tables, and implementations including how to build larger decoders from smaller ones. Standard MSI decoder chips are also presented.
This document describes a program that scans a 4x4 hex keypad connected to an ARM7 microcontroller and displays the key pressed on a serial port. It initializes the serial port and defines functions for key scanning, sending hex digits and delay. The key scanning function uses I/O pins to scan each row, incrementing the result value when a key is pressed. It then displays and delays before scanning again. Scanning starts from the third row and proceeds to the first row, checking each column in a row.
Contents:
1.Why programming is important?
2.Input and Output devices for microcontroller
3.Application of Microcontroller
4.Interfacing Keypad with microcontroller
5.Keypad Matrix Scanning concept.
6.ALP for interfacing keypad with LCD.
This document provides an introduction to robotics and instructions for building a basic robot. It discusses the necessary software and hardware, including an MPLAB programming IDE, MPLAB C compiler, PIC18F2520 microprocessor data sheet, programming tool, prototype board, wires, resistors, capacitors, voltage regulator, LEDs, battery, and motor controller. It explains how to connect the PIC18 microprocessor, power circuit, and H-bridge motor controller. The document demonstrates code for turning on an LED, blinking an LED, and controlling motor direction. It discusses using delays to control timing and introduces using an infrared sensor to detect obstacles. In closing, it thanks the robotic club advisor and vice president for their support.
This document describes the design of a basic standard calculator using an ATMega16 microcontroller. The calculator can perform basic arithmetic operations of addition, subtraction, multiplication and division on two operands using a 4x4 keypad for input and a 2x16 LCD for output display. The microcontroller is programmed to read keypad input, perform calculations and display results on the LCD. It provides code examples for interfacing the keypad and LCD with the microcontroller and implementing the calculator functionality.
Searching for Embedded Systems,VLSI,Matlab, PLC scada Training Institute in Hyderabad-Get the Best Embedded Systems,VLSI,Matlab, PLC scada Training with Real time Projects from Nanocdac. Register now for new batches Call Us-040 -23754144,+91- 9640648777
This document describes interfacing an LCD display and keyboard to an 8051 microcontroller. It discusses connecting the LCD to output pins of the microcontroller to control the display. Commands are sent to initialize and update the LCD. A similar process of scanning rows and columns is used to interface a 4x4 keyboard matrix and detect which key is pressed by checking for a closed row and column. The document provides code examples to write characters to the LCD and scan the keyboard to identify pressed keys.
This project report describes a treadmill simulation project using an 8052 microcontroller. The hardware components included an 8052 microcontroller, LCD display, numeric keypad, DC motor, and other components. The code was written to control the keypad, LCD display, motor and calculate calories burned based on speed, time, weight and gender of the user. The project was simulated using Proteus and results matched the expected functionality.
This document discusses interfacing a hex keypad to an AT89C51 microcontroller. It provides details on the components required, including the microcontroller, keypad, and 7-segment display. It describes how the keypad is scanned using column scanning to detect key presses and determine the pressed key. The programming for the microcontroller is also outlined, showing how it initializes ports, scans the keypad, looks up the pressed key in a lookup table to display on the 7-segment display. Potential issues faced include debouncing and directly powering the display. Future work proposed includes adding an LCD module to create a basic calculator.
This document discusses interfacing a 4x4 matrix keypad with a microcontroller. It describes the advantages of a matrix keypad, how the microcontroller can detect which key is pressed by scanning the rows and columns, and two methods (interrupt and scanning) for key press detection. It then provides code for implementing the interrupt method, including initializing ports, enabling interrupts, scanning rows/columns to identify the pressed key, debouncing, and displaying the key on another port. Lookup tables are used to map rows/columns to ASCII codes for each key.
This document provides instructions for an 8051 lab that involves displaying data on seven segment displays (SSDs) using an 8051 microcontroller. It discusses using ports P2 and P3 to drive the SSDs, implementing lookup tables to simplify the data needed to display numbers, and an example code that counts from 0-9 on the SSDs using a lookup table. The tasks for the lab are to display counting patterns from 0-9, 9-0, 00-99, and 99-00 on the SSDs with a 500ms delay between each number.
This document provides an introduction to using Arduino boards. It discusses getting started with the Arduino IDE, programming basics like digital I/O and timing functions. Examples are provided to blink an LED, read a digital sensor, read an analog sensor with a potentiometer, and fade an LED using pulse width modulation. Terminology around bits, bytes and serial communication is also explained. The document aims to teach Arduino fundamentals and provide practice examples for learning.
Vechicle accident prevention using eye bilnk sensor pptsatish 486
This document describes a vehicle accident prevention system using an eye blink sensor. The system uses an IR sensor to detect a driver's eye blinks and a microcontroller to process the sensor data. If no eye blinks are detected for a period of time, indicating potential drowsiness, the system will stop the vehicle and trigger an alarm to prevent accidents. The system could also be expanded in the future to detect alcohol and stop the vehicle if the driver is intoxicated.
The document contains 16 programs with code snippets to control various electronic components and devices using a microcontroller.
Program 1 turns an LED on and off with a 1 second delay using ports on a microcontroller.
Program 2 interfaces a 7-segment display with a microcontroller to display the numbers 0-9 by sending different byte patterns to the display ports.
Program 3 writes a program to count from 00 to FF in hexadecimal on PORT B of a microcontroller.
The remaining programs implement various functions like reading and sending data between ports, serial input/output, controlling motors and relays, interfacing with sensors, temperature control, and displaying values on an LCD screen by interfacing keypads and other external
This document provides an overview of common Arduino programming structures, syntax, and functions. It covers control structures like if/else statements and loops, data types, math functions, I/O functions, libraries for analog/digital I/O, serial communication, interrupts, and more. Memory sizes and pinouts are listed for popular Arduino boards like the Uno, Nano, and Mega.
This document provides information about the Arduino workshop. It discusses Arduino boards and their components. It describes the Arduino IDE and basic code structure using functions like pinMode(), digitalWrite(), and delay(). It also explains programming concepts like variables, loops, and using sensors and actuators with digital and analog input/output pins.
This document provides an overview of the features and specifications of the ATMEGA16 microcontroller. It describes the microcontroller's advanced RISC architecture, 131 powerful instructions that typically execute in a single clock cycle, and its 32x8 general purpose working registers. It also outlines the microcontroller's memory features like 16K bytes of flash memory and 512 bytes of EEPROM. Additional features discussed include timers/counters, PWM, ADC, serial interfaces, programming capabilities via JTAG, and various power management modes. The document concludes by mentioning some example projects that can be implemented using the ATMEGA16.
The document provides an introduction to Arduino and physical computing using microcontrollers. It describes that Arduino boards use ATmega microcontrollers and can be programmed to sense the physical world using sensors, process data, and control physical devices using actuators. The document outlines the basic components of a microcontroller, how the Arduino programming environment works, and the basic structure and functions used in Arduino programs.
Test your knowledge of the Python programming language with this quiz! Covering topics such as:
- Syntax and basics
- Data structures (lists, tuples, dictionaries, etc.)
- Control structures (if-else, loops, etc.)
- Functions and modules
- Object-Oriented Programming (OOP) concepts
Challenge yourself and see how well you can score!
Espresso PD Official MP_eng Version.pptxNingChacha1
Cosmetic standards in manufacturing play a crucial role in ensuring the visual quality of products meets customer expectations while maintaining functional integrity. In industries such as electronics, automotive, and consumer goods, cosmetic defects—though often non-functional—can impact brand perception, product desirability, and customer satisfaction.
### **Introduction to Cosmetic Standards in Manufacturing**
Cosmetic standards refer to the guidelines set by manufacturers to evaluate the appearance of a product. These guidelines define acceptable and unacceptable visual defects, ensuring products present a clean, professional look. While minor imperfections may be permissible, consistent and visible defects can lead to customer complaints or reduced marketability.
### **Key Cosmetic Defects in Manufacturing**
Manufacturing processes can introduce various cosmetic defects, including:
- **Scratches and Scuffs**: Surface-level marks that occur during handling, assembly, or packaging.
- **Dents and Deformations**: Physical damage to materials due to improper handling or tooling issues.
- **Color Variations**: Differences in shading or texture due to material inconsistencies or environmental factors during production.
- **Molding Defects**: Injection molding processes can introduce flow lines, sink marks, or flash, affecting the visual quality of plastic components.
- **Print and Label Imperfections**: Misaligned text, smudging, or incomplete printing can impact branding and identification.
- **Paint or Coating Defects**: Issues such as peeling, chipping, or uneven application affecting surface finish.
- **Contaminations and Foreign Material**: Dust, hair, or other particles embedded in the product can be perceived as poor workmanship.
### **Defining Cosmetic Acceptance Criteria**
Manufacturers typically establish cosmetic acceptance criteria based on industry standards, customer expectations, and internal quality requirements. These criteria specify:
- **Defect Classification**: Minor, major, or critical defects based on impact on functionality and aesthetics.
- **Inspection Methods**: Visual inspection under controlled lighting conditions and specific angles.
- **Measurement Tools**: Rulers, calipers, or digital inspection systems for consistency in defect evaluation.
- **Pass/Fail Guidelines**: Clear thresholds for acceptable and non-acceptable defects.
### **Inspection and Quality Control Methods**
To enforce cosmetic standards, manufacturers implement stringent inspection processes, including:
- **Automated Vision Systems**: Using AI-powered cameras to detect surface irregularities.
- **Manual Inspection**: Trained personnel evaluating each unit based on predefined standards.
- **Sampling Plans**: Statistical methods such as AQL (Acceptable Quality Limit) to ensure representative evaluation.
- **Defect Tagging and Sorting**: Classifying defective units for rework, scrapping, or customer review.
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...Jimmy Lai
Managing tech debt in large legacy codebases isn’t just a challenge—it’s an ongoing battle that can drain developer productivity and morale. In this talk, I’ll introduce a Python-powered Tech Debt Framework bar-raiser designed to help teams tackle even the most daunting tech debt problems with 100,000+ violations. This open-source framework empowers developers and engineering leaders by: - Tracking Progress: Measure and visualize the state of tech debt and trends over time. - Recognizing Contributions: Celebrate developer efforts and foster accountability with contribution leaderboards and automated shoutouts. - Automating Fixes: Save countless hours with codemods that address repetitive debt patterns, allowing developers to focus on higher-priority work.
Through real-world case studies, I’ll showcase how we: - Reduced 70,000+ pyright-ignore annotations to boost type-checking coverage from 60% to 99.5%. - Converted a monolithic sync codebase to async, addressing blocking IO issues and adopting asyncio effectively.
Attendees will gain actionable strategies for scaling Python automation, fostering team buy-in, and systematically reducing tech debt across massive codebases. Whether you’re dealing with type errors, legacy dependencies, or async transitions, this talk provides a roadmap for creating cleaner, more maintainable code at scale.
Jamuna river is a morphologically very dynamic river. It carries a vast sediment load from the erosive foothills of Himalaya mountain. The length of the Jamuna River is 220 km. For this research work Jamalpur district is selected to assess morphological changes using hydrodynamic, Artificial intelligence and google satellite images. First, the hydrodynamic model was calibrated and validated at Kazipur station for the years 2018 and 2019 respectively. Then, left overbank maximum discharge, water level, velocity, the slope was extracted from HEC-RAS 1D at 300 m interval interpolated cross-section. Then, this cross-section was exported as a shapefile. In google earth, the erosion rate was measured corresponding to this interpolated cross-section. The results of the hydrodynamic model were given as input variable and erosion rate as an output variable in Machine learning and deep learning technique. Calibration and validation of the regression model was done for the years 2018 and 2019 respectively. This research work can be helpful to locate the area which are vulnerable to bank erosion.
Deepfake Phishing: A New Frontier in Cyber ThreatsRaviKumar256934
n today’s hyper-connected digital world, cybercriminals continue to develop increasingly sophisticated methods of deception. Among these, deepfake phishing represents a chilling evolution—a combination of artificial intelligence and social engineering used to exploit trust and compromise security.
Deepfake technology, once a novelty used in entertainment, has quickly found its way into the toolkit of cybercriminals. It allows for the creation of hyper-realistic synthetic media, including images, audio, and videos. When paired with phishing strategies, deepfakes can become powerful weapons of fraud, impersonation, and manipulation.
This document explores the phenomenon of deepfake phishing, detailing how it works, why it’s dangerous, and how individuals and organizations can defend themselves against this emerging threat.
Deepfake Phishing: A New Frontier in Cyber ThreatsRaviKumar256934
Ad
Switch Control and Time Delay - Keypad
1.
2016
Lab3
SWITCH
CONTROL
AND
TIME
DELAY
ARIEL
TONATIUH
ESPINDOLA
PIZANO
1459342
2. Microcontroller Units Tongji University 2
Switch Control and Time Delay
1. LEDs and switches
2. Keypad and LEDs
3. Keypad and 8-segment LED
Objective
The aim of this practice is to understand how the switches, keypad-16 and 8-segment led work
with the MC9S08AW60. Use the C language and Assembly language to develop the code.
1. LEDs and switches
Write a program, with more controls of Switches/LEDs, using delay subroutine to control the
timing. Debug and run with the Lab board.
For example: Use two switches to control two LEDs
• if one of the two switches are closed, the two LEDs wink in turn
• if both switches are opened, the LEDs are always off
• if both switches are closed, the LEDs are always on
1.1 Algorithm
In order to do the wink, it is necessary to figure out how long the LEDs will stay turned on and
turned off. To do so, the first given parameter is the Bus Clock Frequency which is one-half the
CPU Clock Frequency. According to the MCU’s datasheet, the 𝑓" bus frequency is set at 4MHz
after reset. That means that it takes 0.25
µμ 𝑠 long per cycle.
Figure 1.1.1.- Debugging the C code with the Assembly component.
3. Microcontroller Units Tongji University 3
Time delay
The calculation of time delayed will be so that the number of machine cycles spend the time
required (e.g. 500ms). If we have a loop that spends 50 machine cycles per iteration where it
iterates from 0 to 79. In total we have 50x80=4000 machine cycles spent.
If we want to delay 1 second according to the 𝑓" = 4𝑀𝐻𝑧 means that 4000,000 machine cycles
must be spent. This can be solved by nesting the loop of 4000 cycles (80 iterations) in an outer
loop of 1000 iterations to finally get the 4M machine cycles.
Wink in turn
To alternate the blinking between two LEDs can be done by setting them as a complement each
other. For instance, if LED0 = high then LED1 = low and vice versa.
Step by step algorithm
1. Setup the PORT of MCU which is going to be used.
2. Read the PORT and get just the input pins. (AND operation suggested)
3. If two switches PTAD4 and PTAD3 are closed, then PTAD7 and PTAD6 always on.
4. If two switches PTAD4 and PTAD3 are opened, then PTAD7 and PTAD6 always off.
5. If two switches PTAD4 or PTAD3 are closed, then PTAD7 and PTAD6 wink in turn.
6. Back to the step 2.
Pseudo-code
If(inputs == ‘closed’)
Then
alwaysON();
else (inputs == ‘opened’)
Then
alwaysOFF();
else
if(input1 == ‘closed’ or input2==’closed’)
Then
Wink();
end
Figure 1.1.2.- Flow chart of the algorithm described above.
Start
Read
PORT
closed
Both
ON
opened
no
yes
Both
OFF
yes
no
Wink
4. Microcontroller Units Tongji University 4
Implementation in C language for the Lab3.1:
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
void delay_ms(int delay){
int i,j;
for(i=0; i<delay; i++){
for(j=0; j<80; j++);
}
}
void wink(int delay){
PTAD_PTAD6 = ~PTAD_PTAD6;
PTAD_PTAD7 = ~PTAD_PTAD6;
delay_ms(delay);
}
void alwaysOn(){
PTAD_PTAD7 = 0;
PTAD_PTAD6 = PTAD_PTAD7;
}
void alwaysOff(){
PTAD_PTAD7 = 1;
PTAD_PTAD6 = PTAD_PTAD7;
}
void main(void) {
//EnableInterrupts; /* enable interrupts */
unsigned char COND = 0x00;
PTADD = 0xF0;
PTAD = 0xFF;
SOPT = 0x53;
for(;;) {
COND = 0x0F & PTAD;
switch(COND){
case 0x03: //0011
alwaysOn();
break;
case 0x0F:
alwaysOff();
break;
default:
if(COND == 0x0B || COND == 0x07)
wink(1000);
break;
5. Microcontroller Units Tongji University 5
}
} /* loop forever */
}
2. Keypad and LEDs
Write a program to detect key-pressing, and change LEDs’ status according to the key position.
This means that a pressed key must be detected by its coordinates and then encoded to 4 bits in
order to show the result in 4 LEDs.
2.1 Algorithms
There are two functions, one to find the coordinates of the pressed key and other to encode the
result from a combination of 16 possible keys (input) to 4 bits(output).
Row-detection
The idea is sending a logic 0 to every single pin of the PORT where is connected the Keypad in
order to detect the column as rotating the zero to the left N times, where N stands for the number
of rows.
Encoding
Once we have the coordinate of the pressed key, it must be encoded to 4 bits to the purpose of
being showed up by the LEDs. Since we are dealing with a 16-keyboard, the encoding is as
follows:
Figure 2.1.1.- This logic diagram only illustrates symbolically the encoding made by the look-up
table. The binary encoder is not actually implemented in the assembly code.
Figure 2.1.2.- Depiction of the Keypad coordinates in Hexadecimal. Image taken from Lecture 5-
2 PPT, slide 12.
0
EE
1
DE
2
BE
3
7E
4
ED
5
DD
6
BD
7
7D
8
EB
9
DB
A
BB
B
7B
C
E7
D
D7
E
B7
F
77
2/
→ 𝑛
Encode
output:
𝑛
𝑏 𝑖𝑡𝑠
input:
2/
𝑏 𝑖𝑡𝑠
6. Microcontroller Units Tongji University 6
Row-detection algorithm step by step:
1. Setup PORTF of the MCU
a. Higher bits as inputs (columns)
b. Lower bits as outputs (rows)
2. Initialize the port (Set the whole port to logic one 0xFF)
3. Read the PORT
4. Check for key pressed
a. Take the higher bits
b. Drop the lower bits
c. In assembly would be: CBEQA #$F0, NO_KEY_PRESSED
5. If no key pressed, then go back to step 2.
6. If key pressed, continue to step 7.
7. Rotate a logic 0 bit from PORTF0(right) to PORTF3(left)(4 rows) once.
8. Do the step 3 and 4.
9. If no key pressed, go back to step 7.
10. If key pressed detected (higher bits), the key value has been founded then return the value
of PORTF.
11. Encode
Look-up table algorithm step by step (encoding):
1. Define a table as shown in the Figure 2.1.2.
2. Initialize the H:X index register of the MCU from #$0000 (offset)
3. Take the value out from KBTABLE according to the position pointed by H:X register.
4. If the taken value is #$00, return #$FF indicating that the fetched value is not defined in
the table.
5. If the taken value is not #$00, compare it to the KBVALUE (returned by the row-detection
algorithm) which bears the coordinate of the pressed key.
6. If the value from KBTABLE is not equal to KBVALUE, increment index by two and go back
to step 3.
7. If the condition of step 6 is false, increment the index by one and load the value pointed
by.
8. Return the value loaded of step 7.
Figure 2.1.3.- Debugging the code for PORTF initialization
7. Microcontroller Units Tongji University 7
Flow chart for Row-Detection Algorithm
Flow chart for Look-up table algorithm
Setup
PORTF
Start
Initialize
PORTF
Read
PORTF
Key
pressed?
no
yes
Rotate
1
bit
left
of
TMPVAR
Read
PORTF
Key
pressed?
no
yes
Return
KBVALUE
END
Start
Define
KBTABLE
Initialize
H:X
Register
Load
value
pointed
by
H:X
from
KBTABLE
BEQ
Z
=
1?
Return
#$FF
(Not
found)
END
no
yes
KBTABLE
!=
KBVALUE?
(fetched)
Increment
(H:X)
by
2
Increment
(H:X)
by
1
yes
no
Load
value
pointed
by
(H:X)
Return
#$FF
(Not
found)
END
8. Microcontroller Units Tongji University 8
Assembly code for Lab 3.2 Keypad and LEDs:
; Include derivative-specific definitions
INCLUDE 'derivative.inc'
;
; export symbols
;
XDEF _Startup
ABSENTRY _Startup
;
; variable/data section
;
ORG Z_RAMStart ; Insert your data definition here
TMPVAR: DS.B 1
KBVALUE: DS.B 1
;-- LOOKUP TABLE---
KBTABLE:
DC.B $7E,$00,$BE,$10,$DE,$20,$EE,$30
DC.B $7D,$40,$BD,$50,$DD,$60,$ED,$70
DC.B $7B,$80,$BB,$90,$DB,$A0,$EB,$B0
DC.B $77,$C0,$B7,$D0,$D7,$E0,$E7,$F0
DC.B $00
;
; code section
;
ORG ROMStart
_Startup:
LDHX #RAMEnd+1 ; initialize the stack pointer
TXS
MOV #$FF,PTAD
MOV #$F0,PTADD
LDA #$53 ; disable watchdog
STA SOPT
PTF_INIT: LDA #$00 ; init data port F
STA PTFD ; init data direction port F
LDA #$0F ; inputs, outputs
STA PTFDD ; COL = 0, ROW = F
LDA #$F0
STA PTFPE ; PULL-UP for columns(inputs)
mainLoop:
JSR KBA
STA KBVALUE
JSR ENCODE
; DO SOMETHING
CBEQA #$FF,display
COMA
display: STA PTAD
BRA mainLoop
;----- row scan KEY-PRESSED detection-----
; variable: KBVALUE
; entry: A
9. Microcontroller Units Tongji University 9
KBA:
MOV #$FE,TMPVAR ;%11111110
LDX #$04 ; scan 4 rows
KB1:
LDA PTFD ; read PORTF
ORA #$0F ; %00001111 keep columns(H), SET rows(L)
AND TMPVAR
STA PTFD ; row value obtained(L)
NOP
NOP
LDA PTFD ; read PORTF
AND #$F0 ; %11110000 keep columns(H) CLEAR rows(L)
CBEQA #$F0,KB2 ; if not key pressed, go to KB2
LDA PTFD ; if pressed, then store the value in A
BRA KB3
KB2:
SEC ; SET CARRY BIT = 1
ROL TMPVAR ; SHIFT ZERO TO LEFT means: going through the
rows
DBNZX KB1 ; go back and check if changes the PORTFD(High)
and (Low)
LDA #$FF ; if no key pressed
KB3: RTS
;----------------------------------------------
;----- KEY SYMBOLL LOOK UP -----
; input parameter: KBVALUE
; output:A = key coded
ENCODE:
LDHX #$0000
ENC1:
LDA KBTABLE,X
BEQ ENC3 ; if Z = 1
CMP KBVALUE ; if not, compare
BNE ENC2 ; if not eq, jump to ENC2
INCX
LDA KBTABLE,X
BRA RETURN
ENC2:
INCX
INCX
BRA ENC1
ENC3:
LDA #$FF; ; FF for undefined value
RETURN:
RTS
;**************************************************************
;* spurious - Spurious Interrupt Service Routine. *
;* (unwanted interrupt) *
;**************************************************************
spurious: ; placed here so that security value
NOP ; does not change all the time.
RTI
;**************************************************************
;* Interrupt Vectors *
10. Microcontroller Units Tongji University 10
;**************************************************************
ORG $FFFA
DC.W spurious ;
DC.W spurious ; SWI
DC.W _Startup ; Reset
3. Keypad and 8-segment LED
Write a program that detect the pressed key and change 8-segment LED’s status by showing the
corresponding number assigned to the key.
To connect the 8-segment LED is required to use another PORT than PORTA and PORTF, so
PORTB is available.
2.1 Algorithms
Same
as
Lab3.2.
Row-‐detection
and
Look-‐up
table,
the
only
difference
is
the
KBTABLE
which
now
bears
the
code
depicted
by
Table
2.3.1.
Table 2.3.1.- Decodification from 4-bit numbers to 8-bit Display respectively.
To
implement
this
program,
is
pretty
much
the
same
as
the
last
section
just
by
replacing
the
KBTABLE
by
the
Table
2.3.1.
Number h g f e d c b a Code
0 0 0 1 1 1 1 1 1 0x3F
1 0 0 0 0 0 1 1 0 0x06
2 0 1 0 1 1 0 1 1 0x5B
3 0 1 0 0 1 1 1 1 0x4F
4 0 1 1 0 0 1 1 0 0x66
5 0 1 1 0 1 1 0 1 0x6D
6 0 1 1 1 1 1 0 1 0x7D
7 0 0 0 0 0 1 1 1 0x07
8 0 1 1 1 1 1 1 1 0x7F
9 0 1 1 0 1 1 1 1 0x6F
A 0 1 1 1 0 1 1 1 0x77
B 0 1 1 1 1 1 0 0 0x7C
C 0 1 0 1 1 0 0 0 0x58
D 0 1 0 1 1 1 1 0 0x5E
E 0 1 1 1 1 0 0 1 0x79
F 0 1 1 1 0 0 0 1 0x71
11. Microcontroller Units Tongji University 11
Figure 2.3.1.- By debugging the code and pressing the key corresponding to number 3 is
depicted the 0xEE in the image highlighted with red color.
Assembly code for Lab 3.3 Keypad, 8-segments Display and 4 LEDS
; Include derivative-specific definitions
INCLUDE 'derivative.inc'
;
XDEF _Startup
ABSENTRY _Startup
ORG Z_RAMStart ; Insert your data definition here
TMPVAR: DS.B 1
KBVALUE: DS.B 1
KBLEDS: DS.B 1
KB7SEG: DS.B 1
;-- LOOKUP TABLE---
KBTABLE2: ; table for 4 LEDs
DC.B $7E,$00,$BE,$10,$DE,$20,$EE,$30
DC.B $7D,$40,$BD,$50,$DD,$60,$ED,$70
DC.B $7B,$80,$BB,$90,$DB,$A0,$EB,$B0
DC.B $77,$C0,$B7,$D0,$D7,$E0,$E7,$F0
DC.B $00
KBTABLE: ; table for 8-segments LED
DC.B $7E,$3F,$BE,$06,$DE,$5B,$EE,$4F
DC.B $7D,$66,$BD,$6D,$DD,$7D,$ED,$07
DC.B $7B,$7F,$BB,$6F,$DB,$77,$EB,$7C
DC.B $77,$58,$B7,$5E,$D7,$79,$E7,$71
DC.B $00
ORG ROMStart
_Startup:
LDHX #RAMEnd+1 ; initialize the stack pointer
TXS
MOV #$FF,PTAD
MOV #$F0,PTADD
MOV #$00,PTBD
MOV #$FF,PTBDD
LDA #$53 ; disable watchdog
STA SOPT
PTF_INIT: LDA #$00 ; init data port F
12. Microcontroller Units Tongji University 12
STA PTFD ; init data direction port F
LDA #$0F ; inputs, outputs
STA PTFDD ; COL = 0, ROW = F
LDA #$F0
STA PTFPE ; PULL-UP for columns(inputs)
mainLoop:
JSR KBA
STA KBVALUE
JSR ENCODE
STA KB7SEG
JSR ENCODE2
STA KBLEDS
LDA KB7SEG
CBEQA #$FF,clear ; if no key pressed
STA PTBD
LDA KBLEDS
COMA
STA PTAD
BRA back
clear: MOV #$00,PTBD
MOV #$FF,PTAD
back BRA mainLoop
;----- row scan KEY-PRESSED detection-----
; variable: KBVALUE
; entry: A
KBA:
MOV #$FE,TMPVAR ;%11111110
LDX #$04 ; scan 4 rows
KB1:
LDA PTFD ; read PORTF
ORA #$0F ; %00001111 keep columns(H), SET rows(L)
AND TMPVAR
STA PTFD ; row value obtained(L)
NOP
NOP
LDA PTFD ; read PORTF
AND #$F0 ; %11110000 keep columns(H) CLEAR rows(L)
CBEQA #$F0,KB2 ; if not key pressed, go to KB2
LDA PTFD ; if pressed, then store the value in A
BRA KB3
KB2:
SEC ; SET CARRY BIT = 1
ROL TMPVAR ; SHIFT ZERO TO LEFT means: going through the
rows
DBNZX KB1 ; go back and check if changes the PORTFD(High)
and (Low)
LDA #$FF ; if no key pressed
KB3: RTS
;----------------------------------------------
;----- KEY SYMBOLL LOOK UP -----
; input parameter: KBVALUE
; output:VALUE CODED FOR 8-SEGMENT LED
ENCODE:
13. Microcontroller Units Tongji University 13
LDHX #$0000
ENC1:
LDA KBTABLE,X
BEQ ENC3 ; if Z = 1
CMP KBVALUE ; if not, compare
BNE ENC2 ; if not eq, jump to ENC2
INCX
LDA KBTABLE,X
BRA RETURN
ENC2:
INCX
INCX
BRA ENC1
ENC3:
LDA #$FF; ; FF for undefined value
RETURN:
RTS
;----------------------------------------------
;----- KEY SYMBOLL LOOK UP -----
; input parameter: KBVALUE
; output:VALUE CODED FOR 4 BITS, SO 4 LEDS
ENCODE2:
LDHX #$0000
ENC21:
LDA KBTABLE2,X
BEQ ENC23 ; if Z = 1
CMP KBVALUE ; if not, compare
BNE ENC22 ; if not eq, jump to ENC2
INCX
LDA KBTABLE2,X
BRA RETURN2
ENC22:
INCX
INCX
BRA ENC21
ENC23:
LDA #$FF; ; FF for undefined value
RETURN2:
RTS
;**************************************************************
;* spurious - Spurious Interrupt Service Routine. *
;* (unwanted interrupt) *
;**************************************************************
spurious: ; placed here so that security value
NOP ; does not change all the time.
RTI
;**************************************************************
;* Interrupt Vectors *
;**************************************************************
ORG $FFFA
14. Microcontroller Units Tongji University 14
DC.W spurious ;
DC.W spurious ; SWI
DC.W _Startup ; Reset
Results with Video attached to the e-mail: