chiark / gitweb /
comments and halfway read through -iwj
authorian <ian>
Mon, 3 Jan 2005 23:09:00 +0000 (23:09 +0000)
committerian <ian>
Mon, 3 Jan 2005 23:09:00 +0000 (23:09 +0000)
cebpic/nmra-stream.asm
detpic/nmra-stream.asm

index 63d92f7859a7c3ddbb230583a56a51a22f169514..adb3264c9c12c5f16a96d95c223a151d90c2c34e 100644 (file)
@@ -49,6 +49,7 @@ debug macro debugvalue
        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
 
@@ -136,10 +137,14 @@ initialise
 ; 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
 
 ; 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
 
 
 ;*****************************************************************************************
@@ -147,6 +152,7 @@ initialise
 main_loop_led
        call    led_green
        goto    main_loop_led
+*** do you really mean to set the led green in a tight loop ?? -iwj
 
 
 ;*****************************************************************************************
@@ -168,6 +174,7 @@ interrupt_low
 
 ; if 2 interrupts are set at once the 2nd will generate a new interrupt on leaving
 ; the interrupt routine
+; *** we hope and trust -iwj
 
 
 ;*****************************************************************************************
@@ -178,6 +185,7 @@ serial_receive
        movwf   FSR0H,0                 ; set high byte of IND0 pointer
        movff   RCREG,IND0              ; copy to received register
        incf    FROMSERIAL,1,0          ; advance FROMSERIAL pointer by 1 byte
+; *** check for overrun and do something sensible
        btfss   RCREG,7,0               ; check if bit 7 is set
        call    advance_write_buffer    ; if so, move to next buffer
        retfie  1
@@ -263,6 +271,8 @@ decide_next_bit
 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 63d92f7859a7c3ddbb230583a56a51a22f169514..adb3264c9c12c5f16a96d95c223a151d90c2c34e 100644 (file)
@@ -49,6 +49,7 @@ debug macro debugvalue
        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
 
@@ -136,10 +137,14 @@ initialise
 ; 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
 
 ; 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
 
 
 ;*****************************************************************************************
@@ -147,6 +152,7 @@ initialise
 main_loop_led
        call    led_green
        goto    main_loop_led
+*** do you really mean to set the led green in a tight loop ?? -iwj
 
 
 ;*****************************************************************************************
@@ -168,6 +174,7 @@ interrupt_low
 
 ; if 2 interrupts are set at once the 2nd will generate a new interrupt on leaving
 ; the interrupt routine
+; *** we hope and trust -iwj
 
 
 ;*****************************************************************************************
@@ -178,6 +185,7 @@ serial_receive
        movwf   FSR0H,0                 ; set high byte of IND0 pointer
        movff   RCREG,IND0              ; copy to received register
        incf    FROMSERIAL,1,0          ; advance FROMSERIAL pointer by 1 byte
+; *** check for overrun and do something sensible
        btfss   RCREG,7,0               ; check if bit 7 is set
        call    advance_write_buffer    ; if so, move to next buffer
        retfie  1
@@ -263,6 +271,8 @@ decide_next_bit
 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