;------------------------------------- ; HC908 Example #1 ;------------------------------------- ;filename: example1.asm ;written by Kenrick Chin ;2003.12.04 - first writing ;This example is used to test the operation ;of the assembler and download process. ;Assembled code is placed in SRAM ;and then executed directly from SRAM ;No flash locations are used. ;An external oscillator at 9.8304MHz is assumed. ;Both PORTA and PORTB output pins are used. ;The output pulse on any output pin is high for 6 cycles ;and low for 9 cycles. ;Hence the total waveform is 2.44us(H) + 3.66us(L) = 6.10us ;------------------------------------- ; MCU Definitions ;------------------------------------- SRAM EQU $80 PORTA EQU $00 PORTB EQU $01 DDRA EQU $04 DDRB EQU $05 INTSCR EQU $1D CONFIG2 EQU $1E CONFIG1 EQU $1F OSCTRIM EQU $38 COPD EQU 0 RSTEN EQU 0 ;------------------------------------- ; Start of Bootstrap ;------------------------------------- ORG SRAM boot BOOT BSET COPD CONFIG1 ;turn off watchdog BSET RSTEN CONFIG2 ;enable RESET pin ;initialize ports LDA #$FF STA DDRA STA DDRB main STA PORTA STA PORTB CLR PORTA CLR PORTB BRA main ENDB boot END ;------------------------------------- ; End of Example #1 ;-------------------------------------