What might be the reason or the reasons for PBP developers not to write Hser commands for 3,4,5 ?
Hserout3,Hserout4,Hserout5 ?
or Hserinx ?
Hserout3,Hserout4,Hserout5 ?
or Hserinx ?
;*******************************************************************************
; Defines section.
;*******************************************************************************
DEFINE OSC 32 ; Oscillator set to 32Mhz set by Config1 above.
;*******************************************************************************
; Timer 1 control registers.
;*******************************************************************************
T1CON = %00110110 ; Prescaler=8, Do not Synch, TMR1 OFF.
T1GCON = %00000000 ; Timer 1 Gate disabled.
T1CLK = %00000101 ; MFINTOSC Selected for Timer 1 clock source.
PIR4.0 = 0
TMR1L = $0A
TMR1H = 0
;*******************************************************************************
; Interrupt control registers. Not used.
;*******************************************************************************
INTCON = %11000000 ;
' PIE0 = %00000000 ;
' PIE1 = %00000000 ;
' PIE2 = %00000000 ;
' PIE3 = %00000000 ;
PIE4 = %00000001 ;
' PIE5 = %00000000 ;
' PIE6 = %00000000 ;
' PIE7 = %00000000 ;
' PIE8 = %00000000 ;
;*******************************************************************************
; Interrupt On Change for ports with IOC. Ports A,B and C only apply.
; 1 = enabled, 0 = diabled.
;*******************************************************************************
IOCAF = %00000000 ; Interrupt-on-Change PORTA flags.
IOCAP = %11111111 ; Interrupt-on-Change PORTA Positive Edge Enable bits.
IOCAN = %00000000 ; Interrupt-on-Change PORTA Negative Edge Enable bits.
IOCBF = %00000000 ; Interrupt-on-Change PORTB flags.
IOCBP = %11111111 ; Interrupt-on-Change PORTB Positive Edge Enable bits.
IOCBN = %00000000 ; Interrupt-on-Change PORTB Negative Edge Enable bits.
;*******************************************************************************
;ASM INTERRUPTS COURTESY OF DARREL TAYLOR.
;*******************************************************************************
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _ToggleLED1, PBP, yes
INT_Handler IOC_INT, _RelaySense, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
PAUSE 500
goto Start
;*******************************************************************************
; INTERRUPT SERVICE ROUTINES START HERE.
;*******************************************************************************
; IOC interrupt handler checks which interrupt flag has been set for PORTA and
; PORTB. Each flag bit corresponds to an output. Example: IF IOCAF.1 is set,
; then we set TimerEnable.1, which then is checked in the Main loop, which then
; sets PORTC.1 Output high for the duration of the counter.
;*******************************************************************************
RelaySense:
TempIOCFlgs.byte0 = IOCAF ; Copy IOC Flags to a temp register.
TempIOCFlgs.byte1 = IOCBF ; Copy IOC Flags to a temp register.
for GPCounter = 0 to 15
if TempIOCFlgs.0[GPCounter] = 1 then ; Check each flag to see if it's set.
TimerEnable.0[GPCounter] = 1 ; If so, set Timer enable flags to check in Main loop.
' TempPortS.0[GPCounter] = 1
endif
next GPCounter
TempIOCAF = IOCAF ^ $FF ; Clear the individual interrupt flags.
IOCAF = TempIOCAF & IOCAF
TempIOCBF = IOCBF ^ $FF ; Clear the individual interrupt flags.
IOCBF = TempIOCBF & IOCBF
@ INT_RETURN
;*******************************************************************************
; Timer 1 interrupt handler toggles StatLED1 as our heart beat.
;*******************************************************************************
ToggleLED1:
toggle StatLED1 ; Toggle Heart Beat LED once per a little over 1 second.
@ INT_RETURN
;*******************************************************************************
; CODE STARTS HERE.
;*******************************************************************************
; Start of program. We clear all variables, initialize those that need to be
; and turn on our Status LEDs for half a second.
;*******************************************************************************
Start:
clear
IOCAF = $FF ; Clear PortA IOC flag register.
IOCBF = $FF ; Clear PortB IOC flag register.
TempPortS = $FFFF ; Initialize variable.
LATE = 0 ; Turn on Yellow Stat LEDs. LED check and Version header.
pause 800 ; Wait 1/2 Second.
StatLED2 = 0 ; Turn on Yellow Stat LED. Display binary number 1.
StatLED3 = 1 ; Turn off Yellow Stat LED.
StatLED4 = 1 ; Turn off Yellow Stat LED.
pause 800 ; Wait 1/2 Second.
LATE = 7 ; Turn off Yellow Stat LEDs.
StatLed1 = 1 ; Toggling the Blue led indicates sub-version or decimal point.
pause 300
StatLed1 = 0
pause 300
StatLed1 = 1
pause 300
StatLED2 = 0 ; Turn on Yellow Stat LED. Display binary number 3.
StatLED3 = 0 ; Turn on Yellow Stat LED.
StatLED4 = 1 ; Turn off Yellow Stat LED.
pause 800 ; Wait 1/2 Second.
LATE = 7 ; Turn off Yellow Stat LEDs.
T1CON.0 = 1 ; Enable Timer 1
@ INT_ENABLE TMR1_INT ; Enable Timer 1 interrupts
@ INT_ENABLE IOC_INT ; Enable Interrupts On Change interrupts
;*******************************************************************************
;*******************************************************************************
; Main loop where we check the TimerEnable flag bits to see if they are set.
; If set, then we set the SurgeCntX output high, decrement the SCCounter until
; it reaches ZERO, and then clear the output and our TimerEnableX flag bit.
; Output pulse is 300mS long.
;*******************************************************************************
Main: ...
' Name : Messages.pbp
' Compiler : PICBASIC PRO Compiler 2.6
' Assembler : MPASM
' Target PIC : PIC16F628A
' Hardware : VeroBoard
' Oscillator : 4 Megs External
' Keywords : MP3 Messages
' Description : Messages
' Using the Catalex MP3 Player.
DEFINE OSC 4 'Set oscillator in MHz
'OSCCON = $60 '4 Megs Xtal
TRISA=0 'Port A all outputs
TRISB=%00001100 'Make RB3 and RB4 inputs
'OPTION_REG.7=0 'Enable internal pull-ups
CMCON=7 'No Analogs
DEFINE HSER_TXSTA 24H 'Set transmit status and control
DEFINE HSER_RCSTA 90H 'Set receive status and control
DEFINE HSER_BAUD 9615 'Baud Rate 9600 Catalex Uart
define HSER_CLROERR 1 ' Clear Buffer
define HSER_SPBRG 25 '
' Alias pins
HOOK Var PORTB.3 'Hook input
PULSE VAr PORTB.4 'Pulse Input
VOL con 20 ' Volume Level 0 to 30
MESSAGE Var word ' Message Number
hserout [$7E,$FF,$06,$09,$00,$00,$02,$EF] 'Select TF Device
pause 200
hserout [$7E,$FF,$06,$06,$00,$00,$14,$EF] 'Volume Set
pause 200
Gosub shhh 'Stop playing
'pause 20
dial: count pulse,5000,Message
pause 10
if message=1 then 'Mess1
gosub Track1
ENDif
if message=2 then 'Mess2
gosub Track2
endif
if message=3 then 'Mess3
gosub Track3
Endif
if message=4 then '
gosub Track4
ENDif
if message=5 then '
gosub Track5
ENDif
if message=6 then '
gosub Track6
ENDif
if message=7 then '
gosub Track7
ENDif
if message=8 then '
gosub Track8
ENDif
if message=9 then '
gosub Track9
ENDif
if message=10 then '
gosub Track10
ENDif
goto dial
track1: gosub shhh
hserout [$7E,$FF,$06,$03,$00,$00,$01,$EF] 'Message 1
return
track2: gosub shhh
hserout [$7E,$FF,$06,$03,$00,$00,$02,$EF] 'Message 2
return
track3: gosub shhh
hserout [$7E,$FF,$06,$03,$00,$00,$03,$EF] 'Message 3
return
track4: gosub shhh
hserout [$7E,$FF,$06,$03,$00,$00,$04,$EF] 'Message 4
return
track5: gosub shhh
hserout [$7E,$FF,$06,$03,$00,$00,$05,$EF] 'Message 5
return
track6: gosub shhh
hserout [$7E,$FF,$06,$03,$00,$00,$06,$EF] 'Message 6
return
track7: gosub shhh
hserout [$7E,$FF,$06,$03,$00,$00,$07,$EF] 'Message 7
return
track8: gosub shhh
hserout [$7E,$FF,$06,$03,$00,$00,$08,$EF] 'Message 8
return
track9: gosub shhh
hserout [$7E,$FF,$06,$03,$00,$00,$09,$EF] 'Message 9
return
track10: gosub shhh
hserout [$7E,$FF,$06,$03,$00,$00,$0A,$EF] 'Message 10
return
d_tone: gosub shhh
hserout [$7E,$FF,$06,$03,$00,$00,$0C,$EF] 'Tone low res
return
Shhh : hserout [$7E,$FF,$06,$16,$00,$00,$00,$EF] 'Stop Playing
pause 200
Return
End
DEFINE OSC 8
define RESET_ORG 0h
define NO_CLRWDT 1
DEFINE DEBUG_REG PORTD
DEFINE DEBUG_BIT 5
DEFINE DEBUG_BAUD 2400
DEFINE DEBUG_MODE 1
Clear 'Alle Variabeln löschen
OSCCON=110000 'Set to 8 MHz
Low PortD.6 ' LED2
low PortD.7 ' LED1
low PortB.2
'Init Interrupts
PIR1 =000000 'clear all Interrupt flags
PIE1 =000000 'turn on USART Receive '+ P1_AD Interrupt 'V174
INTCON=000000 'turn on Global Interrupts and Periph Interrupts
INTCON2=000000 'PORT B Pullup disabled
SSPCON1.5=0 'Disable SSP
PortD.7 = 1
Pause 1000
PortD.7 = 0
MainLoop :
PortD.6 = 1
Pause 100
PortD.6 = 0
pause 100
GoTo Mainloop
d = 1 / ((x1 - x2) * (x1 - x3) * (x2 - x3));
a = d * (x1 * (y3 - y2) + x2 * (y1 - y3) + x3 * (y2 - y1));
b = d * (x1 * x1 * (y2 - y3) + x2 * x2 * (y3 - y1) + x3 * x3 * (y1 - y2));
c = d * (x1 * x2 * y3 * (x1 - x2) + x1 * x3 * y2 * (x3 - x1) + x2 * x3 * y1 * (x2 - x3));
y(x) = a*x*x + b*x + c