button

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
nav
Posts: 7
Joined: 03 Jun 2011 02:48

button

#1 Post by nav » 03 Jun 2011 03:00

If PORB.F1=1 active for 5s then it must active PORTA.F0=1 else PORTA.F0=0.
please be good enough to help me in writing this codes :roll:

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: button

#2 Post by tihomir.losic » 03 Jun 2011 08:46

Hello,

please, look at example which is placed on following page:
http://www.mikroe.com/esupport/index.ph ... icleid=120
Best regards,

Losic Tihomir
mikroElektronika [Support team]

nav
Posts: 7
Joined: 03 Jun 2011 02:48

Re: button

#3 Post by nav » 03 Jun 2011 09:29

thank you

nav
Posts: 7
Joined: 03 Jun 2011 02:48

Re: button

#4 Post by nav » 03 Jun 2011 11:09

button function is working only for 5ms it is not working for 5000ms

Muphy
Posts: 318
Joined: 24 Feb 2008 14:05
Location: Stonehaven Scotland

Re: button

#5 Post by Muphy » 03 Jun 2011 12:25

That is because the time variable in the button function is an unsigned short which can only have values from 0-255.

You may need to put the button command inside a loop. Say you use a time of 250 in the button command then you put that in a command that will loop 20 times, 20 x 250 = 5000. You will also have to add some code to break out of the loop if you need to.

M

nav
Posts: 7
Joined: 03 Jun 2011 02:48

Re: button

#6 Post by nav » 03 Jun 2011 14:19

THANK YOU MUPHY

Post Reply

Return to “mikroC PRO for PIC General”