Another sample
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)
( Here is a simple task routine, which keeps incrementing the memory location $100 )
: TaskRoutine
begin 1 $100 +! Pause again ;
( This defines the task myTask, gives it 20 byte of return stack and 30 byte of data stack area, and makes myTask control the program word TaskRoutine. )
20 30 Task myTask TaskRoutine
( now we implement the main word as a task routine too )
: MainRoutine
begin 1 $102 +! Pause again ;
( We are ready to start the tasking machine )
: RunProgram
InitTasking init myTask MainRoutine ;
( Holon 11 packs this mechanism in the object type Channel and offers you a clearer syntax. The following example describes the use of channels )
Channel Message
: Receiver
begin waitfor Message $100 ! again ;
: Sender
begin $100 @ send Message 1 $100 +! again ;
20 20 Task RTask Receiver
: RunCTasks
InitTasking init RTask Sender ;
Составить ответ
|||
Конференция
|||
Архив
Ответы
- more... — =AK= (28.10.2003 07:10, 479 байт)
Перейти к списку ответов
|||
Конференция
|||
Архив
|||
Главная страница
|||
Содержание
|||
Без кадра
E-mail:
info@telesys.ru