PDA

View Full Version : About timing in pic basic pro



din_kt
- 4th October 2007, 01:50
Dear all,

My program :

PortA.0 = input
PortB.0 = Output 1
PortB.0 = Output 2

I want to check condition for the PortA.0

If PortA.0 = high, PortB.0 will set high. ( PortA.0 will be check for 30 second only, if
portA.0 still = low after 30 second PortB.1 will high.)

some body can help me how to program for this situation.

mister_e
- 4th October 2007, 02:23
mmm, something is not clear in your explanation....

When you said, "PORTA.0 will be check for 30 second only" once PORTA.0=1 on or once you put the power on your PIC?

Let's say once your put the power on your pic...


TRISA = 255
TRISB = 0
CounterA VAR WORD
PB var PORTA.0
OUT1 VAR PORTB.0
OUT2 VAR PORTB.1

PORTB = 0 ' Clear all leds
CounterA = 0 ' Clear counter
Start:
while (CounterA<300) AND (PB=0)
pause 100
CounterA = CounterA + 1
wend

if CounterA>=300 then
OUT2 = 1
else
OUT1 = 1
endif

Spin: GOTO Spin

din_kt
- 4th October 2007, 03:09
Dear mister_e,

Thank you for your suggestion,
I try follow your methode in my program,