參考的原作在這裡, http://www.geocities.com/dinceraydin/8051/index.html
但是線路圖看起來完全不舒服, 所以好久以前自己重劃了, 並且順道學習用免費的 PCB 劃圖軟體 EAGLE (http://www.cadsoftusa.com/)
學習的成果在下面, 因應手頭上現有的材料, 改了設計的一些用料
原子粒改用 2N3904
電阻統一用 1K, 10K
加了+5V電源的指示LED及穩壓的電容水塘
試加了 GROUND PLAN
以前懶惰沒做 PCB, 所以臨時又純手工地做一個, 因此幾岸幾地, 每個工作過的地方都有一個 DIY 的作品, 補上照片記錄用.
elevation of this DIY tool kit
the LPT connection cable, shorter than 20cm, it is the best for reliability and noise immunity
12V single power supply for Programming Voltage, step down to +5v for TTL logic level, 78L05 is ok, current consumption must be less than 5mA in total.
once it is built, smoking test should be, buring the code - blinkled.hex
"Hello world" for this smoking test, ledblink.hex has been loaded, the soul of AT89C2051 MCU. Connect a LED, anyone from pin-12 to pin-19 (Port 1.1 to Port 1.7), if it is blinking, that is all. This programming kit is working, AT89C2051 MCU is working, and your brain is working good too. of course, my 12MHZ crystal, reset circuitry, serial resistor for LED and power filtering capacitors are basis to receive blinking LED.
http://www.youtube.com/watch?v=3IfcIhVZXkg
NOTE : lazy to write this software, search the GOOGLE, downloaded from somewhere.
ledblink.hex
--------------------------cut below, paste, save as ledblink.hex for burn in
:020000000143BA
:0100030032CA
:01000B0032C2
:0100130032BA
:01001B0032B2
:0100230032AA
:1800250075880075890075D00075A800227F000FEFB4FFFB227E000E6B
:0E003D001132EE70FA2211250590113A01459C
:00000001FF
--------------------------cut above, paste, save as ledblink.hex for
burn in
ledblink.asm
;***************************************************************************
;* *
;* *
;* LED Blinker *
;* Iguana Labs *
;* 12/17/97 *
;* *
;* *
;***************************************************************************
;
#INCLUDE "8051.h" ;include predefined constants
;
;**************************************************************************
;
; VARIABLES AND CONSTANTS
;
;
;**************************************************************************
;
; RESET ;reset routine
.ORG 0H ;locate routine at 00H
AJMP START ;jump to START
;
;**************************************************************************
;
; INTERRUPTS (not used) ;place interrupt routines at appropriate
;memory locations
.ORG 03H ;external interrupt 0
RETI
.ORG 0BH ;timer 0 interrupt
RETI
.ORG 13H ;external interrupt 1
RETI
.ORG 1BH ;timer 1 interrupt
RETI
.ORG 23H ;serial port interrupt
RETI
.ORG 25H ;locate beginning of rest of program
;
;**************************************************************************
;
INITIALIZE: ;set up control registers
;
MOV TCON,#00H
MOV TMOD,#00H
MOV PSW,#00H
MOV IE,#00H ;disable interrupts
RET
;
;**************************************************************************
;
; Real code starts below. The first two routines are for delays so we
; can slow down the blinking so we can see it. (Without a delay, it
; would blink so fast it would look like it was always on.
;
;**************************************************************************
;
DELAYMS: ;millisecond delay routine
; ;
MOV R7,#00H ;put value of 0 in register R7
LOOPA:
INC R7 ;increase R7 by one (R7 = R7 +1)
MOV A,R7 ;move value in R7 to Accumlator (also known as A)
CJNE A,#0FFH,LOOPA ;compare A to FF hex (256). If not equal go to LOOPA
RET ;return to the point that this routine was called from
;
;**************************************************************************
;
DELAYHS: ;half second delay above millisecond delay
; ;
MOV R6,#00H ;put 0 in register R6 (R6 = 0)
LOOPB:
INC R6 ;increase R6 by one (R6 = R6 +1)
ACALL DELAYMS ;call the routine above. It will run and return to here.
MOV A,R6 ;move value in R6 to A
JNZ LOOPB ;if A is not 0, go to LOOPB
RET
;
;**************************************************************************
;
START: ;main program (on power up, program starts at this point)
ACALL INITIALIZE ;set up control registers
LOOP:
INC P1 ;INCrement P1. Adds 1 to the 8 bit register for Port 1.
ACALL DELAYHS ;go to above routine that causes a delay
AJMP LOOP ;go to LOOP(jump back to point labeled LOOP)
.END ;end program
;*************************************************************************
留言列表