A SERVICE OF

logo

Cypress CY3640 USB Starter Kit
User’s Guide
Cypress Semiconductor Ver 0.993
Page 18
H. Cypress USB Controller micro code (Assembly)
USB.ASM
;; USB_20.ASM
;*******************************************************************************
;
; *******************************************************************************
;
; Target:
; Cypress 7C63000 8bit RISC microcontroller with 1.5Mbps USB serial interface
; Dallas 1623: High Resolution Temperature Measurement Sensor
; Overview
; There are four main sub-systems: USB, Thermometer, LED, and Button.
; The system is started in the main() routine at reset. This routine
; initializes the USB variables, the IO ports, the Thermometer logic,
; and the data space. All USB communication occurs on an interrupt basis.
; First, Main() loops waiting for a USB reset.
; After receiving a USB reset, Main() enables the Endpoint 0 interrupt and
; loops waiting for Setups which ultimately will the result in the device
; being enumerated.
; Once the device has been enumerated on the USB, the main loop waits 10ms,
; polls the thermometer, updates the LED, and initializes end point 1 if
; appropriate.
; USB
; Endpoint 0 is used to support Control Transfers and vendor specific
; requests. End point 1 is also available for interrupt requests handling
; small packets of data (good for mouse, joystick, keyboard, thermometer, etc.).
; However, it is not used in this code.
; Each control transfer interrupts the processor and the subsequent routines
; services it.
; Thermometer
; A simple 9-bit temperature value is read from the thermometer every 10ms. At
; startup, the thermometer is initialized and placed into a continuous mode
; storing internally the current temperature. Thereafter, the temperature is
; read synchronously and returned into the USB end point one FIFO buffer.
; LED
; The LED is controlled by P13. When P13 goes low, the LED is turned on.
; The LED indicates the status of the USB connection. Once this device has
; "logically" been enumerated and configured to run on the serial bus, the LED
; is illuminated. The LED supports adjusting the brightness intensity by first
; setting the new brightens value (default: FFh = High) and then setting the
; brightness update field.
; Button
; A momentary push button is used to indicate that the application's
; Celsius/Fahrenheit display mode should be toggled.
; With each GetTemperature request, a value is sent indicating whether the
; button has been pushed.
; The GPIO interrupt is triggered by pushing the button causing its
; level to change from High to Low. A 100ms debounce was added to control the
; erroneous re-occurrence of this logical state change for a period. The
; 1024ms timer decrements the debounce to zero, re-enabling the button if at the
; end of the time out it has returned High.
;
; Port Usage
; P0.0 - Thermometer Data (input/output)
; .1 - Thermometer Clock (output)
; .2 - Thermometer Reset (output)
; .3 -
; .4 -
; .5 -
; .6 -
; .7 -
; P1.0 -
; .1 -