1. XxAxisxX

    Thread Starter New Member

    Mar 11, 2010
    6
    0
    Hi I really have no clue what I am doing. Basically I want to have 3 switches attached to a microprocessor. Each switch when pressed will do something different like SW1 will trigger immediately while SW2 will go after 4 seconds and SW3 will go after like 10 seconds. Then from the processor it will be transmitted to a receiver and then the receiving processor will apply current to the correct pins. I was using MicroCode studio to do this but I am not really sure what I am doing. This is what I had so far. Any help would be greatly appreciated. Thank you!

    Code ( (Unknown Language)):
    1. Check:
    2. IF Pin0 = 0 THEN SW1 ' If button connected to Pin0 is pushed (0), jump to label SW1
    3.     Endif
    4. IF Pin1 = 0 THEN SW2 ' If button connected to Pin1 is pushed (0), jump to label SW2
    5.     Endif
    6. IF Pin2 = 0 THEN SW3 ' If button connected to Pin2 is pushed (0), jump to label SW3
    7.     Endif
    8. Goto Check
    9. SW1:LOW 1        ' Turn off connected to PORTB.0
    10.         Pause 100       ' Delay for .1 seconds
    11.  
    12.         High 1           ' Turn on LED connected to PORTB.0  
    13.         Pause 500       ' Delay for .5 seconds            
    14.         Goto Check   ' Go back to loop and blink LED forever
    15.  
    16. SW2: LOW 1        ' Turn off connected to PORTB.0
    17.         Pause 10000       ' Delay for 10 seconds
    18.  
    19.         High 1           ' Turn on connected to PORTB.0
    20.         Pause 500       ' Delay for .5 seconds
    21.  
    22.         Goto Check   ' Go back to loop and blink LED forever
    23.         End
    24.  
    25. SW3: LOW 1        ' Turn off connected to PORTB.0
    26.         Pause 60000       ' Delay for 10 seconds
    27.  
    28.         High 1           ' Turn on connected to PORTB.0
    29.         Pause 500       ' Delay for .5 seconds
    30.  
    31.         Goto Check   ' Go back to loop and blink LED forever
    32.         End
    If I am doing things completely wrong could you point me in the right direction. Like a good coding tut for microprocessors. Thx!
     
  2. XxAxisxX

    Thread Starter New Member

    Mar 11, 2010
    6
    0
    Ok never mind about that code. Where can I start small? Like a good coding tutorial for microprocessors.
     
  3. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Gooligum is a great tutorial resource for beginners. He holds your hand through C or ASM programming, where to get the free compilers and how to wire the circuits. From the simple pic 'hello world' of lighting a single led, to switches, polling and more.

    This is invaluable for beginners.

    http://www.gooligum.com.au/tutorials.html
     
Loading...