PDA

View Full Version : How to latch an output for a pre-defined time



Dennis
- 21st December 2009, 02:33
Hi all

I'm not sure how to search this one up ...

1. I would like to have a Port Pin (for example PORTD.1) stay high for a around the same time as a button press (perhaps 500ms)
OR
2. have the same data sent 4 times in succession. (maybe a for/next or if then loop with a counter ?)

I'm not sure how to setup either or which one would be the better one to use.

Any thoughts or tips would be much appreciated

Kind regards

Dennis

rsocor01
- 21st December 2009, 03:36
I'm afraid that you need to explain in more detail what is that you want to do so that people can help you.

Robert

Archangel
- 21st December 2009, 04:31
Hi all

I'm not sure how to search this one up ...

1. I would like to have a Port Pin (for example PORTD.1) stay high for a around the same time as a button press (perhaps 500ms)
OR
2. have the same data sent 4 times in succession. (maybe a for/next or if then loop with a counter ?)

I'm not sure how to setup either or which one would be the better one to use.

Any thoughts or tips would be much appreciated

Kind regards

Dennis
Hi Dennis,
For next loop:


Counter_Var Var byte
MyData Var byte

For Counter_Var = 0 to 3
serout PortB.0,t9600,[#MyData]
next Counter_Var

or
PORTD.1 = 1
pause 500
PORTD.1 = 0 '1/2 second on loop then off for keeps

Dennis
- 21st December 2009, 07:44
:-)
Joe thanks a million :-)

Is there a something like a "stay HIGH for " command. For example to make PORTD.1 "stay in a high state for 500 milliseconds" ?

I have seen command like PUSEUS, PULSEIN, WAIT and so forth, but was just wondering if there is a specific one like LATCH or something like that.

Keep well

Dennis

rmteo
- 21st December 2009, 15:05
Use a timer. This way, your PIC can still do stuff instead of just being stuck waiting for the command to be executed.

rsocor01
- 21st December 2009, 18:20
Use a timer like rmteo suggested or you can use PAUSE 500.

Robert