program MyProject
sub procedure WaitLoop()
'dim i as word
'for i=1 to 2
' 256 - 20MHz / 4 / 38kHz(B.P.F Center Frequency) / 2(On and Off) = 190.21
TMR0 = 200
' TMR0 = 190
' TMR0 = 0
INTCON.T0IF = 0
while INTCON.T0IF = 0
wend
INTCON.T0IF = 0
'next i
end sub
main:
CMCON = %00000111 ' CM2:CM0 = 111 -> No Comparater
TRISIO = %00001110 ' GP0,4 is OUT (TRISIO<3> always reads 1)
ANSEL = %00000000 ' ANS3:ANS0 = 0000 -> No A/D
OPTION_REG = %11011111 ' GPIO pull-ups are disabled
' INTEDG: Interrupt Edge Select bit
' TMR0 Clock Source Select bit 0 = Internal instruction cycle clock (CLKOUT)
' T0SE: TMR0 Source Edge Select bit
' =1 -> Prescaler is assigned to the WDT (TMR0 does not use Prescaler)
' PS2:PS0: Prescaler Rate Select bits
INTCON = %10100000 ' Global Interrupt Enables
' PEIE: Peripheral Interrupt Enable bit
' TMR0 Overflow Interrupt Enable
' INTE: GP2/INT External Interrupt Enable bit
' GPIE: Port Change Interrupt Enable bit
' T0IF = 1 means overflowed
' INTF: GP2/INT External Interrupt Flag bit
' GPIF: Port Change Interrupt Flag bit
While TRUE
WaitLoop
GPIO.0 = 1
WaitLoop
GPIO.0 = 0
Wend
end.