Hi all again,
Could some kind person please rescue me from my torment? I have flogged on with this for about four hours now and I am just buzzing around in circles. What I want to do is make the output (called red_LED) act as a flip-flop on the rising edge of ‘Input’
What is happening in the real world using both the simulator and a physical CPU and LED’s is it completely ignores the latch_test condition and turns the LED off.
latch = 0
Main:
If Input = 1 Then
Set Test_LED on
Set red_LED on
End If
If Input = 0 Then
latch = latch + 1
Set Test_LED Off
goto latch_test
End If
Goto Main
latch_test:
If latch >= 2 Then
Set red_LED Off
End If
latch = 0
goto Main
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all again,
Could some kind person please rescue me from my torment? I have flogged on with this for about four hours now and I am just buzzing around in circles. What I want to do is make the output (called red_LED) act as a flip-flop on the rising edge of ‘Input’
What is happening in the real world using both the simulator and a physical CPU and LED’s is it completely ignores the latch_test condition and turns the LED off.
;Chip Settings
#chip 12F508,4
#config MCLRE=OFF, CP=OFF, WDT=OFF, OSC=INTRC
;Defines (Constants)
#define red_LED GPIO.0
#define Input GPIO.3
#define Test_LED GPIO.4
latch = 0
Main:
If Input = 1 Then
Set Test_LED on
Set red_LED on
End If
If Input = 0 Then
latch = latch + 1
Set Test_LED Off
goto latch_test
End If
Goto Main
latch_test:
If latch >= 2 Then
Set red_LED Off
End If
latch = 0
goto Main
Hi,
I think you need the 'dir' statements.
deep