text: net/publication/271587841
  CITATIONS READS
  0 16,901
  5 authors, including:
  Some of the authors of this publication are also working on these related projects:
  All content following this page was uploaded by Utsho A Arefín on 31 January 2015.
  Submitted by
  Submitted by
  Supervised by
  Ashraful Arefin
  Lecturer
  Department of Electrical, Electronics & Telecommunication Engineering
  Dhaka International University
  March 2010
  We inform you that we have successfully completed our project “Design & Simulation of
  Moving Message Display using Microcontroller.” This application note explains the
  method to use ATMega8 microcontroller’s of General-Purpose Input/Output (GPIO)
  features to control the display of characters on an 8×8 LED matrix. This document is
  causes the software interfaces between the 8×8 LED matrixes and ATMega8 and provides
  ready-made display patterns for all the printable ASCII characters, in the form of a two-
  dimensional array. We are trying to shows that only design and simulation part of the dot
  matrix moving message display, In future, if manage this essential hardware accessories
  in this university then students are encourage to helpful completed this project with
  hardware part.
  i
  CERTIFICATION
  BOARD OF EXAMINERS
  1. Dean,
  Faculty of Science and Engineering
  2. Chairman
  3. Supervisor
  4. External
  ii
  ACKNOWLEDGEMENT
  First and foremost, we are indebted to Allah the Almighty, the merciful without whose
  patronage and blessing this project would have not been successfully completed. He gave
  us zeal, confidence, power of determination and courage and vanquished all the stumbling
  hardness that we faced on the way.
  We owe a debt of gratitude to project supervisor Mr. Ashraful Arefin, Lecturer, EETE,
  Dhaka International University, for his patronizing guidance and encouragement,
  insightful advice and endless patience throughout the progress of the work without which
  this project would not have been successful.
  We express our heartfelt thanks and gratitude to Professor Dr. Sana Ullah, Dean,
  Faculty of Science and Engineering, Dhaka International University, whose special
  interest and over patronization for establishing our project. We would also like to thank
  Mr. Saiful Islam, Chairman, Department of EETE, Dhaka International University, for
  the kind help that he extended to us. We would also like to other respected faculty
  members of EETE Department, especially thanks to Mr. Sakil Ahmed Khan, Lecturer,
  EETE, DIU for helping us from time to time.
  Last of all our heartfelt thanks go to our friends and classmates who provided us support,
  valuable information and different suggestions that helped for successful completion of
  the project.
  Tanvir Ahmed
  March 2010, Md. Akhtaruzzaman
  Dhaka Md. Kamruzzaman
  Md. Mokhlasur Rahman
  iii
  ABSTRACT
  The objective of our project is to design and simulate a 3-character dot-matrix moving
  message display using microcontroller, where the characters shift from left to write
  continuously.
  The simulation can be performed by only ISIS simulator. In this case we have used
  Proteus Design Suite 7. At first a code was developed in C. then it was implemented in
  the simulator. And we got our desired result there.
  Our design was ready for practical implementation. But because of the lack of proper
  hardware support we were unable to implement the design.
  iv
  CONTENTS
  v
  3.1.14.4 Test Results 26
  3.2 Shift Register 26
  3.2.1 Destructive Readout 27
  3.2.1.1 Serial in serial out 27
  3.2.1.2 Serial in parallel out 28
  3.2.1.3 Parallel in serial out 28
  3.2.2 Uses 29
  3.2.3 Data Movement Systems 30
  3.2.4 Shift Register Operation 32
  3.2.5 ATMega8's I/O Ports 33
  3.2.6 Features of 8 by 8 Dot Matrix LED 35
  3.2.7 Specification Overview 35
  Chapter 5 Conclusion 50
  Appendix A - Programming 51
  Appendix B - LED dot matrix display driver 57
  References 58
  vi
  LIST OF FIGURES
  vii
  Chapter 1
  I N T R O D U C T IO N
  1
  • Easier to integrate into a design than discrete logic chips.
  • Very low hardware cost possible
  • Many types and manufacturers available.
  • Architectures and programming languages vary somewhat, but not completely,
  so what we learn about one microcontroller (µC) is good knowledge to apply
  to another one.
  • Many different IC packages available (DIP8, SOIC-16 etc.)
  Timers Memory
  & Areas
  Counters
  2
  1.5 Introduction to Dot Matrix Display
  LED dot matrix display with light-emitting diodes as pixels, it uses high-brightness
  LED chip array assemblies were then made through the epoxy resin and mold
  package. With high brightness, low power consumption, pin count, large viewing
  angle, long life, moisture resistance, hot and cold, corrosion resistance and so on.
  LED dot matrix display with high brightness, light uniformity, reliability, simple
  wiring, convenient assembly, etc., can pose a variety of screen sizes, therefore, it is
  widely used in intelligent LED1display, 1 intelligent, 1instrumentation, 1 and 1
  electro mechanical integration equipment, display screen and achieved good results.
  With the micro-electronics technology, computer technology and information
  processing technology development, LED dot matrix display is, as a new media tools,
  a growing number of areas of play. Such as advertising, finance, transportation, arts,
  business, sports, industry, teaching, military, government etc., involving almost all
  aspects of their daily lives. As large as tens of square outdoor advertising screen,
  small enough to lift the system using a display screen or traffic instructions and many
  enterprises and government departments use an electronic blackboard, securities,
  banking and other departments also have information on number of mixed-screen,
  bringing a wide range of the social and economic benefits.
  The C language is currently the most popular programming language for embedded
  control using microcontrollers. This language offers a good balance of being
  relatively easy to learn yet able to perform powerful low-level functions such as bit-
  level I/O.
  Freescale offers the CodeWarrior C compiler free of charge for use with the RS08 and
  a number of other Freescale microcontrollers and microprocessors. Very few other
  manufacturers offer a free C compiler, with many costing several hundred dollars or
  more per license. Note that Freescale charges a fee for the C compiler required for
  higher end microcontrollers. Zilog is another microcontroller manufacturer that offers
  3
  a free C compiler, so they may be worth considering for cost conscious applications.
  One advantage of the Freescale CodeWarrior IDE compared to Zilog’s IDE is that
  Freescale includes a very nice hardware configuration GUI.
  With the advancement of time people are being dependent on different types of
  electronic devices. Electronic display is a very demanding device now a days. The
  main objective of this project was to design such a display capable of displaying three
  characters at a time. In the same time, it was in the concentration to make the display
  more efficient by having the option of changing the characters as wished so that any
  message can be displayed, as well as the movement of the characters were included.
  The design was made in a software called ‘Proteous Design Suit 7’. In this design,
  ATMega8 microcontroller was used to do the task.
  4
  Chapter 2
  M IC R O C O N T R O L L E R
  When we opened the door, the microcontroller sensed the door switch, turned on the
  light and disabled the magnetron. The microcontroller continually scans the keyboard.
  When
  user.
  A single chip that contains the processor (the CPU), non-volatile memory for the
  program (ROM or flash), volatile memory for input and output (RAM), a clock and an
  I/O control unit which has showing in figure 2.1. Also called a "computer on a chip,"
  billions of microcontroller units (MCUs) are embedded each year in a myriad of
  products from toys to appliances to automobiles. For example, a single vehicle can
  use 70 or more microcontrollers.
  5
  Fig 2.1 : This diagram shows the components of a Motorola 6801. Introduced in 1978, it was one of
  the first semiconductor products to claim the "computer on a chip" moniker.
  Fig 2.2 : These PIC micro chips are the world's smallest microcontrollers. Used in a myriad of
  applications, such chips can sell for as little as 50 cents in quantities of 10,000 (2007 dollars).
  6
  Fig 2.3 : The integrated circuit from an Intel 8742, an 8-bit microcontroller that includes a CPU
  running at 12 MHz, 128 bytes of RAM, 2048 bytes of EPROM, and I/O in the same chip.
  2.2.
  2.3 Volumes
  About 55% of all CPUs sold in the world are 8-bit microcontrollers and
  microprocessors. According to Semi co, over four billion 8-bit microcontrollers were
  sold in 2006. Figure 2.4 are showing that an example of a PIC microcontroller in an
  80 pin TQFP package..
  Other versions may be available where the ROM is accessed as an external device
  rather than as internal memory, however these are becoming increasingly rare due to
  the widespread availability of cheap microcontroller programmers.
  8
  Where hundreds of thousands of identical devices are required, using parts
  programmed at the time of manufacture can be an economical option. These 'mask
  programmed' parts have the program laid down in the same way as the logic of the
  chip, at the same time.
  9...
  10
  Chapter 3
  DOT-MATRIX DISPLAY
  & S H IF T R E G IS T E R
  11
  3.1.1 Usual Character Resolutionsanters are not practical. A matrix of 11×9 is often used
  to give far superior resolution.
  The heart of scrolling display is dot matrix led display unit. One or more dot matrix
  display is multiplexed to form a display panel. A set of hex values define a character
  which are send to the dot matrix display. Figure 3.1 are showing that normal dot
  matrix interfacing model. To minimize the pin usage led matrix is formed having
  certain number of rows and columns. The concept is to refresh each display unit with
  a frequency at which human eye cannot perceive changes.
  12
  Dot matrix displays are available with common cathodes as the columns and common
  anodes as the columns. The leds may be single color, bi-color or RGB.
  Figure 3.2 we are interfacing 5×7 dot matrix displays with common cathode columns
  and having bright red leds. The cathodes are shorted along the column and anodes
  shorted along the row. 5×7 dot matrix display needs 7 Row drivers and 5 Column
  drivers.
  13
  Due to the limitation of source and sink current of AT89C51 we have used SK100
  pnp transistors along with 200-ohm current limiting resistors as row drivers. We have
  used ULN2003A to increase the sinking capacity of the AT89C51 as column drivers
  which has showing in figure 3.3.
  The transistors are turned on by the TTL voltages applied by the Port 2 of AT89C51
  to their bases through 1-kilo ohm resistors. To make any led segment glow just make
  the respective row and column bits on. We send the hex value of character to be
  displayed in first column to Port2 and send columns selection byte to Port1. Then we
  send another hex value to row and select the respective column which is shown in
  figure 3.4, this process is done very fast and it seems that the whole character is
  displayed at the same time.
  14
  3.1.3 Various Sizes of Dot Matrix
  15
  White Dot Matrix - 5×7 Cathode Row Display
  White dot matrix modules ideal for graphics panels,
  suitable for low power or high ambient intensities,
  long distance view ability. Luminous Intensity: 45
  mcd per dot. Black color background. Size: 2.09".
  Dice Material: InGan White (5500K). Cathode Row
  & Anode Column configuration.
  16
  5×7 Dot Matrix LED - Super Amber Anode Row
  Super bright amber dot matrix modules ideal for
  graphics panels, suitable for long distance viewing.
  Uses latest InGaAlP Amber (590nm) chip
  technology with luminous intensity of 25,000 ucd
  per dot. Black color background. Size: 2.09".
  Common anode row orientation.
  17
  3.1.4 How to Drive a LED Display Matrix
  Driving a 64 LED display matrix is quite simple and just requires ONE TRICK.
  Figure 3.5 we can find out how to drive a led matrix with 64 LEDs (8 rows by 8
  columns - 8×8 display) or less e.g. 35 LEDs (7 rows by 5 columns - 5×7 dot matrix).
  It uses persistence of vision to let we drive the 64 led matrixes with only 10
  microcontroller outputs. Normally we would need 64 outputs for 64 LEDs but by
  using multiplexing and a helper chip we can get away with 10. LED Display
  multiplexing simply means turning on one led for a short period of time and doing
  this repeatedly for each LED which process is done by the figure 3.6
  The LEDs are no different to any other LEDs but it saves a huge amount of soldering
  as all the wiring.
  18
  3.1.5 LED Display Matrix 8x8 LEDs
  Fig 3.6 : A dot matrix led display is simply a grid of LEDs arranged for use by multiplexing
  3.1.6 Multiplexing
  Obviously that is a tall order so the way round it is to use persistence of vision which
  is a way of describing how our eye works.
  Our eye reacts slowly to changes in light intensity so that if a light is turned on and off
  quickly enough then it does not notice that the light is off. Basically our eye
  remembers a light pulse for a short time.
  19
  Multiplexing uses this fact to reduce the number of pins needed to drive an LED
  display. We can do this by splitting the 64 led displays into 8 rows and 8 columns
  which lets we drive it using 8 row outputs and 8 column outputs. In fact the 8×8 led
  matrix block used here has all the leds arranged in this way already.
  Note: The orientation of the led block must be pin 1 at the top left to view characters
  the right way up. that events
  are showing in figure 3.7.
  20
  3.1.8 Helper Chip
  To save more pins it is common to use a helper chip and in this project it is a Johnson
  counter (a 4017). This generates a walking one every time that it's clocked. Since we
  only want one row on at a time it is the ideal chip for this application.
  Note: In this project when the 4017 has been reset it outputs logic high at Q0 - which
  is not connected - so during reset the 4017 does nothing. This allows us to use the
  column driver port for something else if we want to when we are not driving the
  LEDs.
  To drive the 4017 all we need is two pins one for reset and one for clock.
  We don't have to use a 4017. If we have enough pins we could drive the led display
  directly e.g. using a 16F877A. It all depends on our circuit and what resources we
  need to use. Figure 3.8 are showing in clearly.
  21
  3.1.10 Row Current Sink
  To get more current through the LEDs we need to use a transistor at each row driver
  as the maximum current we can sink or source is low.
  The row driver sinks all the current from each active row LED. To let the current flow
  we need to use a transistor at each row as the maximum current we can sink or source
  is very low for an HC4017 (1ma).
  The most difficult thing about using the dot matrix LED display is defining the
  characters. Basically for ASCII characters we need an array of 128 blocks each
  having 8 column data numbers.
  The usual way is to get out a piece of graph paper and define our characters by
  drawing blocks where a pixel is on. Then we translate each line into hex (binary to
  hex is very easy) and then transfer this information to our program source code.
  22
  3.1.12 Dot Matrix LED Display Software
  16F88-dot-matrix-8×8.c
  The code is simple and easy to follow - all the action happens in main().
  It enters a continuous a continuous loop blinking a led on port A and driving the
  columns of the 8×8 led display and driving the 4017 (for rows). At each blink the next
  character is selected from the character set.
  The code repeatedly executes for loop and it must go faster than 20ms for 8 columns -
  so the code has to go faster than 20ms/8 = 2.5ms - which it does. So there is no visible
  flicker.
  23
  At each row (selected at the each iteration of for loop) the next column data is output
  so that the entire character is displayed.
  This section describes how the arrangement outlined in the previous section is used to
  display strings.
  Each unit matrix that displays a single character is composed of seven rows and five
  columns. The data that displays a single row is held in one byte of data. Thus, each
  character is represented by seven bytes of data—one byte each to hold the data for a
  particular row. The total number of characters supported is 95, ranging from ASCII
  code 0×20 to 0×7E. The memory space required to store character data is, in effect,
  95 characters × 7 bytes, or 665 bytes. Information is arranged in a two-dimensional,
  95×7 array that comprises the data structure for the display patterns. The three most
  significant bits (msb) in each of these bytes do not contribute to the display and are
  arbitrarily set to zero while forming the data byte.
  The software implementation for the 5×7 LED display is divided into foreground and
  background tasks. The main routine works as a foreground task and is responsible for
  the initialization of the GPIO ports. It copies the string to be displayed into a user-
  specified memory location and appends the string with:
  • Leading space
  • Trailing space
  • NULL character
  These spaces visually mark the start and end of a string, which allows a string to be
  easily read by the human eye when text is scrolling. The main routine also tracks
  24
  character display data and keeps that data ready for display at the latch inputs The
  array data starts from ASCII character 0×20 (the space key), therefore 0×20 is
  subtracted from the character ASCII code. The resulting number provides an array
  index between 0–94 that point to the first row for the character. According to its row
  position on the unit matrix, the corresponding row data for the character is fetched
  and output to the port. Although this data is available, it is not displayed immediately;
  rather, it waits until the data is attached by the background task.
  When a string is longer than the number of LED units available—it is necessary to
  scroll the characters to display the entire string. A two-step approach is necessary to
  scroll a string of characters, as the following sequence shows:
  1. A section of the string containing the same number of characters as the number of
  units is windowed or selected for display.
  2. This window is moved by one character to exclude the extreme left character and
  include the next character to be displayed at the extreme right position. As a result,
  the display scrolls from left to right, effectively creating a perception that the string is
  moving. Blinking a message can be performed by alternately switching the display on
  and off at suitable intervals. The software implementation supports both the scrolling
  and blinking mechanisms, as well as combination of the two.
  The main routine (with other user application code) is interrupted at 1ms intervals by
  an interrupt service routine (ISR) that acts as a background task. It obtains the present
  unit and row position from the main routine. From the update flag set by the main
  routine, the ISR also detects when data is ready. The ISR is responsible for latching
  the data kept ready by the main routine on appropriate latches. It also resets the update
  flag to force the main routine to keep fresh data ready for latching. The sequence of
  tasks to be performed by the main routine are provided below:
  25
  4. Check for the most recent unit and row position displayed.
  5. If the displayed unit is the extreme right unit, point to the next row in the extreme
  left unit, or else point to the same row in the next unit.
  6. Get the data byte for the next unit/row position.
  7. Output data on Port E (column latch input).
  8. Enable the selected row through Port G (row latch input).
  9. Return to step 3.
  The display functioned as intended based on the settings downloaded. These settings
  can be changed through user software during run time. The settings as provided in the
  code produce a blink rate of approximately one blink per second and a scroll rate of
  approximately three characters per second..
  26→R or R→L. The serial input and last output of a shift register can
  also be connected together to create a circular shift register.
  These are the simplest kind of shift registers. The data string is presented at 'Data In',
  and is shifted right one stage each time 'Data Advance' is brought high. At each
  advance, the bit on the far left (i.e. 'Data In') is shifted into the first flip-flop's output.
  The bit on the far right (i.e. 'Data Out') is shifted out and lost.
  The data are stored after each flip-flop on the 'Q' output, so there 0 0 0 0
  are four storage 'slots' available in this arrangement; hence it is a
  1 0 0 0
  4-Bit Register. To give an idea of the shifting pattern, imagine
  0 1 0 0
  that the register holds 0000 (so all storage slots are empty). As
  'Data In' presents 1,0,1,1,0,0,0,0 (in that order, with a pulse at 1 0 1 0
  'Data Advance' each time. This is called clocking or stroking) to 1 1 0 1
  the register, this is the result. The left hand column corresponds
  0 1 1 0
  to the left-most flip-flop's output pin and so on.
  0 0 1 1
  So the serial output of the entire register is 10110000 (). As we
  0 0 0 1
  can see if we were to continue to input data, we would get
  0 0 0 0
  exactly what was put in, but offset by four 'Data Advance'
  cycles. This arrangement is the hardware equivalent of a queue. Also, at any time, the
  whole register can be set to zero by bringing the reset (R) pins high.
  27
  This arrangement performs destructive readout - each datum is lost once it been
  shifted out of the right-most bit which is showing in upper chart.
  This configuration allows conversion from serial to parallel format. Data is input
  serially that process is showing in figure 3.9. Once the data has been input, it may be
  either read off at each output simultaneously, or it can be shifted out and replaced.
  This configuration has the data input on lines D1 through D4 in parallel format. To
  write the data to the register, the Write/Shift control line must be held LOW. To shift
  the data, the W/S control line is brought HIGH and the registers are clocked. The
  arrangement now acts as a PISO shift register, with D1 as the Data Input. However, as
  long as the number of clock cycles is not more than the length of the data-string, the
  Data Output, Q, will be the parallel data read off in order which events are showing in
  figure 3.10
  28
  The animation below shows in the figure 3.11 write/shift sequence, including the
  internal state of the shift register.
  3.2.2 Uses
  One of the most common uses of a shift register is to convert between serial and
  parallel interfaces. This is useful as many circuits work on groups of bits in parallel,
  but serial interfaces are simpler to construct. Shift registers can be used as simple
  delay circuits. Several bi-directional shift registers could also be connected in parallel
  for a hardware implementation of a stack. Shift registers can be used also as pulse
  extenders. Compared to monostable and. Register that is
  29
  capable of shifting data one bit at a time is called a shift register. The logical
  configuration of a serial shift register consists of a chain of flip-flops connected in
  cascade, with the output of one flip-flop being connected to the input of its neighbor.
  The operation of the shift register is synchronous; thus each flip-flop is connected to a
  common clock. Using D flip-flops forms the simplest type of shift-registers.
  The basic data movements possible within a four-bit shift register is shown in Figure
  3.12
  Next figure that is 3.13 shows the circuit diagram for a four-bit serial in-serial out
  shift register implemented using D flip-flops. Assuming that the register is initially
  clear, shown the waveform diagram 3.14 when ‘1000’ is shifted through the register.
  30
  Fig 3.13 : Four-bit serial in-serial out shift register
  31
  Let us now take a closer look at the effect of shifting the binary digit ‘1’ through the
  register over time. Again, we assume that the register is initially reset and the bit
  enters the left-most stage.
  At time t=0
  0 0 0 0 (0) 10
  At time t=1
  1 0 0 0 (8) 10
  At time t=2
  0 1 0 0 (4) 10
  At time t=3
  0 0 1 0 (2) 10
  At time t=4
  0 0 0 1 (1) 10
  At each time step from t=1 onwards, the right shift results in a state change which
  indicates a division by two operation. Similarly, if we operate in reverse chronological
  order (i.e. from t=4 to t=1), the left shift will result in a multiplication be two.
  A HIGH on the control input allows data bits inside the register to be shifted to
  the right and a LOW allows for the data to be shifted to the left. Notice that when the
  input is HIGH, G1 through G4 are enabled and the state Q output from each flip-
  32
  flop is passed on to the D input of the following flip-flip. Consequently, on each clock
  pulse the data is shifted one place to the right. Similarly, when that the is LOW,
  G5 through G8 are enabled, and the state Q output from each flip-flop is passed on to
  the D input of the preceding flip-flip. Now, on each clock pulse the data is shifted one
  place to the left.
  A bidirectional shift register, which is capable of shifting bits to the left (L) or right
  (R), will then be capable of performing modulo-2 division and multiplication
  operations. Figure 3.15 illustrates the logic circuit for the four-bit bidirectional shift
  As we have read the C or assembly code, we must remember that it just writes some
  values to ATMega8's PORTC.
  ATMega8 has three multi-bit multipurpose I/O ports: PORTB with 8 bits, PORTC
  with 7 bits and PORTD with 8 bits. Each of these bits is mapped to one pin at
  33 we.
  We have decided to use the 4 least significant bits from PORTC to connect the LEDs,
  but any set of free pins could have been used instead (of course, with appropriate
  changes to the firmware source code).
  The circuit itself is dead simple. We have just connected one LED and one resistor to
  each output pin used. In addition to that, we have connected our ISP connector to the
  RESET, SCK, MISO and MOSI ports. Finally, just connect all GND together and
  connect the VCC to the microcontroller. There are two things that should be noted,
  though:
  First one is that our ISP programmer is un-powered (i.e. it doesn't draw current from
  the PC's parallel port, but only transmit signals). This means we need to get 5V VCC
  from somewhere else. In our case, we have used an USB port to do so.
  The second thing is that we are using 4 resistors, one for each LED. It is also possible
  to use only one resistor for all LEDs, but this means that when multiple LEDs are on,
  they will appear dimmer than when separately lit.
  34
  3.2.6 Features of 8 by 8 Dot Matrix LED
  • interlocks mechanically
  The B32CDM is an 8 by 8 (row by column) dot matrixes red LED display combined
  with a multiplexed drive, integrated circuit with a cascadable serial interface. The
  serial interface is compatible with SPI, QSPI and MICROWIRE. User selectable
  jumpers allow the data-in/data-out functions to be swapped from left to right. The
  displays are designed so that they can be mounted in a horizontal chain and can also
  be expanded in a vertical plane allowing versatile displays to be built. The 8 by 8
  matrix gives enhanced characters over a 7 by 5 matrix and the excellent optical
  performance allows high visibility and viewing angle. The command set includes 16
  level digital dimming, test modes, null command (for cascading) and a shutdown
  mode that reduces current consumption to 150uA. A single +5 volt supply is required.
  Applications include message displays, large area display assemblies and graphics
  panels. LED sizes include (active display area) 32mm by 32mm, 38mm by 38mm and
  64mm by 64mm. alphanumeric character generation using the BIFQ2.
  35
  Chapter 4
  I S I S M O D E L , D E S IG N
  & SIMULATION
  ISIS is a software package which is used for river modeling. Developed by Halcrow
  Group Limited, it is used throughout the world as an analysis tool for flood risk
  mapping, flood forecasting and other aspects of flood risk management analysis. It is
  used by the Environment Agency, Office of Public Works, Scottish Environment
  Protection Agency, Mekong River Commission and the Ministry of Water Resources
  and Irrigation in Egypt as well as many of the UK’s major river engineering
  consultants including Jacobs, Hyder Consulting, Atkins, Ove Arup & Partners,
  Haskoning, Black & Veatch, Capita Symonds and JBA Consulting.
  4.2 History. ONDA modeled open channel
  flows and was capable of simulating both branched and looped systems. It was a
  modular program which could represent a variety of control structures, including
  weirs, sluices and culverts and floodplains.
  36
  4.3 Present
  The ISIS suite has been developed by the further integration of WBM’s TUFLOW
  software and the introduction of ISIS Mapper, a GIS-based model building and
  visualization tool for viewing 3D surface data. Available add-ons include Sediment
  Transport and Water Quality.
  ISIS 2D is the latest addition to the ISIS by Halcrow suite of products. ISIS 2D is a
  fully hydrodynamic computational engine and is designed to work either standalone
  or within the ISIS suite. It has been developed to complement the capabilities of
  WBM's 2D modeling software; TUFLOW.
  • v3.0 (released February 2008) - the first ISIS release by Halcrow since the end
  of the business partnership with Wallingford Software. The release saw many
  major enhancements, most notably the inclusion of ISIS Mapper as a model
  building, flood mapping and visualization tool, the release of a fully
  functioning Free version of the software (limited to 200 nodes) and the
  introduction of three new hydraulic units (Flat-V weir, Total Energy Junction,
  Blockage unit).
  • v3.1 (released December 2008) - delivers faster run times and other
  improvements and new features - including grid manipulation, conveyance
  plotting, OpenMI compliance and better visualization of diagnostic and
  structure information.
  37
  • v3.2 (released June 2009) - ISIS Free now has all of the same features of ISIS
  Professional (1D) and ISIS 2D but is limited to 250 1D nodes, 2,500 2D cells
  and a 10mb restriction on ISIS Mapper input files.
  • v3.3 (released November 2009) - New usability and productivity tools,
  including model health checker and results harvester. Provides enhanced
  usability for ISIS Mapper, including improved zoom/pan facilities and speed
  improvements for ISIS 2D.
  The AVR is a family of 8-bit microcontrollers. In this course, we will be using the
  Atmel ATMega8 AVR processor. This processor features 8KB of FLASH, 1KB
  SRAM and a variety of built-in peripherals. It supports a proprietary 8-bit AVR ISA
  for which there is GCC support. The ATMega8 has a maximum rated processor
  frequency of 16MHz and is little endian. The ATMega8 lends itself extremely well to
  prototyping due to its DIP form factor (in the version we use) and its simple
  requirement of a 4.5V-5.5V power source. The AVR allows us to rapidly develop
  code for a very low-power, low-cost microprocessor with the advantages of GCC
  compiler support. The ATMega8 has a decent amount of computational power and
  has excellent flexibility in the use of its IO pins. The AVR family of processors has a
  very large following on the Internet allowing for rapid advice on development issues.
  The AVR processor family and in particular the ATMega8 processor in its DIP
  format, are very easy to program through its In System Programming (ISP) interface.
  38
  All programming is done via the ATAVRISP which connects easily to a COM port on
  the PC and to a 10 pin header on AVR. As a result, programming on the ATMega8
  processor is fast and easy. Before any programming can take place, we must power
  the AVR and connect the UART lines on the ATMega8 to the computer. This is not
  as simple as it seems, however. RS232 signals go between +12V and –12V and are
  inverted (-12V is a logical 1). Applying this kind of voltage to the AVR is very
  dangerous. Dealing with this problem requires the use of a very common chip: the
  MAX232. The MAX232 uses capacitor pumps to perform the necessary level shifting
  and provide two receive and two transmit channels per chip.
  The AVR is programmed via an interface between a computer’s serial ports that goes
  to pins on the AVR. In this section, we will set up this interface. The ATAVRISP’s
  (the programming interface) serial connector must be connected to the PC and we
  must setup an interface between the 10 pin connector on the ATAVRISP and the
  ATMega8.
  To ease this setup, we will establish a convention in which the bottom row of the 10
  pin connector is defined as the row closest to the long part of the ribbon cable.
  Use the following table to make connections between the AVR processor and the 10
  pin header.
  One thing to note is that we must attach a 10KΩ resistor (brown – black – orange) to a
  5V power source and pin 1 on the AVR processor. This pull-up resistor is necessary
  on RESET since the programmer is not strong enough to pull down anything beefier
  and the AVR does not have a pull up resistor on this pin internally.
  39
  Also, pin 10 on the 10 pin connector must be connected to a 5V power source. Be
  sure to do this step as it is VERY IMPORTANT.
  To begin programming, the processor must have RESET and SCK pins set to 0. Then,
  specific Programming Enable serial instructions must be sent to the MOSI pin.
  However, this does not have to be done by the user as the ATAVRISP takes care of
  all of this functionality.
  Now that we have setup the programming interface, it is relatively easy to compile
  and download a program.
  Since we are just testing to ensure that the programmer is properly setup, no actual
  output will be seen. However, if we receive an error message, ensure that the green
  light on the ATAVRISP is on and stable. If this is ok, check the orientation of our
  cable.
  40
  configuration information is located in iom8.h. It is highly recommended that we look
  through and understand the contents of this file.
  UART Setup
  This section describes how to set up the MAX232 chip and connect it to the AVR to
  enable UART transmissions between the AVR and the PC.
  Let’s setup the power lines to the chip first. After placing it onto the breadboard, place
  a 5V wire to pin 16 and place GND to pin 15 of the MAX232.
  Next, obtain 4 1µF capacitors. Connect the negative end of one of the capacitor (the
  one with the stripe) to pin 3 and the positive end to pin 1. With another capacitor,
  connect the negative end to pin 5 and positive end to pin 4. Connect the 3rd capacitors
  negative end to a 5V column and the positive end to pin 2. Connect the last capacitors
  negative end to pin 6 and the positive end to a ground column. These connections are
  summarized in the table below.
  Now it’s time to connect the MAX232 to the AVR UART pin headers. Place a 5x2
  pin header onto the board. Be carefully not to place it in columns powered by another
  device. Make the following connections.
  Lastly, we must connect the MAX232 to the AVR. This involves two simple
  connections.
  41
  MAX232 Connection AVR Connection
  Pin 12 (R1OUT) Pin 2 (RXD)
  Pin 11 (T1IN) Pin 3 (TXD)
  This section is borrowed entirely from Sean Pieper’s excellent guide of the
  TinyARM) GCC’s default behavior masks many details of the compilation process
  from the average user. As a result, most programmers remain unfamiliar with the
  behavior of the linker which is crucial for cross-compilation. To go from source to
  binaries, there are a variety of steps involved.
  To start with, when we’re programming the ATMega8, we’re operating without any
  of the benefits of an OS. This means that we need to take care of a variety of low-
  level tasks that, as a programmer, we aren’t typically concerned with. We provide
  with a small assembly routine that will perform the most basic initialization, but if we
  need to install interrupt handlers, we will be forced to modify this code to set the
  appropriate jump points and distinguish between different interrupt sources.
  For those of we who are unfamiliar with the functions performed by the linker (ld), it
  resolves labels across a number of input files and then maps them to various segments
  of memory. There are segments for code, read-only variables, initialized global
  variables, uninitialized global variables and a variety of stacks. To some extent, these
  42
  mappings are controlled by the memory layout of the ATMega8 i.e. code, read-only
  variables and the initial values of initialized global need to live in the part or memory
  reserved for FLASH whereas space is reserved for initialized global to be copied into,
  for uninitalized variables and for stacks in the RAM.
  Finally, once the linking has been performed, we need to convert the output .elf file
  to a .hex file that can be loaded directly into the processor’s flash. This operation is
  performed by the objcopy utility.
  Because of the numerous steps involved, it is strongly recommended that we take one
  of the provided Make files and modify that to fit our needs. If we are experienced in
  the dark arts of creating Makefiles, there is a lot of room for improvement in the
  provided file and the course staff would greatly appreciate any useful tweaks to an
  admittedly ugly, albeit functional, Makefile.
  The AVR offers two methods to communicate with its GPIO’s. One method offers a
  separate IO address space that can only be addressed with specific IO instructions (in,
  out, etc.). The other method, which we may be more familiar with, is memory-
  mapped IO which maps the entire IO address space onto the regular physical address
  space of the AVR, allowing port’s to be read from and written to using simple C-style
  pointers. Both formats are described here and both formats are supported by the
  version of GCC we are using for this course.
  Before setting up input and output commands, we must include the io.h file in our
  programs. This file simply includes the real IO header file for the system we are
  using. In our case, since we are using the ATMega8, io.h includes the file iom8.h.
  Review this file so we know its contents.
  With every available port comes 3 8-bit memory-mapped IO registers. These registers
  serve the following purpose:
  43
  Register Purpose
  PINx Actual physical connection to pin. Use this register for reading
  DDRx Establish the direction of data. 1 for output, 0 for input
  PORTx If DDR is set to 1, this is the output data. If DDR is set to 0, this indicates float or
  pull-up
  The interaction between various settings of PORTx and DDRx are shown below:
  First, place the SRAM chip above or below the AVR microcontroller (for ease of
  wiring). Refer to the SRAM datasheet as an aid for the rest of this section.
  The table below shows the recommended connections to connect the SRAM to AVR.
  Note, that we are only using the first 9 address bits which limits our SRAM to be 4Kb
  due to restricted pin bandwidth on the AVR. Also, we dual use the AVR programmer
  lines for the same reasons.
  44
  4.6.7 Other Capabilities of the ATMega8
  The Serial Peripheral Interface Bus or SPI or “spy” bus is a synchronous serial data
  link standard named by Motorola that operates in full duplex mode. Figure 4.1 is
  shown the block diagram serial peripheral interfacing. Devices communicate in
  master/slave mode where the master device initiates the data frame. Multiple slave
  devices are allowed with individual slave select (chip select) lines. Sometimes SPI is
  called a “four wire” serial bus, contrasting with three, two and one wire serial busses.
  45
  4.8 Design of the Circuits & Varieties Statements of Moving 8×8
  Dot Matrix Display
  46
  4.9 Simulation Results
  47
  Fig 4.4 : 2nd Statement
  48
  Fig 4.5 : 3rd Statement
  49
  Chapter
  5
  CONCLUSION
  This application note explains how to control the display of characters on an 8×8 LED
  moving message display using the GPIO ports of the ATMega8. A four-unit 8×8
  matrix display is controlled by two GPIO ports (16 GPIO pins). The APIs provided in
  this application note facilitate easy implementation for displaying characters on an
  8×8 LED matrix. The scroll and blink display modes are supported. The display
  scrolling speed and the blink rate can be easily changed. The software is written to
  decouple these functions, thus enabling combinations of these modes as per our
  requirements. All of the printable ASCII characters (ASCII code 0×20 to 0×7E) are
  supported. The procedure outlined for displaying printable ASCII characters can also
  be used for displaying nonstandard characters and symbols.
  50
  APPENDIX A
  /*************************************************************************************************
  // File Name : avrspi.c
  // Version : 1.0
  // Description : SPI I/O Using 74HC595 8-bit shift registers
  // with output latch
  // Author : Tanvir, Akhter, Kamrul, Mokhlesh
  // Target : AVRJazz Mega8 Board
  // Compiler : AVR-GCC 4.3.0; avr-libc 1.6.2 (WinAVR 20070610)
  // IDE : Atmel AVR Studio 4.13
  // Programmer : AVRJazz Mega8 STK500 v2.0 Bootloader
  // : AVR Visual Studio 4.13, STK500 programmer
  // Last Updated : 24 Feb 2010
  *************************************************************************************************/
  #include <avr/io.h>
  #include <util/delay.h>
  p=p+1;
  if (p==3)
  {
  p=0;
  51
  }
  // Disable Latch
  return datain;
  }
  int main(void)
  {
  //unsigned char cnt;
  //unsigned char
  data11=0xFF,data12=0x87,data13=0xF7,data21=0xCF,data22=0xBB,data23=0
  xEB,data31=0xB7,data32=0xBB,data33=0xDD;
  //unsigned char
  data41=0x7F,data42=0xBB,data43=0x80,data51=0x7F,data52=0x87,data53=0
  xBE,data61=0x7F,data62=0xBB,data63=0xBE;
  //unsigned char
  data71=0xB7,data72=0xBB,data73=0xBE,data81=0xCF,data82=0x87,data83=0
  xFF;//,data61=0x7F,data62=0xBB,data63=BE;
  unsigned char colmn,loop;
  unsigned char m[8][3]={0xFF, 0x87,0xF7,
  0xCF, 0xBB,0xEB,
  0xB7, 0xBB,0xDD,
  0x7F, 0xBB,0x80,
  0x7F, 0x87,0xBE,
  0x7F, 0xBB,0xBE,
  0xB7, 0xBB,0xBE,
  0xCF, 0x87,0xFF};
  DDRD=0xFF;
  PORTD=0x00;
  //PORTD=m[0][2];
  //unsigned char d=m[0][2];
  // PORTD=d>>1;
  52
  // Enable SPI, Master, set clock rate fck/2 (maximum)
  SPCR = (1<<SPE)|(1<<MSTR);
  SPSR = (1<<SPI2X);
  for(loop=1; loop<25;loop++)
  {
  }
  _delay_us(900);
  if(loop==24)
  {
  loop=1;
  for (unsigned char r=0; r<8;r++)
  {
  for (unsigned char c=0; c<3;c++)
  {
  if (c==0)
  {
  unsigned char y,z;
  z=m[r][2];
  z=z<<7;
  y=m[r][c];
  y=y>>1;
  m[r][c]=y|z;
  }
  if (c==1)
  {
  53
  unsigned char y,z;
  z=m[r][1];
  z=z>>1;
  y=m[r][0];
  y=y<<7;
  m[r][c]=y|z;
  }
  if (c==2)
  {
  unsigned char y,z;
  z=m[r][2];
  z=z>>1;
  y=m[r][1];
  y=y<<7;
  m[r][c]=y|z;
  }
  SPI_WriteRead(m[r][c]);
  }
  /*
  PORTD=0x80;
  SPI_WriteRead(data11);
  SPI_WriteRead(data12);
  SPI_WriteRead(data13);
  // SPI_WriteRead(0xF787FF);
  _delay_ms(10);
  PORTD=0x40;
  SPI_WriteRead(data21);
  SPI_WriteRead(data22);
  54
  SPI_WriteRead(data23);
  // SPI_WriteRead(0xEBBBCF);
  _delay_ms(10);
  PORTD=0x20;
  SPI_WriteRead(data31);
  SPI_WriteRead(data32);
  SPI_WriteRead(data33);
  //SPI_WriteRead(0xDDBBB7);
  _delay_ms(10);
  PORTD=0x10;
  SPI_WriteRead(data41);
  SPI_WriteRead(data42);
  SPI_WriteRead(data43);
  // SPI_WriteRead(0x80BB7F);
  _delay_ms(10);
  PORTD=0x08;
  SPI_WriteRead(data51);
  SPI_WriteRead(data52);
  SPI_WriteRead(data53);
  // SPI_WriteRead(0xBE877F);
  _delay_ms(10);
  PORTD=0x04;
  SPI_WriteRead(data61);
  SPI_WriteRead(data62);
  SPI_WriteRead(data63);
  //SPI_WriteRead(0xBEBB7F);
  _delay_ms(10);
  PORTD=0x02;
  SPI_WriteRead(data71);
  SPI_WriteRead(data72);
  SPI_WriteRead(data73);
  //SPI_WriteRead(0XBEBBB7);
  _delay_ms(10);
  PORTD=0x01;
  SPI_WriteRead(data81);
  SPI_WriteRead(data82);
  SPI_WriteRead(data83);
  55
  // SPI_WriteRead(0xFF87CF);
  _delay_ms(10);
  // data1=data1>>1;
  // data2=data2>>1;
  //_delay_ms(100);
  /* if (i==24)
  {
  i=1;
  data11=data11>>1;
  data12=data12>>1;
  data13=data13>>1;
  data21=data21>>1;
  data22=data22>>1;
  data23=data23>>1;
  data31=data31>>1;
  data32=data32>>1;
  data33=data33>>1;
  data41=data41>>1;
  data42=data42>>1;
  data43=data43>>1;
  data51=data51>>1;
  data52=data52>>1;
  data53=data53>>1;
  data61=data61>>1;
  data62=data62>>1;
  data63=data63>>1;
  data71=data71>>1;
  data72=data72>>1;
  data73=data73>>1;
  data81=data81>>1;
  data82=data82>>1;
  data83=data83>>1;
  }
  return 0;
  }
  */
  56
  REFERENCES
  C Programming:
  57