Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB

Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | BasicX | MultiTasking


Advertise Here

Discussion forum for the BasicX family of microcontroller chips.

MultiTasking - Jack - May 10 14:45:00 2003

Hey All

I have a vehicle which, at certain time periods after start, needs to
perform a function. But all the while, (while not doing the timed
function) it needs to check pins to see if obstacles are in the way
or not. ie, there is a loop that checks pins, but at 5 seconds, I
want that loop interupted and a sub called, and then back to that
loop. How might I do this?

Thanks,

-Jack C
www.CREPinc.com





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )


RE: MultiTasking - Harry J. White - May 10 15:31:00 2003

Jack C
At the start (before your main loop) check the system clock and store that
value. Each time through the main loop compare the start time to the
current time and when five seconds has elapsed trigger the jump to the sub
that you want executed. After the completion of you sub reset the clocks
initial value (by checking the clock again) and go back to your main loop.
In five seconds the sub will be triggered again and on it goes.
Harry

-----Original Message-----
From: Jack [mailto:]
Sent: Saturday, May 10, 2003 3:46 PM
To:
Subject: [BasicX] MultiTasking Hey All

I have a vehicle which, at certain time periods after start, needs to
perform a function. But all the while, (while not doing the timed
function) it needs to check pins to see if obstacles are in the way
or not. ie, there is a loop that checks pins, but at 5 seconds, I
want that loop interupted and a sub called, and then back to that
loop. How might I do this?

Thanks,

-Jack C
www.CREPinc.com [Non-text portions of this message have been removed]


______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: MultiTasking - Emil E. Hrivnak - May 10 15:43:00 2003

How about using the Timer function:

--------------------------------

Sub Main

Dim Five_Secs As Single

Five_Secs = Timer()

Do
Call CheckPins()

If ( (Timer() - Five_Secs ) >= 5.0) Then
Call Special_Function()
Five_Secs = Timer()
End If

Loop

End Sub

--------------------------------
The Timer() will roll over in a day. If you run continuously, you have to
do roll over correction when the value gets to 86400 seconds. Emil H
At 03:45 PM 05/10/2003, you wrote:
>Hey All
>
>I have a vehicle which, at certain time periods after start, needs to
>perform a function. But all the while, (while not doing the timed
>function) it needs to check pins to see if obstacles are in the way
>or not. ie, there is a loop that checks pins, but at 5 seconds, I
>want that loop interupted and a sub called, and then back to that
>loop. How might I do this?
>
>Thanks,
>
>-Jack C




(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: MultiTasking - koganrvss - May 14 17:40:00 2003

BasicX supports virtual interrupts using multi tasking/threading.

There is a way to make it "listen" for obstacles continuously (while
doing other things) and trigger a function when an obstacle is
detected. I think this would work best for your device.

There should be information about multi tasking in the manual.
--- In , "Jack" <nutzo_skiers@y...> wrote:
> Hey All
>
> I have a vehicle which, at certain time periods after start, needs
to
> perform a function. But all the while, (while not doing the timed
> function) it needs to check pins to see if obstacles are in the way
> or not. ie, there is a loop that checks pins, but at 5 seconds, I
> want that loop interupted and a sub called, and then back to that
> loop. How might I do this?
>
> Thanks,
>
> -Jack C
> www.CREPinc.com


______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )