chiark / gitweb /
mall chnages to nmra-stream.asm
authorceb <ceb>
Tue, 4 Jan 2005 22:11:15 +0000 (22:11 +0000)
committerceb <ceb>
Tue, 4 Jan 2005 22:11:15 +0000 (22:11 +0000)
cebpic/nmra-stream.asm
detpic/nmra-stream.asm

index 97716aa5a46a06cf45247b5f36ed35493bf97a6d..71749f30e8d7133b65f84a1598be9dfb92f32354 100644 (file)
@@ -47,11 +47,12 @@ macros
 debug macro debugvalue
        movlw   debugvalue
        call    debug_serial_transmit
+waitfortsr
+       btfss   TXSTA,1,0
+       bra     waitfortsr
        endm
 
 debug_serial_transmit
-*** check and wait for flag so that it
-***  works if we debug twice in quick succession -iwj
        movwf   TXREG,0         ; move contents of W (i.e. debugvalue)
                                ;       to TXREG for transmission
        return
@@ -138,24 +139,19 @@ initialise
        bsf     INTCON,6,0      ; enable low-priority interrupts
 
 ; interrupt set-up for serial receive
-       bsf     PIE1,5,0        ; enable USART receive interrupt (p85)
        bsf     IPR1,5,0        ; set to low-priority interrupt
-*** surely we should set the priority before enabling it, or you might
-***  generate a spurious high-priority interrupt  -iwj
+       bsf     PIE1,5,0        ; enable USART receive interrupt (p85)
 
 ; interrupt set-up for timer0 interrupt p79/80
-       bsf     INTCON,5,0      ; enable timer0 interrupts
        bcf     INTCON2,2,0     ; timer0 overflow low priority
-*** surely we should set the priority before enabling it, or you might
-***  generate a spurious high-priority interrupt  -iwj
+       bsf     INTCON,5,0      ; enable timer0 interrupts
 
 
 ;****************************************************************************
 
-main_loop_led
        call    led_green
+main_loop_led
        goto    main_loop_led
-*** do you really mean to set the led green in a tight loop ?? -iwj
 
 
 ;****************************************************************************
@@ -275,7 +271,6 @@ read_from_buffer
 
 ; if currently on bit 7, want to skip to bit 6
 ;*** wouldn't it be easier to start on bit 6 ? :-)  -iwj
-*** have read up to here -iwj
 
        btfss   TOTRACKBIT,7,0
        rrncf   TOTRACKBIT,1,0          ; rotate mask right
index 97716aa5a46a06cf45247b5f36ed35493bf97a6d..71749f30e8d7133b65f84a1598be9dfb92f32354 100644 (file)
@@ -47,11 +47,12 @@ macros
 debug macro debugvalue
        movlw   debugvalue
        call    debug_serial_transmit
+waitfortsr
+       btfss   TXSTA,1,0
+       bra     waitfortsr
        endm
 
 debug_serial_transmit
-*** check and wait for flag so that it
-***  works if we debug twice in quick succession -iwj
        movwf   TXREG,0         ; move contents of W (i.e. debugvalue)
                                ;       to TXREG for transmission
        return
@@ -138,24 +139,19 @@ initialise
        bsf     INTCON,6,0      ; enable low-priority interrupts
 
 ; interrupt set-up for serial receive
-       bsf     PIE1,5,0        ; enable USART receive interrupt (p85)
        bsf     IPR1,5,0        ; set to low-priority interrupt
-*** surely we should set the priority before enabling it, or you might
-***  generate a spurious high-priority interrupt  -iwj
+       bsf     PIE1,5,0        ; enable USART receive interrupt (p85)
 
 ; interrupt set-up for timer0 interrupt p79/80
-       bsf     INTCON,5,0      ; enable timer0 interrupts
        bcf     INTCON2,2,0     ; timer0 overflow low priority
-*** surely we should set the priority before enabling it, or you might
-***  generate a spurious high-priority interrupt  -iwj
+       bsf     INTCON,5,0      ; enable timer0 interrupts
 
 
 ;****************************************************************************
 
-main_loop_led
        call    led_green
+main_loop_led
        goto    main_loop_led
-*** do you really mean to set the led green in a tight loop ?? -iwj
 
 
 ;****************************************************************************
@@ -275,7 +271,6 @@ read_from_buffer
 
 ; if currently on bit 7, want to skip to bit 6
 ;*** wouldn't it be easier to start on bit 6 ? :-)  -iwj
-*** have read up to here -iwj
 
        btfss   TOTRACKBIT,7,0
        rrncf   TOTRACKBIT,1,0          ; rotate mask right