| |
javahits.pwp
//-------------------------------------------------------------------------
//
// PicoWeb Project File for CLOCK
//
//-------------------------------------------------------------------------
//
// application-specific preprocessor definitions
//
#define BANNER "\r\nPicoWeb Java Clock\r\n"
#define EEPROM_IP /* use file "ip" for IP address */
#define ENABLE_WATCHDOG /* use Atmel watchdog timer hardware */
#define DEBUGGER /* include debugger firmware */
#define SERIAL_BAUD_DIVISOR 25 /* serial port speed: 19200 baud @ 8 MHz */
//
// application-specific HTML and image file names
//
javahits.htm // ii00 (default Web page)
ii01.class // ii01 (Java Applet)
hits.htm // ii02 (returns HTML page with ACSII temp reading)
//
// application-specific CGI routines
//
hits.cgi // iu00 (returns ASCII temperature reading (deg-f)
//
// application-specific assmbly language files
//
//mycode.asm
//
// included application-specific pcode and/or AVR assembly language follows
//
#avr_reset
;--------------------------------------------------------------------------
; this code is executed each time microcontroller is reset
;--------------------------------------------------------------------------
;
clr r17 ; clear hits counter
sts hit_count,r17
sts hit_count+1,r17
#avr_slow
;--------------------------------------------------------------------------
; this code is executed each trip through "slow idle" loop (~1 sec period)
;--------------------------------------------------------------------------
;
#avr_fast
;--------------------------------------------------------------------------
; this code is executed each trip through "fast idle" loop
;--------------------------------------------------------------------------
;
#avr_asm
;--------------------------------------------------------------------------
; application-specific CGI pcode and AVR assembly routines go here
;--------------------------------------------------------------------------
;
;--------------------------------------------------------------------------
;+
; **-temperature-show the temperature (deg-F) in decimal.
;-
;--------------------------------------------------------------------------
.dseg
hit_count: .byte 2
.cseg
hits:
pincw hit_count ; bump hit counter
pmovwi buf,[hit_count] ; move into buf
pcall decconv ; convert to decimal ascii
pret
;--------------------------------------------------------------------------
;+
; **-decconv-decimal converter.
;
; inputs:
; buf = word to convert
;
; outputs:
; result printed (with pputc)
;-
;--------------------------------------------------------------------------
#define DIG_BUF buf+6
#define DIG_PTR buf+4
#define DEC_REM buf+2
#define DEC_VAL buf
.cseg
decconv:
pmovwi DIG_PTR,DIG_BUF ; get input word
pbitwi DEC_VAL,0x8000 ; check the sign
pjumpeq decconv1 ; positive - start conversion
pnegw DEC_VAL ; negate it
pputc '-'
decconv1:
pdiv DEC_VAL,[DEC_VAL],10 ; get next one
paddwi DEC_REM,'0' ; convert digit for display
pmovbi [DIG_PTR],[byte DEC_REM] ; save digit
paddwi DIG_PTR,1 ; bump past digit just stored
psubwi DEC_VAL,0 ; test remaining value
pjumpne decconv1 ; if more to convert
decconv2:
psubwi DIG_PTR,1 ; point to next one
pputcb [byte DIG_PTR] ; show it
pcmpwi DIG_PTR,DIG_BUF ; check if just did last one
pjumpne decconv2 ; nope - do next one
pret
;--------------------------------------------------------------------------
.cseg
#include "muldiv.asm"
Back
|
|
|