PDA

View Full Version : Multiple operations at once?



sphinxifm
- 15th May 2008, 10:58
hi does anyone know if it is at all possible to make a 16f877a do more than one operation at a time? ie, flash led on one port whilst looking for an input on another port and outputting to an lcd screen at the same time?
any help would be greatfull, thanks

mackrackit
- 15th May 2008, 11:40
You will want to look at interrupts.

mister_e
- 15th May 2008, 21:11
Or build your own time slicing system... :eek: not hard, but a bit time wasting :D

Interrupt all the way!

Timer interrupt is one of my favorite.

Kamikaze47
- 16th May 2008, 18:39
Or simply a loop that does those three operations one after the other... since they happen so fast, to the user they will look simultaneous.

Boomslang
- 14th June 2008, 15:55
Or build your own time slicing system... :eek: not hard, but a bit time wasting :D

Interrupt all the way!

Timer interrupt is one of my favorite.

Bit time wasting...hahaha, I'm also a newby to PBP (used assembly untill now), but I think the OP need to learn a bit more about basic PIC operation, and try some of the sample programs to see how things happen in "real life".

RodSTAR
- 14th June 2008, 17:22
I (and many/{all} of us) had exactly that question.
Happily, interrupts were made for that, reacting at specific realtime events, such as: -A/D activity, USART I/O, QEI, Timers, Capture, Keyboard, switch, and so on.-

There are 2 ways to handle interrupts:
1.- The standard way is using 'ON INTERRUPT' statement & stuff. (see manual/forum)
2.- The recommended way is using Darrel Taylor's 'Instant Interrupts', once you understand it, you'll enjoy it's benefits. (documentation in a thread in the forum).

My personal choice is labeling tasks to optimize troubleshooting (if happen), code and memory. (why labeling? because PBP doesn't allow functions or sub/procedures structure)

Rodrigo.

RodSTAR
- 15th June 2008, 21:04
I (and many/{all} of us) had exactly that question.
Happily, interrupts were made for that, reacting at specific realtime events, such as: -A/D activity, USART I/O, QEI, Timers, Capture, Keyboard, switch, and so on.-

There are 2 ways to handle interrupts:
1.- The standard way is using 'ON INTERRUPT' statement & stuff. (see manual/forum)
2.- The recommended way is using Darrel Taylor's 'Instant Interrupts', once you understand it, you'll enjoy it's benefits. (documentation in a thread in the forum).

My personal choice is labeling tasks to optimize troubleshooting (if happen), code and memory. (why labeling? because PBP doesn't allow functions or sub/procedures structure)

Rodrigo.

I forgot to specify... Interrupts don't need to be handled within a loop, they just 'pop-up' in realtime things happen.

precision
- 16th June 2008, 07:53
For Multiple work, you can make Multiple interrupt (pin) on port c or d or b then ON INTERRUPT, you can do as you wish.

.