Microcontroller Talk CRESARC - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Microcontroller Talk CRESARC

Description:

Microprocessor Microcontroller what's the diff? Microprocessors can not stand alone ... ATmega8 microcontroller (final choice) Open Software Foundation tool-set ... – PowerPoint PPT presentation

Number of Views:111
Avg rating:3.0/5.0
Slides: 32
Provided by: willia269
Category:

less

Transcript and Presenter's Notes

Title: Microcontroller Talk CRESARC


1
Microcontroller Talk CRES-ARC
2
Topics To Touch On
  • History of microcontrollers
  • What are microcontrollers
  • How you can work with microcontrollers
  • Overview of the W8ZPF Voter ID project

3
History Of Microcontrollers
  • Microprocessors came before Microcontrollers
  • November 1971
  • Intel introduced the world's first single chip
    microprocessor, the Intel 4004
  • April of 1972
  • First 8-bit microprocessor appeared on the market
    under a name 8008
  • April of 1974
  • 8080 became available
  • Addressed 64Kb of memory, had 75 instructions,
    and cost 360
  • MOS Technology - WESCON exhibit ( 1975)
  • a pivotal event in the history of
    microprocessors
  • Announced the 6501 and 6502 at 25 each

4
What Are Microcontrollers?
  • Microprocessor Microcontroller what's the
    diff?
  • Microprocessors can not stand alone
  • instruction decoder, ALU, address/data/ctl.
    busses, timing logic, (CPU)
  • Has no capability to interact with the outside
    world
  • memory, I/O ports, UARTS, etc. must be added to
    make it useful
  • Microcontrollers are small computing systems on a
    single chip
  • Central Processing Unit (CPU)
  • Program memory
  • Random Access Memory (RAM)
  • EEPROM - Electrically Erasable Programmable Read
    Only Memory
  • A variety of peripheral devices
  • USARTs, Timer/Counters, ADC, DAC, I/O Ports,
    CANs, SPIs, etc., etc.

5
What Are Microcontrollers? So, whats all the
excitement about?
  • They are inexpensive- even in single pieces
  • You can design complex functionality in a small
    package
  • Microcontrollers can be viewed as a universal
    building block
  • There are a lot of free tools to work with
    Microcontrollers
  • And The thing I like the best - Next Slide!

6
What Are Microcontrollers?
7
What Are Microcontrollers? Microchip 16F88 DIP
Package
3.90 each single unit price
8
What Are Microcontrollers?
16F88 INTERNAL VIEW
(Harvard Architecture)
Has 35 instructions Datasheet 214 pages
9
What Are Microcontrollers? ATMEL ATmega8 DIP
Package
4.50 Each single unit price
10
What Are Microcontrollers?
Atmega8 INTERNAL VIEW
(Harvard Architecture)
Has 130 instructions Datasheet 302 pages
11
How you can work with microcontrollers
  • So whats the catch?
  • If you are new to software development
  • You need to think in a new paradigm
  • Start small and learn the basics first
  • You can work with microcontrollers on a couple of
    levels
  • Walk before you attempt to run

12
How you can work with microcontrollers
  • Ok So What Do Microcontrollers Do?
  • Well out of the box it does nothing!
  • But you can make it do fantastic things
  • Just add software

13
How you can work with microcontrollersHow To Get
Started
  • Select a controller family
  • Based on your goals
  • Availability of free stuff
  • set-up a development environment
  • Not a trivial task for the beginner
  • You need a way to load programs
  • Then are you ready to start!

14
The W8ZPF Voter Controller
  • A real project
  • What are we trying to accomplish
  • Interface to the repeater system
  • Microcontroller Selection
  • Development Environment
  • Software Design
  • The Final Board (observations)

15
The W8ZPF Voter Controller What are we trying
to accomplish?
  • Identify how each receiver participated in
    relaying signals to the main transmitter during a
    key down session
  • Accommodate up to 3 receivers in the design
  • Use existing repeater interfaces/signals

16
The W8ZPF Voter Controller Simplified
Interface Diagram
Current Repeater Controller
Current Voter Card
New Voter Microcontroller

CORE (H)
RX1 Voted ()
CD ID (M/R)
RX1(H)
RX2 Voted ()
gt90 of the time High Pitch CW ID
(M/R) (VOTED)
RX2 (H)
RX3 Voted ()
RX3 (H)
RX1 Dominant ()
Sample every 100ms When CORE is active
lt 90 of the time Low Pitch CW ID
(M/R) (DOMINANT)
RX1 Dominant ()
RX1 Dominant ()
Controller remembers last transition
ACTUALLY 88.8
Calculate output when CORE goes inactive
Inputs, Outputs, Transformation
17
The W8ZPF Voter Controller INTERFACE FOR THE
VOTER CONTROLLER PROJECT
CORE LINE
Active
Idle
Accumulate Data (100ms)
Ignore RX inputs
1 or 0
Output lines retain previous data until core
goes active again
RX1 RX3 output lines (active high)
All output lines are cleared after core goes
active for debounce time.
There are 6 output lines 3 -gt rx1 - rx3
voted 3-gt rx1 - rx3 dominant
Version 1.0 - wje
18
The W8ZPF Voter Controller Microcontroller
Selection
  • Looked at 2 controllers For This Project
  • Microchip 16F88
  • Atmel Atmega8
  • Basic software structure was implemented using
    both
  • Either would have done the job
  • So how did I choose?

19
The W8ZPF Voter Controller The development
environment
  • 16F88 Microchip microcontroller (initial choice)
  • MPLAB
  • Free environment for assembly language
  • Create, Edit, Assemble, Link, Load, emulate
    programs
  • I use it on Windows 2K
  • I have used it for several projects works well
  • No limitations on usage

20
The W8ZPF Voter Controller The development
environment
  • ATmega8 microcontroller (final choice)
  • Open Software Foundation tool-set
  • GNU C compiler, assembler, linker
  • Make utility
  • Avrdude program loader
  • Runs on Linux (Unix) Windows
  • Wanted experience with this environment
  • Atmega8 is more compiler friendly
  • Generally faster to develop SW using a compiler
  • However, a not significant issue for this project

21
The W8ZPF Voter Controller The development
environment
This is what it physically looks like
ATmega8 Development board (Spark Fun)
Serial port (program flash memory)
LINUX environment (FC3 ? FC5)
Final board
22
The W8ZPF Voter Controller Voter ID Board
Schematic
23
The W8ZPF Voter Controller The Microcontroller
Board
24
The W8ZPF Voter Controller The Software Design
  • This is where it gets a bit philosophical
  • I think of it in these terms
  • Software is a solution to a problem
  • Must understand the problem first
  • Then think about strategies to solve it

25
The W8ZPF Voter Controller The Software
Design How does one start?
LAYERED
MONOLYTH
TOP DOWN
COLABORATING PARTS
BOTTOM UP
VARIOUS SOFTWARE STRATEGIES
26
The W8ZPF Voter Controller The Software
Design (STATE MACHINE)
100 MS interrupt
HW
States are STARTUP IDLE
COUNTING
Run Background process
Background Processing
Return from interrupt
Background Responsibilities - Debounce inputs
- Watch core line - Determine when new
state exists - Maintain count for each Rx
Wakes-up foreground
Foreground Responsibilities - HW
initialization - Call action routines on
state changes - Processes RX data on
key-up - Signals main controller
regarding RX usage (sets output lines)

Foreground Processing
New state
Call routine To handle the State change Go to
sleep
27
The W8ZPF Voter Controller The Software
Design (STATE MACHINE)
  • Source File Statistics
  • main.c 155 lines
  • main.h 17 lines
  • init_timer1.c 30 lines
  • init_io.c 103 lines
  • interrupt.c 118 lines
  • Makefile 328 lines

28
The W8ZPF Voter Controller The Software
Design (STATE MACHINE)
  • More Statistics (Decimal)
  • RESOURCE USED/AVAILABLE
  • Text size 1462/8K Bytes (program
    instructions/tables, etc)
  • Data size 37/512 Bytes (variables)
  • TOTAL 1499 Bytes (5DBh) Used
  • 512 Bytes of EEPROM none used

29
The W8ZPF Voter Controller main.h file
variable declarations
ifdef LOCAL define LOCAL define EXTERN
include
main.h else define EXTERN extern endif enum
NO, YES enum STARTUP, COUNTING, IDLE
EXTERN unsigned char state EXTERN unsigned
char new_state EXTERN int16_t rx1_count EXTERN
int16_t rx2_count EXTERN int16_t
rx3_count
30
The W8ZPF Voter Controller This is the main
loop (part of it anyway) of the foreground state
machine code
while(1) if(new_state YES ) new_state
NO cli() switch(state) case
COUNTING // clear out old receiver
counts on this state change rx1_count
0 rx2_count 0 rx3_count
0 //clear all "voted" output lines to
the repeater PORTB (_BV(PB0))
PORTB (_BV(PB1)) PORTB
(_BV(PB2)) //clear all "dominant" output
lines to the repeater PORTD
(_BV(PD5)) PORTD (_BV(PD6))
PORTD (_BV(PD7)) break case IDLE
/ Calculate results, set output
lines accordingly This is long will
not show details here / break
case STARTUP // Do initialization here
break sei() sleep_mode()
Fragment of code from main.c
31
The W8ZPF Voter Controller
  • THE END !!
Write a Comment
User Comments (0)
About PowerShow.com