#picaxe 08m2 ' Define PICAXE 08M2
#no_data ' Ignore EEPROM data - loads program faster
'========================================================================
Initialize: ' Initialize Routine - initialize pins and set up variables
LET dirsC = %00001000 ' Make pin C.3 a output; rest as inputs
LET pinsC = %00000000 ' Turn off all outputs on port C
SYMBOL IN = C.1 ' Define C.1 (pin 6) as IN to indicate input signal
SYMBOL RST = C.2 ' Define C.2 (pin 5) as RST to indicate reset switch
SYMBOL LED = C.3 ' Define C.3 (pin 4) as LED to indicate LED light
SYMBOL i = b0 ' Data byte variable used with reset button command
LET i = 0 ' Set i equal to 0
SYMBOL pulse_high = b1 ' Data byte variable used to set pulse high time
LET pulse_high = 500 ' Set pulse_num equal to 500 (milliseconds)
SYMBOL pulse_low = b2 ' Data byte variable used to set pulse low time
LET pulse_high = 500 ' Set pulse_num equal to 500 (milliseconds)
'========================================================================
Main: ' Main Routine
IF IN = 1, THEN DoIt ' If IN (input pin) is high, then go to DoIt routine
GOTO Main ' Go to Main routine
'========================================================================
DoIt: ' DoIt Routine
HIGH LED ' Turn on LED
PAUSE pulse_high ' Wait for pulse_high time
BUTTON RST,1,255,0,i,1,CLR ' If reset button is pressed, go to CLR routine
LOW LED ' Turn off LED
PAUSE pulse_low ' Wait for pulse_low time
BUTTON RST,1,255,0,i,1,Main ' If reset button is pressed, go to main routine
GOTO DoIt ' Go to DoIt routine
'========================================================================
CLR: ' CLR Routine
LOW LED ' Turn off LED
GOTO Main ' Go to Main routine
'========================================================================
END ' End program
#picaxe 08m2 ' Define PICAXE 08M2
#no_data ' Ignore EEPROM data - loads program faster
'========================================================================
Initialize: ' Initialize Routine - initialize pins and set up variables
LET dirsC = %00010000 ' Make pin C.3 a output; rest as inputs
LET pinsC = %00000000 ' Turn off all outputs on port C
SYMBOL IN = pinC.1 ' Define C.1 (pin 6) as IN to indicate input signal
SYMBOL RST = C.2 ' Define C.2 (pin 5) as RST to indicate reset switch
SYMBOL LED = C.4 ' Define C.3 (pin 4) as LED to indicate LED light
SYMBOL i = b0 ' Data byte variable used with reset button command
LET i = 0 ' Set i equal to 0
SYMBOL pulse_high = b1 ' Data byte variable used to set pulse high time
LET pulse_high = 500 ' Set pulse_num equal to 500 (milliseconds)
SYMBOL pulse_low = b2 ' Data byte variable used to set pulse low time
LET pulse_high = 500 ' Set pulse_num equal to 500 (milliseconds)
'========================================================================
Main: ' Main Routine
IF IN = 1 THEN DoIt ' If IN (input pin) is high, then go to DoIt routine
GOTO Main ' Go to Main routine
'========================================================================
DoIt: ' DoIt Routine
HIGH LED ' Turn on LED
PAUSE pulse_high ' Wait for pulse_high time
BUTTON RST,1,255,0,i,1,CLR ' If reset button is pressed, go to CLR routine
LOW LED ' Turn off LED
PAUSE pulse_low ' Wait for pulse_low time
BUTTON RST,1,255,0,i,1,Main ' If reset button is pressed, go to main routine
GOTO DoIt ' Go to DoIt routine
'========================================================================
CLR: ' CLR Routine
LOW LED ' Turn off LED
GOTO Main ' Go to Main routine
'========================================================================
END ' End program
Could you elaborate? I'm not sure what you are asking.could i reset with a 0
BUTTON RST,0,255,0,i,1,Main ' If reset button is pressed, go to main routine
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
Build a Real-Time Clock with Picaxe 08M2 project missing download | Microcontrollers | 5 | ||
D | Arduino or PICAXE Project Feasibility? | Digital Design | 1 | |
Picaxe small project request | General Electronics Chat | 4 | ||
D | PICAXE Radio Project | General Electronics Chat | 34 | |
D | PICAXE Project Help | General Electronics Chat | 37 |