-; pin 21 (per-pic-led, RD2/PSP2/C1IN) states: high H = green, low L = red, float Z = black
+; pin 21 (per-pic-led, RD2/PSP2/C1IN) states:
+; high H = green, low L = red, float Z = black
org 0
goto initialise
-;*****************************************************************************************
+;****************************************************************************
; high priority interrupt
org 000018h
goto interrupt_low
-;*****************************************************************************************
+;****************************************************************************
code
-;*****************************************************************************************
+;****************************************************************************
macros
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
+*** 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
-;*****************************************************************************************
+;****************************************************************************
initialise
bsf SPBRG,7,0
bsf SPBRG,0,0
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
; timer 0 set-up
bcf T0CON,0,0 ; }
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
; initialise buffers (for BSR5, for nmra from-serial/to-track buffers)
movwf BSR,0 ; set BSR to 5
clrf NMRACTRL,0 ; for bits relevant to control of nmra stream
- clrf FROMSERIAL,0 ; for location of write-from-usart pointer within BSR5
- clrf TOTRACK,0 ; for location of send-to-track pointer within BSR5
+ clrf FROMSERIAL,0 ; for loc'n of write-from-usart ptr within BSR5
+ clrf TOTRACK,0 ; for loc'n of send-to-track ptr within BSR5
; all in access bank
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
; initialise next action/transmit bit
bsf PORTC,1,0 ; booster pwm high
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
; interrupt set-up
*** generate a spurious high-priority interrupt -iwj
-;*****************************************************************************************
+;****************************************************************************
main_loop_led
call led_green
*** do you really mean to set the led green in a tight loop ?? -iwj
-;*****************************************************************************************
+;****************************************************************************
interrupt_high
goto panic
-;*****************************************************************************************
+;****************************************************************************
interrupt_low
; check which interrupt. Branch to serial_receive or timer or return
- btfss PIR1,5,0 ; check whether serial receive interrupt bit set
+ btfss PIR1,5,0 ; check whether serial recv interrupt bit set
goto serial_receive
btfss INTCON,2,0 ; check whether timer0 interrupt set
goto timer0_interrupt
goto panic
-; if 2 interrupts are set at once the 2nd will generate a new interrupt on leaving
-; the interrupt routine
+; if 2 interrupts are set at once the 2nd will generate a new
+; interrupt on leaving the interrupt routine
; *** we hope and trust -iwj
-;*****************************************************************************************
+;****************************************************************************
serial_receive
movff FROMSERIAL,FSR0L ; set low byte of IND0 pointer
return
-;*****************************************************************************************
+;****************************************************************************
timer0_interrupt
bcf INTCON,2,0 ; clear interrupt-set bit
movlw 0x6E
- movwf W,TMR0L ; set timer0 to 0x6E (so that interrupt takes 58us)
+ movwf W,TMR0L ; set timer0 to 0x6E (so interrupt takes 58us)
; check next action - if 0, change to 1 and return
advance_pointer
-; currently on bit 7 of the byte, after having read rest of byte to track; check whether it is 1 or 0
+; currently on bit 7 of the byte, after having read rest of byte to
+; track; check whether it is 1 or 0
movff TOTRACK,FSR1L
movlw 5
-;*****************************************************************************************
+;****************************************************************************
led_green
return
led_black
- bsf TRISD,2,0 ; make pin RD2 an input (i.e. set Z, black) (DS100)
+ bsf TRISD,2,0 ; make pin RD2 an input (i.e. set Z, black)
+ ; (DS100)
return
led_red
call led_red
goto panic_loop
-;*****************************************************************************************
+;****************************************************************************
end
-; pin 21 (per-pic-led, RD2/PSP2/C1IN) states: high H = green, low L = red, float Z = black
+; pin 21 (per-pic-led, RD2/PSP2/C1IN) states:
+; high H = green, low L = red, float Z = black
org 0
goto initialise
-;*****************************************************************************************
+;****************************************************************************
; high priority interrupt
org 000018h
goto interrupt_low
-;*****************************************************************************************
+;****************************************************************************
code
-;*****************************************************************************************
+;****************************************************************************
macros
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
+*** 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
-;*****************************************************************************************
+;****************************************************************************
initialise
bsf SPBRG,7,0
bsf SPBRG,0,0
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
; timer 0 set-up
bcf T0CON,0,0 ; }
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
; initialise buffers (for BSR5, for nmra from-serial/to-track buffers)
movwf BSR,0 ; set BSR to 5
clrf NMRACTRL,0 ; for bits relevant to control of nmra stream
- clrf FROMSERIAL,0 ; for location of write-from-usart pointer within BSR5
- clrf TOTRACK,0 ; for location of send-to-track pointer within BSR5
+ clrf FROMSERIAL,0 ; for loc'n of write-from-usart ptr within BSR5
+ clrf TOTRACK,0 ; for loc'n of send-to-track ptr within BSR5
; all in access bank
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
; initialise next action/transmit bit
bsf PORTC,1,0 ; booster pwm high
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
; interrupt set-up
*** generate a spurious high-priority interrupt -iwj
-;*****************************************************************************************
+;****************************************************************************
main_loop_led
call led_green
*** do you really mean to set the led green in a tight loop ?? -iwj
-;*****************************************************************************************
+;****************************************************************************
interrupt_high
goto panic
-;*****************************************************************************************
+;****************************************************************************
interrupt_low
; check which interrupt. Branch to serial_receive or timer or return
- btfss PIR1,5,0 ; check whether serial receive interrupt bit set
+ btfss PIR1,5,0 ; check whether serial recv interrupt bit set
goto serial_receive
btfss INTCON,2,0 ; check whether timer0 interrupt set
goto timer0_interrupt
goto panic
-; if 2 interrupts are set at once the 2nd will generate a new interrupt on leaving
-; the interrupt routine
+; if 2 interrupts are set at once the 2nd will generate a new
+; interrupt on leaving the interrupt routine
; *** we hope and trust -iwj
-;*****************************************************************************************
+;****************************************************************************
serial_receive
movff FROMSERIAL,FSR0L ; set low byte of IND0 pointer
return
-;*****************************************************************************************
+;****************************************************************************
timer0_interrupt
bcf INTCON,2,0 ; clear interrupt-set bit
movlw 0x6E
- movwf W,TMR0L ; set timer0 to 0x6E (so that interrupt takes 58us)
+ movwf W,TMR0L ; set timer0 to 0x6E (so interrupt takes 58us)
; check next action - if 0, change to 1 and return
advance_pointer
-; currently on bit 7 of the byte, after having read rest of byte to track; check whether it is 1 or 0
+; currently on bit 7 of the byte, after having read rest of byte to
+; track; check whether it is 1 or 0
movff TOTRACK,FSR1L
movlw 5
-;*****************************************************************************************
+;****************************************************************************
led_green
return
led_black
- bsf TRISD,2,0 ; make pin RD2 an input (i.e. set Z, black) (DS100)
+ bsf TRISD,2,0 ; make pin RD2 an input (i.e. set Z, black)
+ ; (DS100)
return
led_red
call led_red
goto panic_loop
-;*****************************************************************************************
+;****************************************************************************
end