.. Microcontrollers
An integrated circuit that contains many of the same items that a desktop
computer has, such as CPU, memory, etc.,
Does NOT include any “human interface” devices like a monitor, keyboard, or mouse.
Microcontrollers are small (micro) and designed for machine control
(controller) applications, rather than human interaction.
** Microcontroller IMAGES
WorldWide Microcontroller Shipments (in millions of dollars $)
'94 '95 '96 '97 '98 '99 '00
4-bit $1,761 1,826 1,849 1,881 1,856 1,816 1,757
8-bit 4,689 5,634 6,553 7,529 8,423 9,219 9,715
16-bit 810 1,170 1,628 2,191 2,969 3,678 4,405
(2006) A new comprehensive analysis on the Microcontroller market predicts
that 2007 worldwide microcontroller revenue will increase by 10 percent.
Average Semiconductor Content per Automobile (in dollars $)
'94 '95 '96 '97 '98 '99 '00
$ 1,068 1,237 1,339 1,410 1,574 1,852 2,126
(2007)High growth application areas for automotive semiconductors
include safety (airbags, cruise control, collision avoidance,
antilock brakes) and cockpit electronics (entertainment,
telematics, instrumentation, phones).
Electrical and electronics content, including software, represents
around 20%+ of the cost of the average vehicle.
Examples:
controlling traffic lights CD players
simple game consoles many children's games
TV remote controls microwave oven timers
clock radios car engine management systems
central heating controllers environmental control systems
.. Devices and I/O Ports
Intel microprocessors use port-mapped I/O
- separate set of assembly instructions (IN, OUT)
- port # determines which hardware device to communicate with
- allow 1 or 2 bytes to be sent/received
- meaning of data is TOTALLY determined by device
EMU8086:
can emulate a microcontroller by controlling external devices
.. Using the LED display
org 100h
; this example shows how to access virtual ports (0 to 65535).
; these ports are emulated in this file: c:\emu8086.io
; this technology allows to make external add-on devices
; for emu8086, such as led displays, robots, thermometers, stepper-motors, etc..
; anyone can create an animated virtual device.
; c:\emu8086\devices\led_display.exe
#start=led_display.exe#
; loop to write
; values to port:
mov cx, 1000
mov ax, 0
out 199, ax ; set LED to 00000
x1:
call LED
inc ax
loop x1
ret
;=========================================
; USES the AX register
; procedure outputs ax to LED
Led PROC
; save all
pusha
; write to LED:
out 199, ax
;restore all
popa
ret ; return to the caller
Led ENDP
;==========================================
end
.. Using the Traffic Lights
org 100h
; this example shows how to access virtual ports (0 to 65535).
; controlling external device with 8086 microprocessor.
; realistic test for c:\emu8086\devices\Traffic_Lights.exe
#start=Traffic_Lights.exe#
name "traffic"
mov ax, all_red
out 4, ax
mov si, offset situation
next:
mov ax, [si]
out 4, ax
; wait 5 seconds (5 million microseconds)
mov cx, 4Ch ; 004C4B40h = 5,000,000
mov dx, 4B40h
mov ah, 86h
int 15h
add si, 2 ; next situation
cmp si, sit_end
jb next
mov si, offset situation
jmp next
; FEDC_BA98_7654_3210
situation dw 0000_0011_0000_1100b
s1 dw 0000_0110_1001_1010b
s2 dw 0000_1000_0110_0001b
s3 dw 0000_1000_0110_0001b
s4 dw 0000_0100_1101_0011b
sit_end = $
all_red equ 0000_0010_0100_1001b
.. Using the Stepper Motor
org 100h
#start=stepper_motor.exe#
steps = 10h ; 16(decimal)
jmp start
; bin data for clock-wise
; half-step rotation:
datcw db 0000_0110b
db 0000_0100b
db 0000_0011b
db 0000_0010b
; bin data for counter-clock-wise
; half-step rotation:
datccw db 0000_0011b
db 0000_0001b
db 0000_0110b
db 0000_0010b
stop db 0000_0000b
start:
lea bx, datcw ; start from clock-wise half-step.
mov si, 0
mov cx, 0 ; step counter
next_step:
; motor sets high bit when it's ready to accept new command
wait: in al, 7
test al, 10000000b
jz wait
mov al, [bx][si] ;!SEE memory access modes
out 7, al
inc si
cmp si, 4 ; why 4??
jb next_step
mov si, 0
inc cx
cmp cx, steps ; why not 4?
jb next_step
mov cx, 0
add bx, 4 ; next bin data
cmp bx, offset datccw
jbe next_step
; mov bx, offset datcw ; keep repeating
; jmp next_step
ret
end