PICcoder.co.uk Forum  


Post a new message in "Getting Started"
Name:
Subject:
This image contains a scrambled text, it is using a combination of colors, font size, background, angle in order to disallow computer to automate reading. You will have to reproduce it to post on my homepage Enter what you see: *
tips: hit Reload page before writing a text if you have difficulty reading characters in image
topic icon:
no
boardcode:
 Colour:  Size:   Close all tags
Message:

emoticons
B) ;) :) :P
:laugh: :ohmy: :sick: :angry:
:blink: :( :unsure: :kiss:
:woohoo: :lol: :silly: :pinch:
:side: :whistle: :evil: :S
:blush: :cheer: :huh: :dry:

Topic History of: processing button click
Max. showing the last posts - (Last post first)
Author Message
unit The problem was sloved. (I forget to turn off watchdog timer)
unit I try to handle button click by following code



Code:

 
#define BUTTON1 RA0 // pushed - 0, released - 1
#define LED1 RA1


    
LED1 1// turn LED on

start    :    


    if (
BUTTON1 == 0//pushed
    
{
            
DelayMs(100); // delay for 100 milliseconds
            
while (BUTTON1 == 0)
            { 
//wait while pushed
            
}    
            
DelayMs(100); // delay for 100 milliseconds
            
LED1 = !(LED1); // turn LED on/off
    
}
    

    
goto start;




But there are some stuff that I didn't take into account, and therefor it works wrong. Sometimes when I click the button LED don't torn off/on. And sometimes LED switches when I do not touch the button.


P.S. Sorry for my terrible english