PDA

View Full Version : Two function(program) in one pic



swordman
- 31st August 2004, 10:49
Hi ,
How can do this in pbp

1. Adread - read analog value and calculate.For example:

adcin 0,read
if read = x then ....(LABEL- math calc => control portb.5/pwm)
if read <x then ....(LABEL- math calc=> control portb.5 )
if read >x then ....(LABEL- math calc )

2. Main program (IF,pause,lcdout,etc...)

When the main program work , "1.adread" must work allways in background.
Can I do this.

Tnx

FrankM
- 31st August 2004, 20:03
To make that, you could use interrupts with a timer.