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
This presentation gives the details about the data types available in Embedded C. It also discusses the pros and cons of writing codes in C for 8051. Different example codes are considered.
Rain water harvesting is a technique of collection and storage of rainwater into natural reservoirs or tanks, or the infiltration of surface water into subsurface aquifers (before it is lost as surface runoff). One method of rainwater harvesting is rooftop harvesting
This document describes an online railway reservation system. It includes sections on the problem statement, functions for users and administrators, database tables and normalization, triggers, and snapshots. The problem statement indicates the system needs to store and retrieve transaction information about rail travel. Sections on functions list features like ticket booking, checking status, and cancellation for users, and adding/removing trains and users for administrators. Tables shown include users, trains, tickets, and payments, along with normalization to third normal form. Triggers are described to update fields when payment is made or an account is cancelled/created.
The document discusses the I/O ports of the 8051 microcontroller. It describes the four 8-bit I/O ports P0, P1, P2, and P3 and how each port can be configured as an input or output. It also discusses how individual bits within each port can be accessed and monitored using instructions like JNB and JB. The document explains the differences between reading the actual pin status versus reading the internal port latch, and how instructions like ANL P1,A utilize a read-modify-write feature to modify and write port values in a single step.
This document discusses the concept of humanity from multiple perspectives. It defines humanity as referring to the human species and having two meanings: as a term for all human beings collectively, and as the quality of being human or benevolent. The document questions why society accepts hardship and asks if people can begin caring for one another in difficult times. It suggests individuals have power to positively impact others and society through small everyday acts of kindness, respect, and helping those in need.
Rainwater harvesting is the collection and storage of rainwater runoff from rooftops or land surfaces before it reaches the aquifer. It helps recharge groundwater for uses like irrigation, drinking water, and livestock. There are two main methods of rainwater harvesting - surface runoff collection and rooftop collection, where the roof acts as a catchment to collect rainwater and funnel it into a storage system using pipes and filters. The storage systems include tanks, barrels, and recharge pits or trenches that allow water to percolate back into the groundwater. Rainwater harvesting provides many benefits like water conservation, reducing soil erosion, and saving money.
The document discusses the 8051 microcontroller, including its architecture, pin configuration, memory organization, timers, interrupts, and interfacing capabilities. It describes the 8051's features like on-chip RAM, ROM, timers and low power consumption which make it suitable for control applications. The document outlines the differences between microprocessors and microcontrollers, and covers various interfacing examples like switches, LEDs, 7-segment displays, LCDs, ADCs and relay interfacing. It concludes with common applications of the 8051 such as in automobiles, industrial processing, robotics and consumer electronics.
This document provides an overview of programming the 8051 microcontroller in C. It discusses machine language, assembly language, and high-level languages. It then demonstrates how to create a hex file using a compiler, burn it to a microcontroller, and use ISP and a universal programmer. Several examples of 8051 C code are provided, including toggling port bits, using data types like unsigned char, delay loops, and reading/writing port values.
The document describes a traffic light control system using an 8085 microprocessor. It discusses the need for a traffic light system, describes the basic components including colors and signals. It then covers the hardware details of the 8085-based system and interface board, including ICs used. Algorithms and state diagrams are presented to show the logic for controlling lights and pedestrians.
This document provides an overview of the instruction set of the 8085 microprocessor. It begins by defining what an instruction is and the classification of the 8085 instruction set. It then proceeds to describe various data transfer, arithmetic, logical, branching, and control instructions in detail through opcode, operands, examples, and before/after execution illustrations. The document aims to provide a comprehensive reference for the complete set of 246 instructions supported by the 8085 microprocessor.
8051 programming skills using EMBEDDED CAman Sharma
It contains basic programming tips for embedded c for those who are just into it and don't know much about it....have a look in it and u will surely find it easy.
The document discusses stacks, subroutines, and the 8085 microprocessor. It provides the following key points:
1. The stack is an area of memory used for temporary storage of information in LIFO (last in first out) order, growing backwards into memory with the stack pointer register defining the bottom.
2. Subroutines allow groups of instructions to be called from different locations to avoid repetition. The 8085 uses CALL to redirect execution to a subroutine and RTE to return to the calling routine.
3. Data can be passed to subroutines through registers or memory locations. Proper subroutines only enter at the start and exit at the end, with a single entry point
The document discusses serial input/output (I/O) data transmission using the 8085 microprocessor. It describes how the serial input data (SID) pin is used to accept serial 1-bit data under software control during a RIM instruction. It also describes how the serial output data (SOD) pin is used to transfer 1-bit data under software control during a SIM instruction. It provides an example program that generates a 1 kHz square wave on the SOD pin by toggling between logic 0 and 1 using different accumulator values in the SIM instruction and a delay subroutine.
The 8155 and 8156 microprocessor interface chips differ in that the 8155 has an active low Chip Enable (CE) signal, while the 8156 has an active high CE signal. The 8155 is a multifunction chip that contains RAM, I/O ports, and a timer. It has two 8-bit I/O ports, one 6-bit I/O port, a 14-bit counter/timer, 2Kb of RAM, and can be interfaced with the 8085 microprocessor. The document then provides details on the pinout, memory mapping, control register, port configurations, timer operation modes, and status register of the 8155 chip.
Embedded C programming based on 8051 microcontrollerGaurav Verma
This lecture note covers the embedded 'c' programming constructs based on 8051 microcontroller. Although the same concepts can be used for other advanced microcontrollers with some modifications.
The document provides an overview of microprocessors and the 8085 microprocessor architecture. It discusses that a microprocessor is a programmable VLSI chip that includes an ALU, registers, and control circuits. The 8085 is an 8-bit microprocessor that can address 64KB of memory. It has three main functional blocks - a register array, ALU and logical group, and instruction decoder/timing and control circuitry. The document also describes the various registers, buses, pins and control signals of the 8085 microprocessor.
The 8085 microprocessor uses several addressing modes to specify the operands in instructions. These include implied, immediate, direct, register, and register indirect addressing modes. Implied addressing mode does not specify operands as they are implicit in the instruction. Immediate addressing mode embeds the operand in the instruction itself. Direct addressing directly specifies the memory location of the operand. Register addressing uses register operands. Register indirect addressing specifies the operand address using a register pair like the HL register.
The document provides information about the instruction sets of the 8086 microprocessor. It defines what an instruction set is and describes the different instruction formats used by the 8086. The main types of 8086 instructions are then outlined, including data transfer instructions, arithmetic instructions, bit manipulation instructions, branch instructions, and others. Specific instructions like MOV, ADD, SUB, and MUL are explained through examples of their syntax and operation.
The document describes an 8051-based digital clock application that uses timers and interrupts. It configures Timer 0 to generate interrupts every 50ms by overflowing every 46080 cycles. Timer 1 is used to generate a 19200 baud rate for a serial port. On each Timer 0 interrupt, the clock display is updated. By generating interrupts every 50ms and counting 20 of them for 1 second, the timer configuration provides an approximate 1 second timer without exceeding the 8051's 65536 cycle limit.
Shift registers are digital circuits composed of flip-flops that can shift data from one stage to the next. They can be configured for serial-in serial-out, serial-in parallel-out, parallel-in serial-out, or parallel-in parallel-out data movement. Common applications include converting between serial and parallel data, temporary data storage, and implementing counters. MSI shift registers like the 74LS164 and 74LS166 provide 8-bit shift register functionality.
This document provides an introduction to microcontrollers. It defines microcontrollers as small computers capable of performing specific tasks, like in appliances. Microcontrollers contain a CPU core, memory, input/output ports, timers and other peripherals on a single chip. They are classified as either microcontroller units (MCU) or microprocessor units (MPU) depending on whether external components are needed. Common microcontroller components and their functions are described, along with factors to consider when choosing a microcontroller for an application.
This document provides an overview of assembly language programming for the 8085 microprocessor. It discusses the 8085 programming model including registers, flags, and addressing modes. The document also covers the instruction set categories such as data transfer, arithmetic, logical and branching instructions. Examples are given to demonstrate how to write an assembly language program for the 8085 including analyzing a problem, developing an algorithm, flowchart, and coding the solution. Input/output and memory addressing modes are also explained.
The document discusses I/O ports and timers in the 8051 microcontroller. It describes the four 8-bit I/O ports (Port 0, Port 1, Port 2, Port 3) that can be configured as inputs or outputs. It also discusses the two 16-bit timer/counters (Timer 0 and Timer 1), their associated registers (TMOD and TCON), and operating modes. The ports and timers provide capabilities for interfacing with external devices and generating time delays or counting events.
The document discusses the five addressing modes of the 8051 microcontroller: immediate, register, direct, register-indirect, and indexed addressing modes. It provides examples and explanations of each mode. Immediate addressing uses data specified in the instruction. Register addressing uses source and destination registers. Direct addressing specifies the address of the data. Register-indirect addressing uses registers to point to memory locations. Indexed addressing forms an effective address by summing a base register and accumulator register.
- Thumb is a 16-bit instruction set extension to the 32-bit ARM architecture that provides higher code density and smaller memory requirements compared to standard ARM code.
- Thumb instructions are 16-bits wide while ARM instructions are 32-bits wide, allowing Thumb code to be half the size of equivalent ARM code.
- Thumb code executes on ARM processors by decompressing Thumb instructions into their 32-bit ARM equivalents on the processor.
This document discusses interfacing a 7-segment display with an 8051 microcontroller. There are two common types of 7-segment displays - common cathode and common anode. An 8051, 7-segment display, 2-4 decoder, transistors, and power supply are needed. Lookup tables store the segment patterns for digits 0-9 depending on the display type. Assembly code samples show how to display digits on one or four 7-segment displays by selecting the correct display using a 2-4 decoder connected to ports on the 8051.
This document discusses interfacing an LCD display to an 8051 microcontroller. It includes a list of components used, including an 8051 microcontroller, LCD display, resistors, and other basic electronic components. The document provides details on initializing and sending commands and data to the LCD, such as selecting the command or data register, writing vs reading data, and pulsing the enable signal. It also includes a circuit diagram and algorithm for programming the 8051 to interface with the LCD.
This document provides an overview of programming the 8051 microcontroller in C. It discusses machine language, assembly language, and high-level languages. It then demonstrates how to create a hex file using a compiler, burn it to a microcontroller, and use ISP and a universal programmer. Several examples of 8051 C code are provided, including toggling port bits, using data types like unsigned char, delay loops, and reading/writing port values.
The document describes a traffic light control system using an 8085 microprocessor. It discusses the need for a traffic light system, describes the basic components including colors and signals. It then covers the hardware details of the 8085-based system and interface board, including ICs used. Algorithms and state diagrams are presented to show the logic for controlling lights and pedestrians.
This document provides an overview of the instruction set of the 8085 microprocessor. It begins by defining what an instruction is and the classification of the 8085 instruction set. It then proceeds to describe various data transfer, arithmetic, logical, branching, and control instructions in detail through opcode, operands, examples, and before/after execution illustrations. The document aims to provide a comprehensive reference for the complete set of 246 instructions supported by the 8085 microprocessor.
8051 programming skills using EMBEDDED CAman Sharma
It contains basic programming tips for embedded c for those who are just into it and don't know much about it....have a look in it and u will surely find it easy.
The document discusses stacks, subroutines, and the 8085 microprocessor. It provides the following key points:
1. The stack is an area of memory used for temporary storage of information in LIFO (last in first out) order, growing backwards into memory with the stack pointer register defining the bottom.
2. Subroutines allow groups of instructions to be called from different locations to avoid repetition. The 8085 uses CALL to redirect execution to a subroutine and RTE to return to the calling routine.
3. Data can be passed to subroutines through registers or memory locations. Proper subroutines only enter at the start and exit at the end, with a single entry point
The document discusses serial input/output (I/O) data transmission using the 8085 microprocessor. It describes how the serial input data (SID) pin is used to accept serial 1-bit data under software control during a RIM instruction. It also describes how the serial output data (SOD) pin is used to transfer 1-bit data under software control during a SIM instruction. It provides an example program that generates a 1 kHz square wave on the SOD pin by toggling between logic 0 and 1 using different accumulator values in the SIM instruction and a delay subroutine.
The 8155 and 8156 microprocessor interface chips differ in that the 8155 has an active low Chip Enable (CE) signal, while the 8156 has an active high CE signal. The 8155 is a multifunction chip that contains RAM, I/O ports, and a timer. It has two 8-bit I/O ports, one 6-bit I/O port, a 14-bit counter/timer, 2Kb of RAM, and can be interfaced with the 8085 microprocessor. The document then provides details on the pinout, memory mapping, control register, port configurations, timer operation modes, and status register of the 8155 chip.
Embedded C programming based on 8051 microcontrollerGaurav Verma
This lecture note covers the embedded 'c' programming constructs based on 8051 microcontroller. Although the same concepts can be used for other advanced microcontrollers with some modifications.
The document provides an overview of microprocessors and the 8085 microprocessor architecture. It discusses that a microprocessor is a programmable VLSI chip that includes an ALU, registers, and control circuits. The 8085 is an 8-bit microprocessor that can address 64KB of memory. It has three main functional blocks - a register array, ALU and logical group, and instruction decoder/timing and control circuitry. The document also describes the various registers, buses, pins and control signals of the 8085 microprocessor.
The 8085 microprocessor uses several addressing modes to specify the operands in instructions. These include implied, immediate, direct, register, and register indirect addressing modes. Implied addressing mode does not specify operands as they are implicit in the instruction. Immediate addressing mode embeds the operand in the instruction itself. Direct addressing directly specifies the memory location of the operand. Register addressing uses register operands. Register indirect addressing specifies the operand address using a register pair like the HL register.
The document provides information about the instruction sets of the 8086 microprocessor. It defines what an instruction set is and describes the different instruction formats used by the 8086. The main types of 8086 instructions are then outlined, including data transfer instructions, arithmetic instructions, bit manipulation instructions, branch instructions, and others. Specific instructions like MOV, ADD, SUB, and MUL are explained through examples of their syntax and operation.
The document describes an 8051-based digital clock application that uses timers and interrupts. It configures Timer 0 to generate interrupts every 50ms by overflowing every 46080 cycles. Timer 1 is used to generate a 19200 baud rate for a serial port. On each Timer 0 interrupt, the clock display is updated. By generating interrupts every 50ms and counting 20 of them for 1 second, the timer configuration provides an approximate 1 second timer without exceeding the 8051's 65536 cycle limit.
Shift registers are digital circuits composed of flip-flops that can shift data from one stage to the next. They can be configured for serial-in serial-out, serial-in parallel-out, parallel-in serial-out, or parallel-in parallel-out data movement. Common applications include converting between serial and parallel data, temporary data storage, and implementing counters. MSI shift registers like the 74LS164 and 74LS166 provide 8-bit shift register functionality.
This document provides an introduction to microcontrollers. It defines microcontrollers as small computers capable of performing specific tasks, like in appliances. Microcontrollers contain a CPU core, memory, input/output ports, timers and other peripherals on a single chip. They are classified as either microcontroller units (MCU) or microprocessor units (MPU) depending on whether external components are needed. Common microcontroller components and their functions are described, along with factors to consider when choosing a microcontroller for an application.
This document provides an overview of assembly language programming for the 8085 microprocessor. It discusses the 8085 programming model including registers, flags, and addressing modes. The document also covers the instruction set categories such as data transfer, arithmetic, logical and branching instructions. Examples are given to demonstrate how to write an assembly language program for the 8085 including analyzing a problem, developing an algorithm, flowchart, and coding the solution. Input/output and memory addressing modes are also explained.
The document discusses I/O ports and timers in the 8051 microcontroller. It describes the four 8-bit I/O ports (Port 0, Port 1, Port 2, Port 3) that can be configured as inputs or outputs. It also discusses the two 16-bit timer/counters (Timer 0 and Timer 1), their associated registers (TMOD and TCON), and operating modes. The ports and timers provide capabilities for interfacing with external devices and generating time delays or counting events.
The document discusses the five addressing modes of the 8051 microcontroller: immediate, register, direct, register-indirect, and indexed addressing modes. It provides examples and explanations of each mode. Immediate addressing uses data specified in the instruction. Register addressing uses source and destination registers. Direct addressing specifies the address of the data. Register-indirect addressing uses registers to point to memory locations. Indexed addressing forms an effective address by summing a base register and accumulator register.
- Thumb is a 16-bit instruction set extension to the 32-bit ARM architecture that provides higher code density and smaller memory requirements compared to standard ARM code.
- Thumb instructions are 16-bits wide while ARM instructions are 32-bits wide, allowing Thumb code to be half the size of equivalent ARM code.
- Thumb code executes on ARM processors by decompressing Thumb instructions into their 32-bit ARM equivalents on the processor.
This document discusses interfacing a 7-segment display with an 8051 microcontroller. There are two common types of 7-segment displays - common cathode and common anode. An 8051, 7-segment display, 2-4 decoder, transistors, and power supply are needed. Lookup tables store the segment patterns for digits 0-9 depending on the display type. Assembly code samples show how to display digits on one or four 7-segment displays by selecting the correct display using a 2-4 decoder connected to ports on the 8051.
This document discusses interfacing an LCD display to an 8051 microcontroller. It includes a list of components used, including an 8051 microcontroller, LCD display, resistors, and other basic electronic components. The document provides details on initializing and sending commands and data to the LCD, such as selecting the command or data register, writing vs reading data, and pulsing the enable signal. It also includes a circuit diagram and algorithm for programming the 8051 to interface with the LCD.
This document provides information about the features and architecture of the 8051 microcontroller. It describes the 8-bit CPU, 64K program memory, 64K data memory, 4K on-chip program memory, 128 bytes of on-chip data RAM, 32 I/O lines, two timers, UART serial communication, interrupt structure, and on-chip oscillator. It also covers the pin descriptions, registers, memory mapping, stack, I/O port programming, timers, and interrupts of the 8051. Finally, it discusses the instruction set groups for arithmetic, logical, data transfer, boolean, and program branching operations.
Embedded C is a subset of standard C used for programming embedded systems. It uses a cross compiler to convert source code into machine-level instructions for the target processor. Key aspects of Embedded C include data types, storage classes, arithmetic and logical operations, relational operations, and conditional branching instructions like if-else statements to direct program flow.
An LCD display is specifically designed to interface with microcontrollers and not standard ICs. It can display letters, symbols, and user-defined characters. Interfacing an LCD with an 8051 microcontroller involves understanding the LCD's pins and commands, and using C or assembly code to control write and read operations to the LCD. More details on interfacing LCDs with 8051 microcontrollers can be found on the listed websites.
Microcontroller 8051 and its interfacingAnkur Mahajan
The document discusses microcontrollers and interfacing. It begins with definitions of microprocessors and microcontrollers, comparing their differences. It then focuses on the 8051 microcontroller, describing its features, block diagram, manufacturers, and addressing modes. The document outlines how to write programs for the 8051 and discusses real-world interfacing examples like LCDs, ADCs, relays, motors. It concludes with applications of the 8051 and contact information.
This document contains multiple code snippets in C programming language for the 8051 microcontroller. The code snippets provide solutions to various exercises involving toggling or monitoring bits on ports P1, P2 and P3, sending ASCII characters to ports, creating time delays, and converting ASCII digits to BCD code.
Arithmetic and Logic instructions in Embedded CVikas Dongre
This document contains information about various topics related to 8051 microcontrollers and C programming including:
- Arithmetic and logical operators used in C programming like addition, subtraction, AND, OR, etc.
- Examples of 8051 C code that perform operations like toggling ports, adding delays, and performing bitwise logic operations.
- Solutions to problems asking to write 8051 C code that toggles bits of ports with delays, toggles a specific bit a number of times, and performs bitwise logic operations.
- Notes about factors that affect accuracy of delays in 8051 programs like the microcontroller design and crystal frequency.
This document provides an introduction and overview of embedded C programming for microcontrollers. It discusses C basics, the compilation process, C extensions for microcontrollers, variables, data types, statements, operators, functions, loops, decision making, interrupts, in-line assembly, and provides an example temperature display case study.
This document discusses programming examples for the 8255 programmable peripheral interface (PPI) chip in different modes. It provides:
1) A program to read dip switches at port B and display the reading at port A and port C using the 8255 configured in mode 0.
2) Control words to set individual bits (PC7 and PC3) on port C in bit set/reset (BSR) mode.
3) Addresses for the 3 ports (A, B, C) and control register of the 8255 when memory mapped to address 8000H.
Microprocessor and Microcontroller Lab Manual!PRABHAHARAN429
The document describes experiments to be performed on an 8-bit microprocessor and microcontroller. It includes aims, block diagrams, flowcharts and assembly language programs for arithmetic operations, sorting an array, and interfacing experiments. Experiments cover topics like addition, subtraction, multiplication, division, ascending/descending order, maximum/minimum values, and interfacing components like ADCs, DACs, stepper motors. Similar experiments are outlined for an 8-bit microcontroller.
The document discusses C programming for PIC microcontrollers. It covers the reasons for using C over assembly, 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, signed int, and others; and provides examples of using these data types in programs.
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.
The document discusses numerical bases used in programming such as hexadecimal, binary, and BCD. It provides examples of converting between decimal, binary, hexadecimal and BCD representations of numbers. It also summarizes common registers, memory mapping, addressing modes, and basic instructions of the 8051 microcontroller.
The document provides instructions for using an LCD display with a PIC microcontroller. It describes connecting the LCD to the microcontroller in 4-bit mode to save pins. It includes the LCD initialization routine, functions for sending data and commands to the LCD, and positioning the cursor. In the main program, it reads analog sensor values, controls fan speed with PWM, and displays the values and fan speed on the LCD at different lines and positions on the screen.
The document describes several programs written for microcontrollers to perform various tasks:
1) A program to convert packed BCD to ASCII and store the results in registers.
2) A program to display the text "SGBAU ME 1st" on an LCD screen using a microcontroller.
3) A program to multiplex the numbers 1, 2, 2, 4 on a four digit seven segment display using a microcontroller.
4) A program in GNUSim 8085 that performs all basic arithmetic operations like addition, subtraction, multiplication, and division on 8-bit numbers by loading values from memory locations and storing results back to memory locations.
5) A program to exchange
This document describes experiments with analog to digital converters (ADCs) using an 8-bit and 10-bit converter to read voltage input and display the results on a 7-segment LED display. It provides algorithms and code for initializing the ADC, taking samples, and performing conversions to extract the digital values for display. Procedures are outlined for 8-bit and 10-bit conversions using interrupts or polling and arithmetic operations to handle the 10-bit values.
The document describes the implementation of 16-bit and 64-bit shift registers using VHDL in data flow modeling. It includes the VHDL code, test bench, and simulation results for shift registers that shift the values in the input register right by 1 bit position on the positive edge of the clock. The 16-bit shift register outputs the shifted value on q1 and the 64-bit shift register outputs the shifted value on q2. The design and functionality of both shift registers are verified through simulation.
The document discusses floating point arithmetic. It describes the IEEE-754 single and double precision floating point formats which use 1 sign bit, a biased exponent field, and a significand field to represent values. It provides examples of how positive and negative floating point numbers are represented internally in binary and decoded to determine the sign, true exponent, and significand to calculate the base 10 value. The document also mentions an upcoming exam and provides project due dates.
The document contains several 8051 microcontroller C programs that demonstrate different applications including:
1) Sending ASCII character values to a port, generating square waves, and step waveforms.
2) Generating a 100ms time delay using a timer, toggling an LED using a timer, and implementing a down counter on a 7-segment display.
3) Controlling a stepper motor, displaying "HELLO" on an LCD, and generating a triangular wave.
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 describes a lab experiment on addition of two 8-bit numbers using an 8085 microprocessor. It includes:
1) An algorithm that initializes the carry to zero, loads the two 8-bit numbers into registers, adds the numbers and checks for carry, increments the carry if needed, and stores the result.
2) The assembly language program with labels, mnemonics, hex codes and comments to implement the algorithm.
3) Inputs, outputs and results with and without carry from adding sample 8-bit numbers.
This research is oriented towards exploring mode-wise corridor level travel-time estimation using Machine learning techniques such as Artificial Neural Network (ANN) and Support Vector Machine (SVM). Authors have considered buses (equipped with in-vehicle GPS) as the probe vehicles and attempted to calculate the travel-time of other modes such as cars along a stretch of arterial roads. The proposed study considers various influential factors that affect travel time such as road geometry, traffic parameters, location information from the GPS receiver and other spatiotemporal parameters that affect the travel-time. The study used a segment modeling method for segregating the data based on identified bus stop locations. A k-fold cross-validation technique was used for determining the optimum model parameters to be used in the ANN and SVM models. The developed models were tested on a study corridor of 59.48 km stretch in Mumbai, India. The data for this study were collected for a period of five days (Monday-Friday) during the morning peak period (from 8.00 am to 11.00 am). Evaluation scores such as MAPE (mean absolute percentage error), MAD (mean absolute deviation) and RMSE (root mean square error) were used for testing the performance of the models. The MAPE values for ANN and SVM models are 11.65 and 10.78 respectively. The developed model is further statistically validated using the Kolmogorov-Smirnov test. The results obtained from these tests proved that the proposed model is statistically valid.
[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.
This research presents the optimization techniques for reinforced concrete waffle slab design because the EC2 code cannot provide an efficient and optimum design. Waffle slab is mostly used where there is necessity to avoid column interfering the spaces or for a slab with large span or as an aesthetic purpose. Design optimization has been carried out here with MATLAB, using genetic algorithm. The objective function include the overall cost of reinforcement, concrete and formwork while the variables comprise of the depth of the rib including the topping thickness, rib width, and ribs spacing. The optimization constraints are the minimum and maximum areas of steel, flexural moment capacity, shear capacity and the geometry. The optimized cost and slab dimensions are obtained through genetic algorithm in MATLAB. The optimum steel ratio is 2.2% with minimum slab dimensions. The outcomes indicate that the design of reinforced concrete waffle slabs can be effectively carried out using the optimization process of genetic algorithm.
Jacob Murphy Australia - Excels In Optimizing Software ApplicationsJacob Murphy Australia
In the world of technology, Jacob Murphy Australia stands out as a Junior Software Engineer with a passion for innovation. Holding a Bachelor of Science in Computer Science from Columbia University, Jacob's forte lies in software engineering and object-oriented programming. As a Freelance Software Engineer, he excels in optimizing software applications to deliver exceptional user experiences and operational efficiency. Jacob thrives in collaborative environments, actively engaging in design and code reviews to ensure top-notch solutions. With a diverse skill set encompassing Java, C++, Python, and Agile methodologies, Jacob is poised to be a valuable asset to any software development team.
Introduction to ANN, McCulloch Pitts Neuron, Perceptron and its Learning
Algorithm, Sigmoid Neuron, Activation Functions: Tanh, ReLu Multi- layer Perceptron
Model – Introduction, learning parameters: Weight and Bias, Loss function: Mean
Square Error, Back Propagation Learning Convolutional Neural Network, Building
blocks of CNN, Transfer Learning, R-CNN,Auto encoders, LSTM Networks, Recent
Trends in Deep Learning.
Design of Variable Depth Single-Span Post.pdfKamel Farid
Hunched Single Span Bridge: -
(HSSBs) have maximum depth at ends and minimum depth at midspan.
Used for long-span river crossings or highway overpasses when:
Aesthetically pleasing shape is required or
Vertical clearance needs to be maximized
Optimization techniques can be divided to two groups: Traditional or numerical methods and methods based on stochastic. The essential problem of the traditional methods, that by searching the ideal variables are found for the point that differential reaches zero, is staying in local optimum points, can not solving the non-linear non-convex problems with lots of constraints and variables, and needs other complex mathematical operations such as derivative. In order to satisfy the aforementioned problems, the scientists become interested on meta-heuristic optimization techniques, those are classified into two essential kinds, which are single and population-based solutions. The method does not require unique knowledge to the problem. By general knowledge the optimal solution can be achieved. The optimization methods based on population can be divided into 4 classes from inspiration point of view and physical based optimization methods is one of them. Physical based optimization algorithm: that the physical rules are used for updating the solutions are:, Lighting Attachment Procedure Optimization (LAPO), Gravitational Search Algorithm (GSA) Water Evaporation Optimization Algorithm, Multi-Verse Optimizer (MVO), Galaxy-based Search Algorithm (GbSA), Small-World Optimization Algorithm (SWOA), Black Hole (BH) algorithm, Ray Optimization (RO) algorithm, Artificial Chemical Reaction Optimization Algorithm (ACROA), Central Force Optimization (CFO) and Charged System Search (CSS) are some of physical methods. In this paper physical and physic-chemical phenomena based optimization methods are discuss and compare with other optimization methods. Some examples of these methods are shown and results compared with other well known methods. The physical phenomena based methods are shown reasonable results.
2. 2
Sections
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
3. 3
Why Program the 8051 in C
• It is easier and less time consuming to write in C
than Assembly.
• C is easier to modify and update.
• You can use code available in function libraries.
• C code is portable to other microcontrollers with
little or no modification.
11. 11
Re-examine C Data Type
• Understanding the data types of C can help
programmers to write an efficient code.
• We will focus on (See Table7-1)
– unsigned char, signed char
– unsigned int, signed int,
– Single bit: sbit (sfr) , bit (bit-addressable RAM)
– Special function register: sfr
• C compiler will allocate a RAM space for your
variables (char, int & bit).
13. 13
Unsigned Char
• The most widely used data types for the 8051
• 8-bit data type
• The range of unsigned char: 0-255 (00-FFH)
• When do you use unsigned char?
– To set counter value (Example 7-1)
– The string of ASCII character (Example 7-2)
– For toggling ports (Example 7-3)
14. 14
Signed Char
• 8-bit data type
• 2’s complement representation
• The range of unsigned char: -128:+127 (00-FFH)
• When do you use signed char?
– To present a given quantity such as temperature
15. 15
Example 7-1 (unsigned char)
Write an 8051 C program to send values 00-FF to port P1.
Solution:
#include <reg51.h>
void main(void)
{
unsigned char z;
for (z=0; z<=255; z++)
P1=z;
}
16. 16
Example 7-2 (unsigned char)
Write an 8051 C program to send hex values for ASCII
characters of 0,1,2,3,4,5,A,B,C, and D to port P1.
Solution:
#include <reg51.h>
void main(void){
unsigned char mynum[]=“012345ABCD”;
unsigned char z;
for (z=0; z<10; z++)
P1=mynum[z];
}
Note: “012345ABCD” is stored in RAM and can be changed.
17. 17
Example 7-3 (unsigned char)
Write an 8051 C program to toggle all the bits of P1
continuously.
Solution:
#include <reg51.h>
void main(void) {
for ( ; ; ) { //repeat forever
P1=0x55; //0x: in hex (binary)
P1=0xAA;
}
}
18. 18
Example 7-4 (signed char)
Write an 8051 C program to send values of -4 to 4 to port P1.
Solution:
#include <reg51.h>
void main(void)
{
char mynum[]={+1,-1,+2,-2,+3,-3,+4,-4};
unsigned char z;
for (z=0; z<8; z++)
P1=mynum[z];
}
19. 19
Integer
• 16-bit data type
– The range of unsigned int: 0-65535
– The range of signed int: -32,768-32,767
• Since the 8051 is an 8-bit microcontroller and the
int data type takes two bytes of RAM, we must not
used the int data type unless we have to.
• You should try to use unsigned char instead on int.
20. 20
Example 7-5 (unsigned int, sbit)
Write an 8051 C program to toggle bit D0 of P1 50,000 times.
Solution:
#include <reg51.h>
sbit MYBIT=P1^0;
void main(void) {
unsigned int z;
for (z=0;z<50000;z++) {
MYBIT=0;
MYBIT=1;
}
}
21. 21
Time Delay
• Three factors that can affect the accuracy of the
time delay:
– Crystal frequency of 8051 system
– 8051 machine cycle timing
– Compiler used for 8051 C
22. 22
Example 7-6 (time delay)
Write an 8051 C program to toggle bits of P1 continuously
forever with some delay.
Solution:
#include <reg51.h>
void main(void) {
unsigned int x;
for (;;) {
P1=0x55;
for (x=0;x<40000;x++); //time delay
P1=0xAA;
for (x=0;x<40000;x++); }}
23. 23
Example 7-7 (1/2)
Write an 8051 C program to toggle bits of P1 continuously with a
250 ms delay. Solution:
#include <reg51.h>
void MSDelay(unsigned int);
void main(void) {
while(1) { //repeat forever
P1=0x55;
MSDelay(250); //time delay
P1=0xAA;
MSDelay(250) }} Assume the program is tested
for the DS89C420 with XTML=11.0592MHz.
90ns X 1275 = 114750ns = 1ms
void MSDelay(unsigned int itime) {
unsigned int i,j;
for (i=0; i<itime; i++)
for (j=0; j<1275; j++); // 1ms delay}
25. 25
Access SFR
• Way to access SFR
Use name of SFR and reg51.h
#include <reg51.h>
P1=0x55; //P1=55H
• reg51. h is necessary.
• See Example 7-1.
2. Use the sfr data type and declare by yourself
sfr P1 = 0x90;
P1=0x55; //P1=55H
• reg51. h is not necessary.
28. 28
Access SFR
• Way to access SFR
1. Use name of SFR and reg51.h
#include <reg51.h>
P1=0x55; //P1=55H
• reg51. h is necessary.
• See Example 7-1.
2. Use the sfr data type and
declare by yourself
sfr P1 = 0x90;
P1=0x55; //P1=55H
• reg51. h is not necessary.
29. 29
Example 7-16 Use the sfr data type andeclare by yourself
Write an 8051 C program to toggle all the bit of P0, P1
and P2 continuously with a 250 ms time dealy.
Solution (a):
sfr P0 = 0x80; // declare by yourself
sfr P1 = 0x90; // declare by yourself
sfr P2 = 0xA0; // declare by yourself
void MSDelay(unsigned int);
// MSDelay is as same as one in
// Example7-1. Ignored it here.
void main(void) {
unsigned int z;
while(1) { //repeat forever
P0=0x55;
P1=0x55;
P2=0x55;
MSDelay(250); //time delay
P0=0xAA;
P1=0xAA;
P2=0xAA;
MSDelay(250); //time delay
} }
30. 30
Example 7-16 Use name of SFR and reg51.h
Write an 8051 C program to toggle all the bit of P0, P1
and P2 continuously with a 250 ms time dealy.
Solution (a):
void MSDelay(unsigned int);
// MSDelay is as same as one in
// Example7-1. Ignored it here.
void main(void) {
unsigned int z;
while(1) { //repeat forever
P0=0x55;
P1=0x55;
P2=0x55;
MSDelay(250); //time delay
P0=0xAA;
P1=0xAA;
P2=0xAA;
MSDelay(250); //time delay
} }
sfr P0 = 0x80; // declare by yourself
sfr P1 = 0x90; // declare by yourself
sfr P2 = 0xA0; // declare by yourself
31. 31
Example 7-16 Use name of SFR and reg51.h
Write an 8051 C program to toggle all the bit of P0, P1
and P2 continuously with a 250 ms time dealy.
Solution (a):
void MSDelay(unsigned int);
// MSDelay is as same as one in
// Example7-1. Ignored it here.
void main(void) {
unsigned int z;
while(1) { //repeat forever
P0=0x55;
P1=0x55;
P2=0x55;
MSDelay(250); //time delay
P0=0xAA;
P1=0xAA;
P2=0xAA;
MSDelay(250); //time delay
} }
#include <reg51.h>
32. 32
sfr P0 = 0x80; // declare by yourself
sfr P1 = 0x90; // declare by yourself
sfr P2 = 0xA0; // declare by yourself
#include <reg51.h>?
34. 34
Access Single Bit of SFR
• Way to access a single bit of SFR
– Use sbit and name of SFR
#include <reg51.h>
sbit MYBIT = P1^5; //D5 of P1
• See Example 7-5.
– Use sbit to declare the bit of SFR
and declare by yourself
sbit MYBIT = 0x95; //D5 of P1
• reg51. h is not necessary.
• See Example 7-17.
35. 35
Example 7-17 (sbit)
Write an 8051 C program to turn bit P1.5 on and off 50,000 times.
Solution (a):
void main(void) {
unsigned int z;
for (z=0;z<50000;z++) {
MYBIT=1;
MYBIT=0;
} }
This program is similar to Example 7-5.
sbit MYBIT = 0x95; // P1^5
36. 36
Example 7-17 (sbit)
Write an 8051 C program to turn bit P1.5 on and off 50,000 times.
Solution (a):
void main(void) {
unsigned int z;
for (z=0;z<50000;z++) {
MYBIT=1;
MYBIT=0;
} }
This program is similar to Example 7-5.
#include <reg51.h>
sbit MYBIT=P1^0;
sbit MYBIT = 0x95; // P1^5
37. 37
Access Bit-addressable RAM
• You can use bit to access one bit of bit-
addressable section of the data RAM space
20H-2FH.
#include <reg51.h>
sbit inbit = P1^0;
bit membit; //C compiler assign a RAM space for mybit
membit = inbit; //Read P1^0 to RAM
• See Example 7-18.
38. 38
Example 7-18 (bit)
Write an 8051 C program to get the status of bit P1.0,
save it, and send it to P2.7 continuously.
Solution:
#include <reg51.h>
sbit inbit = P1^0;
sbit outbit = P2^7;
bit membit;
void main(void) {
while(1) { //repeat forever
membit = inbit;
outbit = membit }}
43. 43
Example 7-19
Run the following program on your simulator and examine the
results.
Solution:
#include <reg51.h>
void main(void) {
P0=0x35 & 0x0F;
P0=0x04 | 0x68;
P0=0x54 ^ 0x78;
P0=~0x35;
P0=0x9A >> 3;
P0=0x77 >> 4;
P0=0x96 << 4; }
45. 45
Data Conversion
• Packed BCD to ASCII conversion
– See Example 7-24
• ASCII to packed BCD conversion
– See Example 7-25
• Checksum byte in ROM
– See Example 7-26, 27, 28 (using +)
• Binary to decimal and ASCII conversion in C
– See Example 7-29( using /, %)
47. Packed BCD to ASCII conversion
Example 7-24
Write an 8051 C program to convert packed BCD 0x29 to
ASCII and display the bytes on P1 and P2.
Solution:
#include <reg51.h>
void main(void)
{unsigned char x,y,z;
unsigned char mybyte=0x29;
x=mybyte&0x0F;
P1=x|0x30;
y=mybyte&0xF0;
y=y>>4;
P2=y|0x30;}
47
48. ASCII to packed BCD conversion
See Example 7-25
Write an 8051 C program to convert ASCII digits of ‘4’ and ‘7’ to
packed BCD and display them on P1.
Solution:
#include <reg51.h>
void main(void)
{ unsigned char bcdbyte;
unsigned char w=‘4’;
unsigned char z=‘7’;
w=w&0x0F;
w=w<<4;
z=z&0x0F;
bcdbyte=w|z;
P1=bcdbyte;} 48
49. Binary to decimal and ASCII conversion in C
See Example 7-29( using /, %)
Write an 8051 C program to convert 11111101 (FD hex) to
decimaland display the digits on P0, P1 and P2. Solution:
#include <reg51.h>
void main(void){
unsigned char x,binbyte,d1,d2,d3;
binbyte=0xFD;
x=binbyte/10;
d1=binbyte%10;
d2=x%10;
d3=x/10;
P0=d1;
P1=d2;
P2=d3;} 49
51. 51
To Store Data
• We have three spaces to store data:
1. the 128 bytes RAM space with address range 00-7FH
• If you declare variables (ex: char) to store data, C compiler
will allocate a RAM space for these variable.
2. Use code space
• External code memory (64K) + on-chip ROM (64K)
• Data is embedded to code or is separated as a data section
3. External data memory for data
• RAM or ROM
• see Chapter 14
52. 52
Data Stored in RAM
• Where are the variables assigned by C compiler?
• 8051 C compiler allocates RAM locations for
variables in the following order:
– Bank 0: addresses 0-7
– Individual variables: addresses 08H and beyond
– Array elements: addresses right after variables
• Array size is limited in 128 bytes RAM.
– Stack: address right after array elements
• Check your simulation tool
53. 53
8052 RAM Space
• 8052 has 256 bytes RAM.
• Based on 8052 architecture, you should
– Use the reg52.h header file.
– Choose the 8052 option when compiling the program.
54. 54
Using ROM to Store Data
• To make C compiler use the code space (on-chip
ROM) instead of RAM space, we can put the
keyword “code” in front of the variable
declaration.
unsigned char mydata[] = “HELLO”
• HELLO is saved in RAM.
code unsigned char mydata[] = “HELLO”
• HELLO is saved in ROM.
• See Example 7-33
55. 55
Example 7-33 (1/3)
Compare and contrast the following programs and discuss the
advantages and disadvantages of each one.
Solution (a):
#include <reg51.h>
void main(void) {
P1=“H”; P1=“E”;
P1=“L”; P1=“L”; P1=“O”;
}
Data is embedded into code.
Simple, short, not flexible.
56. 56
Example 7-33 (2/3)
Solution (b):
#include <reg51.h>
void main(void) {
unsigned char mydata[]=“HELLO”;
unsigned char z;
for (z=0; z<5; z++)
P1 = mydata[z];
}
Data is stored in RAM and does not occupied ROM.
57. 57
Example 7-33 (3/3)
Solution (c):
#include <reg51.h>
void main(void) {
code unsigned char mydata[]=“HELLO”;
unsigned char z;
for (z=0; z<5; z++)
P1 = mydata[z];
}
Data is stored in ROM. However, data and code are separate.
59. 59
Serializing Data
• Two ways to transfer a byte of data:
1. Using the serial port.
• For PC. See Chapter 10.
2. To transfer data one bit a time and control the sequence
of data and spaces in between them.
• For LCD, ADC, ROM
• Example 7-34
60. 60
Example 7-34
Write a C program to send out the value 44H serially one bit at
a time via P1.0. The LSB should go out first.
Solution:
#include <reg51.h>
sbit P1b0 = P1^0;
sbit regALSB = ACC^0;
void main(void) {
unsigned char conbyte = 0x44;
unsigned char x;
ACC = conbyte;
for (x=0; x<8; x++) {
P1b0 = regALSB;
ACC = ACC >> 1; }
}
ACC P1.0
D7 D0