A SERVICE OF

logo

Cypress CY3640 USB Starter Kit
User’s Guide
Cypress Semiconductor Ver 0.993
Page 21
mov [gbSysInterruptMask],a
;*********************************************
MainLoop:
; Enable interrupts to current mask
mov a,[gbSysInterruptMask]
iowr SysInterrupt
;*************************
; do nothing until we are enumerated
mov a,0
cmp a,[gbSysEnumerated]
jz MainLoop ; Not enumerated, loop
; Ah! We're enumerated, lets do the rest of the loop
;*************************
; Write a 0 to the LED on P13 to turn it on
mov a,~(LED_ON)
iowr SysPort1
; Wait 10 milliseconds
mov a,10
call SysDelayMS
;*************************
; Read temperature
call ThermReadTemperature
;*************************
; Update brightness?
; mov a,0
cmp a,[gbLEDBrightnessUpdate]
jz MainLoopNoLEDUpdate ; No, branch
; Yes, update the LED brightness
; Reset the LED update flag
; mov a,0h
mov [gbLEDBrightnessUpdate],a
; Set new brightness
mov a,[gbLEDBrightness]
iowr SysPort1ISinkPin3
; Fall through to here in any case
MainLoopNoLEDUpdate:
; Loop
jmp MainLoop
;*********************************************
halt
; Oops! We should never get here
;********************************************************
; SysTimer1024usEvent()
; @func Timer interrupt event ocurring every 1.024 mSec
; using 6Mhz crystal.
;********************************************************
SysTimer1024usEvent:
; Save accumulator
push a
; Clear watchdog timer
; Clearing it here effectively disables the timer
iowr SysWatchDog
; Keep track of length of any IDLE conditions (No bus activity)