simple1.pwp


//-------------------------------------------------------------------------
//
// PicoWeb Project File for Simple LED Control
//
//-------------------------------------------------------------------------
//
// application-specific preprocessor definitions
//
#define BANNER "\r\nPicoWeb WebLED\r\n"
#define EEPROM_IP         /* use file "ip" for 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 CLOCK 8000000
#define CLOCK 7372000     /* processor clock rate (Hz) */
#define BAUD_RATE 19200   /* serial port baud rate */

//
// application-specific HTML and image file names
//
simple1.htm      // (default Web page)
simple2.htm
simple3.htm
simple4.htm

//
// application-specific CGI routines
//
led_on.cgi     // (turn LED on)
led_off.cgi    // (turn LED off)
led_pulse.cgi  // (pulse LED on)

//
// included application-specific pcode and/or AVR assembly language follows
//
#avr_reset
;--------------------------------------------------------------------------
; this code is executed each time microcontroller is reset
;--------------------------------------------------------------------------
;
    sbi     ddrd,LED_BIT      ; make LED driver pin an output

#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
;--------------------------------------------------------------------------

.eseg
led_off:                      ; drive LED bit high
    pmovb buf,PORTD+0x20      ; get PORTD state
#ifdef NO_PORWI
    pandwi buf,~(1<<LED_BIT)  ; OR in LED bit
    pxorwi buf,1<<LED_BIT
#else
    porwi buf,1<<LED_BIT      ; OR in LED bit
#endif
    pmovb PORTD+0x20,buf      ; write back updated PORTD state
    pret

led_on:                       ; drive LED bit low
    pmovbi buf,PORTD+0x20     ; get PORTD state
    pandwi buf,~(1<<LED_BIT)  ; mask off in LED bit
    pmovb PORTD+0x20,buf      ; write back updated PORTD state
    pret

led_pulse:
    pcall led_off
    pcall my_delay
    pcall led_on
    pcall my_delay
    pcall led_off
    pret

my_delay:
    pmovwi buf,0xff        ; set delay loop count
my_loop:
    pwdr                   ; reset watchdog timer
    pdecw buf              ; decrement counter
    pjumpne my_loop        ; loop back if not down to zero
    pret


Back