after-05 - BRSET 0,MODE,count ; Check if mode0 BRSET...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
; variable/data section MY_ZEROPAGE: SECTION SHORT ; Insert here your data definition MODE: DS.B 1 COUNT: DS.B 1 ; code section MyCode: SECTION main: _Startup: LDHX #__SEG_END_SSTACK ; initialize the stack pointer TXS CLI ; enable interrupts CLR PTADD ; set port A for input (Switches) BSET 4,PTAPE ; set Pull-Up-Enable for port A BSET 5,PTAPE ; set Pull-Up-Enable for port A BSET 6,PTAPE ; set Pull-Up-Enable for port A BSET 7,PTAPE ; set Pull-Up-Enable for port A BSET 0,PTFDD ; set port F for output (LEDs) BSET 1,PTFDD ; set port F for output (LEDs) BSET 2,PTFDD ; set port F for output (LEDs) BSET 3,PTFDD ; set port F for output (LEDs) BSET 4,PTFDD ; set port F for output (LEDs) ;Have all variables initialized at 0 CLR MODE CLR COUNT BSET 0,MODE BSET 4,PTFD BSET 3,PTFD
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
mainLoop: JSR updateDISPLAY mode1: BRSET 7,PTAD,chk1 ; Check if SW4 is pressed
Background image of page 6
Background image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: BRSET 0,MODE,count ; Check if mode0 BRSET 2,MODE,count ; Check if mode2 chk1: BRCLR 1,MODE,mode2 ; Check if mode1 count: INC COUNT ; count++ CLR MODE ; set mode=1 BSET 1,MODE mode2: BRSET 6,PTAD,chk2 ; Check if SW3 is pressed BRSET 1,MODE,yes2 ; Check if mode1 chk2: BRCLR 2,MODE,mode0 ; Check if mode2 yes2: CLR MODE BSET 2,MODE mode0: BRCLR 4,PTAD,clear ; Check if SW1 is pressed BRCLR 5,PTAD,clear ; Check if SW2 is pressed JMP ret clear: BRCLR 2,MODE,ret CLR COUNT BSET 0,MODE BCLR 4,PTFD ret: JMP mainLoop ; infinite main loop updateDISPLAY: BSET 0,PTFD BSET 1,PTFD BSET 2,PTFD BRCLR 0,COUNT,sec BCLR 2,PTFD sec: BRCLR 1,COUNT,thrd BCLR 1,PTFD thrd: BRCLR 2,COUNT,done BCLR 0,PTFD done: JSR DELAY...
View Full Document

Page1 / 7

after-05 - BRSET 0,MODE,count ; Check if mode0 BRSET...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online