| |
webled.pwp
//-------------------------------------------------------------------------
//
// PicoWeb Project File for WebLED
//
//-------------------------------------------------------------------------
//
// application-specific preprocessor definitions
//
#define BANNER "\r\nPicoWeb WebLED\r\n"
#define EEPROM_IP /* use file "ip" for default IP address */
#define NET_CONFIG_IP /* allow IP address reconfiguration via net */
#define ENABLE_WATCHDOG /* use Atmel watchdog timer hardware */
#define DEBUGGER /* include debugger firmware */
#define TMP_BUF_LEN 16 /* size of "buf" (bytes) */
#define SER_INBUF_LEN 64 /* size of serial input queue (bytes) */
//#define CLOCK 8000000
#define CLOCK 7372000 /* clock rate of microcontroller (in Hz) */
#define BAUD_RATE 19200 /* serial port baud rate */
link add i2cprog_I2C_PORT1_PRESENT.o // use special version of I2C routine
//
// application-specific HTML and image file names
//
webled.htm // default Web page (i.e., "home page")
bruce.jpg
dave.jpg
steve.jpg
//
// application-specific public CGI routines
//
temperature.cgi // (returns ASCII temperature reading (deg-f)
//
// included application-specific pcode and/or AVR assembly language follows
//
#avr_reset
;--------------------------------------------------------------------------
; this code is executed each time microcontroller is reset
;--------------------------------------------------------------------------
;
.data
hit_count:: .skip 2 ; Web page hit counter (16-bits)
.text
sbi ddrd,LED_BIT ; make LED driver pin an output
ldi yl,0xEE ; start DS1621 temperature conversion
rcall ds1621_write
clr r17 ; clear hit counter on reset
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.
;-
;--------------------------------------------------------------------------
.eseg
temperature::
pcall tempf_buf ; read temp in deg-F
pprintswi [buf] ; output as decimal ascii
pret
;--------------------------------------------------------------------------
;+
; **-tempf_buf-read temp (deg-C) from DS1621 and convert to deg-F
;
; inputs:
; none
;
; outputs:
; buf = latest temperature reading in degrees Fahrenheit
;-
;--------------------------------------------------------------------------
.cseg
tempf_buf::
pclrw buf
pread_temp buf ; get temp
pmovwi buf+4,0x80 ; set up for sign test
pandwi buf+4,[buf] ; check the sign
pjumpeq temp_positive ; it is positive
pmovbi buf+1,0xff ; extend the sign
pnegw buf ; negate
temp_positive:
pmul buf,[buf],9 ; C*9
pdiv buf,[buf],5 ; /5
pandwi buf+4,0x80 ; test original sign
pjumpeq temp_norenegate ; positive
pnegw buf
temp_norenegate:
paddwi buf,32 ; +32 - buf now has temp (F)
pret
;--------------------------------------------------------------------------
;+
; **-pshow_hits-print bump SRAM hit counter and then display as text
;
; inputs:
; hit_count (SRAM)
;
; outputs:
; hit_count = hit_count + 1
; print hit_count as decimal ASCII
;-
pshow_hits::
pincw hit_count ; bump hit counter
pprintswi [hit_count] ; output as decimal ascii
pret
Back
|
|
|