gnupic: Re: [gnupic] in-circuit debugger
Subject:
Re: [gnupic] in-circuit debugger
From:
Byron A Jeff ####@####.####
Date:
5 Feb 2007 12:10:40 +0000
Message-Id: <20070205120603.GA17315@cleon.cc.gatech.edu>
On Sun, Feb 04, 2007 at 02:32:47PM -0700, Maxim Wexler wrote:
> >
> >
> >Describe the circuit wiring diagram and post the code.
>
>
>
> Hmm, seems to be one of yours, Byron. Now's a good time to ask about the
> '^80s'. They don't show up in the 'step' output and I took one out without
> effect. What are they for?
Just to get rid of the error messages when using register addresses that are
greater than 0x80. No actual effect on the code because there's only a 7 bit
slot for the register number, which causes the error to begin with.
> Works as desired in gpsim: toggling RB5 stops and starts display. In
> hardware -- LEDs never light.
OK. I see the intended effect. I presume that the switch is wired between
RB5 and GND with a pullup resistor (what value?) and the LED (how many?)
is wired to RB0?
Question: does the LED blink in hardware without the switch code? Also
I can't remember how long the delay is supposed to be.
BAJ
>
> ;
> ; blink88.asm -- A PIC16F88 Hello World Program
> ;
>
> ;
> ; source code for gpasm by Byron Jeff - July 31st 2002,
> ;
> ;
>
> ; The standard 1st Blinky LED program for PICDesigner.
>
> ; I/O
> ; B0-B2,E0: Interface to 7445 decoder which grounds cathodes.
> ; D0-D7 : Interface to LED anodes.
>
> ;
> ; define PIC device type
> ;
> LIST P=16F88
>
> ;
> ; define config fuses
> ;
> __config
> _CONFIG1,_BODEN_OFF&_CP_OFF&_PWRTE_ON&_WDT_OFF&_LVP_ON&_INTRC_IO&_MCLR_OFF
>
> ; Reset the default radix to decimal. I use 0x for hex numbers
> RADIX DEC
>
> ;
> ; include PIC register definitions, and some macros
> ;
> #include "p16f88.inc"
>
> ; Define some variables
> SW equ 5
>
> CBLOCK 0x20
> c1
> c2
> c3
> display
> endc
>
> ;
> ; code start
> ;
> org 0
> goto init
>
> org 8 ; Leave room for later interrupts
>
> init
> bsf STATUS,RP0 ;register page 1
> movlw 0x70
> movwf OSCCON ;^ 0x80
> bcf STATUS,RP0 ;register page 0
> clrf PORTB ;
> bsf STATUS,RP0 ;register page 1
> movlw 0xf8
> movwf TRISB ^ 0x80 ;initialize port B so that portb0-b2 is out
> bcf STATUS,RP0 ;register page 0
> clrf PCLATH
>
> clrf PORTB
>
> clrf display ; clear the display
>
> main
> movf display,w ; get the display
> andlw 7 ; only last 3 digits
> movwf PORTB ; Set the column
> call delay
> incf display,F ; next display
> goto main ; loop forever.
> switch
> ;blank
> clrf PORTB
> retlw 0
> ;goto blank
> delay
> clrf c1
> clrf c2
> movlw 20
> movwf c3
>
> kwloop
> btfsc PORTB,SW ; RB5 switch press?
> call switch
> decfsz c1,F ; Delay awhile for char to xmit
> goto kwloop
> decfsz c2,F
> goto kwloop
> decfsz c3,F
> goto kwloop
> return
>
> END
>
> Circ: leds on RB0-2, one debounced-by-hardware pb switch(NO).
>
> Maxim