Menu

Help with something pretty basic

Help
Keith
2012-02-10
2013-05-30
  • Keith

    Keith - 2012-02-10

    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

     
  • Nobody/Anonymous

    Hi,
    I think you need the 'dir' statements.

    deep

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.