Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
program Chimes
sub procedure Tone1
Sound_Play(230, 5200)
end sub
sub procedure Melody
Tone1
end sub
main:
TRISB = 0
Sound_Init(PORTB,2) ' Initialize sound engine
Melody ' Play the chimes
DELAY_MS(25000) 'DELAY FOR 25 SECONDS
DELAY_MS(25000) ' DELAY FOR 25 SECONDS
DELAY_MS(25000) ' DELAY FOR 25 SECONDS
DELAY_MS(25000) ' DELAY FOR 25 SECONDS
end.
program Chimes
sub procedure Tone1
Sound_Play(130, 6200) ' The 6200 controls the tone length
end sub
sub procedure Melody
Tone1
end sub
main:
TRISA = 0xFF
Sound_Init(PORTB,2) ' Initialize sound engine
e_loop:
IF PORTA.0 = [COLOR="Blue"]1[/COLOR] THEN ' if input at porta.0 goes low
Melody ' Play the chimes
DELAY_MS(2000) 'This just delays 2 seconds not play
END IF
goto e_loop
end.
Can't do a step through..this pic 16F628 ,not supported.If it wasn't for bad luck.....
program Chimes
sub procedure Tone1
Sound_Play(130, 6200) ' The 6200 controls the tone length
end sub
sub procedure Melody
Tone1
end sub
main:
TRISA = 0xFF
Sound_Init(PORTB,2) ' Initialize sound engine
e_loop:
IF PORTA.2 = 0 THEN ' if input at porta.0 goes low
Melody ' Play the chimes
DELAY_MS(2000) 'This just delays 2 seconds not play
END IF
goto e_loop
end.
try to use RA2 this time and set to pullup and give a tryCode:program Chimes sub procedure Tone1 Sound_Play(130, 6200) ' The 6200 controls the tone length end sub sub procedure Melody Tone1 end sub main: TRISA = 0xFF Sound_Init(PORTB,2) ' Initialize sound engine e_loop: IF PORTA.2 = 0 THEN ' if input at porta.0 goes low Melody ' Play the chimes DELAY_MS(2000) 'This just delays 2 seconds not play END IF goto e_loop end.
program input_test '16F628 8mhz
porta.0 = 1 'porta.0 as input
portb.0 = 0 ' portb.0 as output
if porta.0 = 1 then 'if button porta.0 pressed
portb.0 = 1 ' then led portb.0 turns on
end if
end.
No change. Had to look it up to see what it meant.
program input_test '16F628 8mhz
porta.0 = 1 'porta.0 as input
portb.0 = 0 ' portb.0 as output
CMCON = 7
if porta.0 = 1 then 'if button porta.0 pressed
portb.0 = 1 ' then led portb.0 turns on
end if
end.
Here it is. I may need a lot more to make it work, but I don't know what it would be.
Using HS enabled and WDT, LVP , XINT disabled.
Code:program input_test '16F628 8mhz porta.0 = 1 'porta.0 as input portb.0 = 0 ' portb.0 as output CMCON = 7 if porta.0 = 1 then 'if button porta.0 pressed portb.0 = 1 ' then led portb.0 turns on end if end.
program test
sub procedure interrupt
If INTCON.INTF = 1 Then ' Must read status once in order to set to 0
PortA.0 = 1 ' LED PortA.0 High
End If
INTCON.INTF = 0
end sub
sub procedure INIT_Reg
OPTION_REG = 0
INTCON = 0
OPTION_REG.INTEDG = 1 ' interrupt on RB0 rising edge
INTCON.INTE = 1
INTCON.INTF = 0
INTCON.GIE = 1 ' enable global interrupts
end sub
main:
PORTA = %00000000
PORTB = %00000000 'All ports set to Low, 0 Again MSBF PortB/A 76543210
' PORTB/A %00000000
TRISA = %00000000
TRISB = %00000001 ' RB0 as input remember MSBF So PortB/A 7654321
' TRISB/A %0000001
INIT_Reg ' Set things up
While true ' Endless Loop
nop ' Do nothing
Wend
end.