Hola
De los ejemplos que vienen con PROTEUS cogi el archivo Doorbell.asm de un circuito que genera 2 melodias con el pic 16f84, pero la parte señalada en rojo no la entiendo.
No pongo el codigo completo, ya que lo teneis disponible en los ejemplos que incorpora proteus.
LIST p=16F84 ; PIC16F844 is the target processor
#include "P16F84.INC" ; Include header file
CBLOCK 0x10 ; Temporary storage
tempo
tptrl
tptrh
note
length
pitch
temp
dl1
dl2
ENDC
ORG 0
entrypoint goto initialise
ORG 4
intvector goto toggle
initialise ; Register set up:
clrw ; Zero.
movwf PORTA ; Ensure PORTB is zero before we enable it.
movwf PORTB ; Ensure PORTB is zero before we enable it.
bsf STATUS,RP0 ; Select Bank 1
clrf TRISB ; Port B is outputs
; Set up timer 0 for tone generation
movlw 0x02 ; Prescaler on, internal clocking, divide by 4
movwf OPTION_REG
bcf STATUS,RP0 ; Back to bank 0
; Poll for a button
wait clrf PORTB
wloop btfss PORTA,0
goto playtune0
btfss PORTA,1
goto playtune1
goto wloop
;Routines to play the tunes
playtune0 movlw 0x13
movwf PORTB
movlw 0x50
movwf tempo
movlw tune0 / 0x100
movwf tptrh
movlw tune0 % 0x100
movwf tptrl
goto playtune
playtune1 movlw 0x23
movwf PORTB
movlw 0xA0
movwf tempo
movlw tune1 / 0x100
movwf tptrh
movlw tune1 % 0x100
movwf tptrl
goto playtune
De los ejemplos que vienen con PROTEUS cogi el archivo Doorbell.asm de un circuito que genera 2 melodias con el pic 16f84, pero la parte señalada en rojo no la entiendo.
No pongo el codigo completo, ya que lo teneis disponible en los ejemplos que incorpora proteus.
LIST p=16F84 ; PIC16F844 is the target processor
#include "P16F84.INC" ; Include header file
CBLOCK 0x10 ; Temporary storage
tempo
tptrl
tptrh
note
length
pitch
temp
dl1
dl2
ENDC
ORG 0
entrypoint goto initialise
ORG 4
intvector goto toggle
initialise ; Register set up:
clrw ; Zero.
movwf PORTA ; Ensure PORTB is zero before we enable it.
movwf PORTB ; Ensure PORTB is zero before we enable it.
bsf STATUS,RP0 ; Select Bank 1
clrf TRISB ; Port B is outputs
; Set up timer 0 for tone generation
movlw 0x02 ; Prescaler on, internal clocking, divide by 4
movwf OPTION_REG
bcf STATUS,RP0 ; Back to bank 0
; Poll for a button
wait clrf PORTB
wloop btfss PORTA,0
goto playtune0
btfss PORTA,1
goto playtune1
goto wloop
;Routines to play the tunes
playtune0 movlw 0x13
movwf PORTB
movlw 0x50
movwf tempo
movlw tune0 / 0x100
movwf tptrh
movlw tune0 % 0x100
movwf tptrl
goto playtune
playtune1 movlw 0x23
movwf PORTB
movlw 0xA0
movwf tempo
movlw tune1 / 0x100
movwf tptrh
movlw tune1 % 0x100
movwf tptrl
goto playtune