CA2469088A1 - Extendable tube - Google Patents
Extendable tube Download PDFInfo
- Publication number
- CA2469088A1 CA2469088A1 CA002469088A CA2469088A CA2469088A1 CA 2469088 A1 CA2469088 A1 CA 2469088A1 CA 002469088 A CA002469088 A CA 002469088A CA 2469088 A CA2469088 A CA 2469088A CA 2469088 A1 CA2469088 A1 CA 2469088A1
- Authority
- CA
- Canada
- Prior art keywords
- medical insertion
- automatically operative
- operative medical
- automatically
- insertion device
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Abandoned
Links
- 230000037431 insertion Effects 0.000 claims abstract description 146
- 238000003780 insertion Methods 0.000 claims abstract description 145
- 230000037361 pathway Effects 0.000 claims abstract description 49
- 238000000034 method Methods 0.000 claims abstract description 39
- 238000001727 in vivo Methods 0.000 claims abstract description 12
- 238000012966 insertion method Methods 0.000 claims description 73
- 230000005355 Hall effect Effects 0.000 claims description 50
- 210000003437 trachea Anatomy 0.000 claims description 37
- 230000008569 process Effects 0.000 claims description 31
- 230000033001 locomotion Effects 0.000 claims description 29
- 210000002409 epiglottis Anatomy 0.000 claims description 24
- 238000005452 bending Methods 0.000 claims description 22
- 210000000936 intestine Anatomy 0.000 claims description 21
- 210000000056 organ Anatomy 0.000 claims description 20
- 210000000845 cartilage Anatomy 0.000 claims description 16
- 238000002059 diagnostic imaging Methods 0.000 claims description 14
- 210000000214 mouth Anatomy 0.000 claims description 13
- 238000013459 approach Methods 0.000 claims description 5
- 238000002591 computed tomography Methods 0.000 claims description 5
- 238000002604 ultrasonography Methods 0.000 claims description 4
- 210000003484 anatomy Anatomy 0.000 claims description 3
- 210000000867 larynx Anatomy 0.000 claims description 3
- 238000003384 imaging method Methods 0.000 claims description 2
- 230000004931 aggregating effect Effects 0.000 claims 2
- 230000004044 response Effects 0.000 claims 1
- 238000012360 testing method Methods 0.000 description 27
- 230000006870 function Effects 0.000 description 26
- 238000002627 tracheal intubation Methods 0.000 description 23
- 101100366888 Dictyostelium discoideum dstA gene Proteins 0.000 description 12
- 101100440286 Mus musculus Cntrl gene Proteins 0.000 description 12
- 101100311214 Xenopus laevis stat3.1 gene Proteins 0.000 description 12
- 238000005259 measurement Methods 0.000 description 12
- 238000011534 incubation Methods 0.000 description 8
- 238000007789 sealing Methods 0.000 description 8
- 238000004364 calculation method Methods 0.000 description 6
- 239000004065 semiconductor Substances 0.000 description 5
- 230000008859 change Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 4
- 230000007423 decrease Effects 0.000 description 4
- 238000007667 floating Methods 0.000 description 4
- 239000002184 metal Substances 0.000 description 4
- 238000011144 upstream manufacturing Methods 0.000 description 4
- 101100461892 Caenorhabditis elegans nxt-1 gene Proteins 0.000 description 3
- ZAKOWWREFLAJOT-CEFNRUSXSA-N D-alpha-tocopherylacetate Chemical compound CC(=O)OC1=C(C)C(C)=C2O[C@@](CCC[C@H](C)CCC[C@H](C)CCCC(C)C)(C)CCC2=C1C ZAKOWWREFLAJOT-CEFNRUSXSA-N 0.000 description 3
- 241001274197 Scatophagus argus Species 0.000 description 3
- 230000000994 depressogenic effect Effects 0.000 description 3
- 210000003128 head Anatomy 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 102100031456 Centriolin Human genes 0.000 description 2
- 101000941711 Homo sapiens Centriolin Proteins 0.000 description 2
- 206010028980 Neoplasm Diseases 0.000 description 2
- 101100099021 Salmonella typhimurium (strain LT2 / SGSC1412 / ATCC 700720) tdcD gene Proteins 0.000 description 2
- 208000027418 Wounds and injury Diseases 0.000 description 2
- 230000004075 alteration Effects 0.000 description 2
- 101150104262 csn4 gene Proteins 0.000 description 2
- 230000006378 damage Effects 0.000 description 2
- 230000003247 decreasing effect Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000009432 framing Methods 0.000 description 2
- 208000015181 infectious disease Diseases 0.000 description 2
- 208000014674 injury Diseases 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000008961 swelling Effects 0.000 description 2
- 210000001519 tissue Anatomy 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 102100025854 Acyl-coenzyme A thioesterase 1 Human genes 0.000 description 1
- 101710175445 Acyl-coenzyme A thioesterase 1 Proteins 0.000 description 1
- 241001116389 Aloe Species 0.000 description 1
- 101100327819 Caenorhabditis elegans chl-1 gene Proteins 0.000 description 1
- 101100172628 Caenorhabditis elegans eri-1 gene Proteins 0.000 description 1
- 101100460513 Caenorhabditis elegans nlt-1 gene Proteins 0.000 description 1
- 101100087530 Caenorhabditis elegans rom-1 gene Proteins 0.000 description 1
- 102100030972 Coatomer subunit beta Human genes 0.000 description 1
- 102100023044 Cytosolic acyl coenzyme A thioester hydrolase Human genes 0.000 description 1
- 101710152190 Cytosolic acyl coenzyme A thioester hydrolase Proteins 0.000 description 1
- 241000282412 Homo Species 0.000 description 1
- 101000919970 Homo sapiens Coatomer subunit beta Proteins 0.000 description 1
- 101100119135 Mus musculus Esrrb gene Proteins 0.000 description 1
- 101100305983 Mus musculus Rom1 gene Proteins 0.000 description 1
- GFRROZIJVHUSKZ-FXGMSQOLSA-N OS I Natural products C[C@@H]1O[C@@H](O[C@H]2[C@@H](O)[C@@H](CO)O[C@@H](OC[C@@H](O)[C@@H](O)[C@@H](O)CO)[C@@H]2NC(=O)C)[C@H](O)[C@H](O)[C@H]1O GFRROZIJVHUSKZ-FXGMSQOLSA-N 0.000 description 1
- 235000011399 aloe vera Nutrition 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000000375 direct analysis in real time Methods 0.000 description 1
- 239000003814 drug Substances 0.000 description 1
- 230000009977 dual effect Effects 0.000 description 1
- 238000012063 dual-affinity re-targeting Methods 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- LEQAOMBKQFMDFZ-UHFFFAOYSA-N glyoxal Chemical compound O=CC=O LEQAOMBKQFMDFZ-UHFFFAOYSA-N 0.000 description 1
- 238000012905 input function Methods 0.000 description 1
- 210000004789 organ system Anatomy 0.000 description 1
- 239000000523 sample Substances 0.000 description 1
- 239000000454 talc Substances 0.000 description 1
- 229910052623 talc Inorganic materials 0.000 description 1
Classifications
-
- A—HUMAN NECESSITIES
- A61—MEDICAL OR VETERINARY SCIENCE; HYGIENE
- A61M—DEVICES FOR INTRODUCING MEDIA INTO, OR ONTO, THE BODY; DEVICES FOR TRANSDUCING BODY MEDIA OR FOR TAKING MEDIA FROM THE BODY; DEVICES FOR PRODUCING OR ENDING SLEEP OR STUPOR
- A61M16/00—Devices for influencing the respiratory system of patients by gas treatment, e.g. mouth-to-mouth respiration; Tracheal tubes
- A61M16/04—Tracheal tubes
- A61M16/0488—Mouthpieces; Means for guiding, securing or introducing the tubes
-
- A—HUMAN NECESSITIES
- A61—MEDICAL OR VETERINARY SCIENCE; HYGIENE
- A61M—DEVICES FOR INTRODUCING MEDIA INTO, OR ONTO, THE BODY; DEVICES FOR TRANSDUCING BODY MEDIA OR FOR TAKING MEDIA FROM THE BODY; DEVICES FOR PRODUCING OR ENDING SLEEP OR STUPOR
- A61M16/00—Devices for influencing the respiratory system of patients by gas treatment, e.g. mouth-to-mouth respiration; Tracheal tubes
- A61M16/04—Tracheal tubes
- A61M16/0488—Mouthpieces; Means for guiding, securing or introducing the tubes
- A61M16/049—Mouthpieces
-
- A—HUMAN NECESSITIES
- A61—MEDICAL OR VETERINARY SCIENCE; HYGIENE
- A61M—DEVICES FOR INTRODUCING MEDIA INTO, OR ONTO, THE BODY; DEVICES FOR TRANSDUCING BODY MEDIA OR FOR TAKING MEDIA FROM THE BODY; DEVICES FOR PRODUCING OR ENDING SLEEP OR STUPOR
- A61M16/00—Devices for influencing the respiratory system of patients by gas treatment, e.g. mouth-to-mouth respiration; Tracheal tubes
- A61M16/04—Tracheal tubes
- A61M16/0402—Special features for tracheal tubes not otherwise provided for
- A61M16/0411—Special features for tracheal tubes not otherwise provided for with means for differentiating between oesophageal and tracheal intubation
Landscapes
- Health & Medical Sciences (AREA)
- Pulmonology (AREA)
- Biomedical Technology (AREA)
- Emergency Medicine (AREA)
- Engineering & Computer Science (AREA)
- Anesthesiology (AREA)
- Otolaryngology (AREA)
- Heart & Thoracic Surgery (AREA)
- Hematology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Animal Behavior & Ethology (AREA)
- General Health & Medical Sciences (AREA)
- Public Health (AREA)
- Veterinary Medicine (AREA)
- Endoscopes (AREA)
Abstract
An automatically operative medical insertion device (12) and method including an insertable element (18) which is adapted to be inserted within a living organism in vivo, a surface following element (20), physically associated with the insertable element and being arranged to follow a physical surface within the living organism in vivo, a driving subsystem (15) operative to at least partially automatically direct the insertable element along the physical surface and a navigation subsystem (274) operative to control the driving subsystem based at least partially on a perceived location of the surface following element along a reference pathway stored in the navigation subsystem.
Description
EXTENDABLE TUBE
FIELD OF THE INVENTION
The present invention relates to systems and methods for automatic insertion of an element into a living organism in vivo and to an extendable insertable element and a method of insertion thereof.
REFERENCE TO CO-PENDING APPLICATION
Applicants hereby claim priority of PCT Application No.
PCT/IL01I01121 filed December 5, 2001, entitled "Apparatus For Self Guided Incubation".
BACKGROUND OF THE INVENTION
The following U.S. Patents are believed to represent the current state of the art:
6,248,112; 6,236,875; 6,235,038; 6,226,548; 6,211,904; 6,203,497;
6,202,646; 6,196,225; 6,190,395; 6,190,382; 6,189,533; 6,174,281; 6,173,199;
6,167,145; 6.164,277; 6,161,537; 6,152,909; 6,146,402; 6,142,144; 6,135,948;
6,132,372; 6;129,683; 6,096,050; 6,096,050; 6,090,040; 6,083,213; 6,079,731;
6,079,409; 6,053,166; 5,993,424; 5,976,072; 5,971,997; 5,957,844; 5,951,571;
5,951,461; 5,885,248; 5,720,275; 5,704,987; 5,592,939; 5,584,795; 5,506,912;
5,445,161; 5,400,771; 5,347,987; 5,331,967; 5,307,804; 5,257,636; 5,235,970;
5,203,320; 5,188,111; 5,184,603; 5,172,225; 5,109,830; 5,018,509; 4,910,590;
4,672,960; 4,651,746 Reference is also made to: http://www.airwaycam.com/system.html SUMMARY OF THE INVENTION
The present invention seeks to provide improved systems and methods for automatic insertion of an element into a living organism in vivo.
There is thus provided in accordance with a preferred embodiment of the present invention an automatically operative medical insertion device including an insertable element which is adapted to be inserted within a living organism in vivo, a surface following element, physically associated with the insertable element and being arranged to Follow a physical surface within the living organism in vivo, a driving subsystem operative to at least partially automatically direct the insertable element along the physical surface and a navigation subsystem operative to control the driving subsystem based at least partially on a perceived location of the surface following element along a reference pathway stored in the navigation subsystem.
There is also provided in accordance with a preferred embodiment of the present invention an automatically operative medical insertion method, which includes inserting an insertable element within a living organism in vivo, physically associating a surface following element twith the insertable element and causing the surface following element to follow a physical surface within the living organism in vivo, directing the insertable element along the physical surface using a driving subsystem and controlling direction of the insertable element based at least partially on a perceived location of the surface following element along a reference pathway stored in a navigation subsystem.
Further in accordance with a preferred embodiment of the present invention the driving subsystem is operative to fully automatically direct the insertable element along the physical surface. Alternatively, the driving subsystem is operative to automatically and selectably direct the insertable element along the physical surface.
Additionally in accordance with a preferred embodiment of the present invention the navigation subsystem receives surface characteristic information relating to the physical surface from the surface following element and employs the surface characteristic information to perceive the location of the surface following element along the reference pathway.
Preferably, the surface characteristic information includes surface contour information. Additionally, the surface characteristic information includes
FIELD OF THE INVENTION
The present invention relates to systems and methods for automatic insertion of an element into a living organism in vivo and to an extendable insertable element and a method of insertion thereof.
REFERENCE TO CO-PENDING APPLICATION
Applicants hereby claim priority of PCT Application No.
PCT/IL01I01121 filed December 5, 2001, entitled "Apparatus For Self Guided Incubation".
BACKGROUND OF THE INVENTION
The following U.S. Patents are believed to represent the current state of the art:
6,248,112; 6,236,875; 6,235,038; 6,226,548; 6,211,904; 6,203,497;
6,202,646; 6,196,225; 6,190,395; 6,190,382; 6,189,533; 6,174,281; 6,173,199;
6,167,145; 6.164,277; 6,161,537; 6,152,909; 6,146,402; 6,142,144; 6,135,948;
6,132,372; 6;129,683; 6,096,050; 6,096,050; 6,090,040; 6,083,213; 6,079,731;
6,079,409; 6,053,166; 5,993,424; 5,976,072; 5,971,997; 5,957,844; 5,951,571;
5,951,461; 5,885,248; 5,720,275; 5,704,987; 5,592,939; 5,584,795; 5,506,912;
5,445,161; 5,400,771; 5,347,987; 5,331,967; 5,307,804; 5,257,636; 5,235,970;
5,203,320; 5,188,111; 5,184,603; 5,172,225; 5,109,830; 5,018,509; 4,910,590;
4,672,960; 4,651,746 Reference is also made to: http://www.airwaycam.com/system.html SUMMARY OF THE INVENTION
The present invention seeks to provide improved systems and methods for automatic insertion of an element into a living organism in vivo.
There is thus provided in accordance with a preferred embodiment of the present invention an automatically operative medical insertion device including an insertable element which is adapted to be inserted within a living organism in vivo, a surface following element, physically associated with the insertable element and being arranged to Follow a physical surface within the living organism in vivo, a driving subsystem operative to at least partially automatically direct the insertable element along the physical surface and a navigation subsystem operative to control the driving subsystem based at least partially on a perceived location of the surface following element along a reference pathway stored in the navigation subsystem.
There is also provided in accordance with a preferred embodiment of the present invention an automatically operative medical insertion method, which includes inserting an insertable element within a living organism in vivo, physically associating a surface following element twith the insertable element and causing the surface following element to follow a physical surface within the living organism in vivo, directing the insertable element along the physical surface using a driving subsystem and controlling direction of the insertable element based at least partially on a perceived location of the surface following element along a reference pathway stored in a navigation subsystem.
Further in accordance with a preferred embodiment of the present invention the driving subsystem is operative to fully automatically direct the insertable element along the physical surface. Alternatively, the driving subsystem is operative to automatically and selectably direct the insertable element along the physical surface.
Additionally in accordance with a preferred embodiment of the present invention the navigation subsystem receives surface characteristic information relating to the physical surface from the surface following element and employs the surface characteristic information to perceive the location of the surface following element along the reference pathway.
Preferably, the surface characteristic information includes surface contour information. Additionally, the surface characteristic information includes
2
3 PCT/IL02/00347 surface hardness information. Preferably, the surface contour information is three-dimensional. Alternatively, the surface contour information is two-dimensional.
In accordance with a further preferred embodiment of the present invention, the insertable element is an endotracheal tube and the physical surface includes surfaces of the larynx and trachea. Alternatively, the insertable element is a gastroscope and the physical surface includes surfaces of the intestine. In accordance with another preferred embodiment, the insertable element is a catheter and the physical surface includes interior surfaces of the circulatory system.
Further in accordance with a preferred embodiment of the present invention the insertion device also includes a reference pathway generator operative to image at least a portion of the living organism and to generate the reference pathway based at least partially on an image generated thereby.
Preferably, the reference pathway includes a standard contour map of a portion of the human anatomy. Additionally, the standard contour map is precisely adapted to a specific patient. Alternatively, the standard contour map is automatically precisely adapted to a specific patient.
Further in accordance with a preferred embodiment of the present invention the reference pathway is operator adaptable to designate at least one impediment.
Additionally in accordance with a preferred embodiment of the present invention the insertable element includes a housing in which is disposed the driving subsystem, a mouthpiece, a cube inserted through the mouthpiece and a flexible guide inserted through the tube, the surface following element being mounted at a front end of the guide.
Preferably, the mouthpiece includes a curved pipe through which the tube is inserted. Additionally, the driving subsystem is operative to move the guide in and-out of the housing, through the curved pipe and through the tube. Preferably, the driving subsystem also operates to selectably bend a front end of the guide.
Additionally or alternatively, the driving subsystem is operative to move the insertable element in and out of the living organism. Additionally, the driving subsystem is also operative to selectably bend a front end of the insertable element.
Further in accordance with a preferred embodiment of the present invention the surface following element includes a tactile sensing element.
Preferably, the surface following element includes a tip sensor including a tip integrally formed at one end of a short rod having a magnet on its other end, the rod extends through the center of a spring disk and is firmly connected thereto, the spring disk being mounted on one end of a cylinder whose other end is mounted on a Front end of the insertable element.
Further in accordance with a preferred embodiment of the present invention the tip sensor also includes two Hall effect sensors, which are mounted inside the cylinder on a support and in close proximity to the magnet, the Hall effect sensors being spaced in the plane of the curvature of the curved pipe. Each Hall effect sensor includes electrical terminals operative to provide electric current representing the distance of the magnet therefrom. The tip sensor operates such that when a force is exerted on the tip along an axis of symmetry of the cylinder, the tip is pushed against the spring disk, causing the magnet to approach the Hall effect sensors and when a force is exerted on the tip sideways in the plane of the Hall effect sensors, the tip rotates around a location where the rod engages the spring disk, causing the magnet to rotate away from one of the Hall effect sensors and closer to the other of the Hall effect sensors.
Still further in accordance with a preferred embodiment of the present invention the driving subsystem operates, following partial insertion of the insertable element into the oral cavity, to cause the guide to extend in the direction of the trachea and bend the guide clockwise until the surface following element engages a surface of the tongue, whereby this engagement applies a force to the surface following element.
Additionally in accordance with a preferred embodiment of the present invention the navigation subsystem is operative to measure the changes in the electrical outputs produced by the Hall effect sensors indicating the direction in which the tip is bent.
Moreover in accordance with a preferred embodiment of the present invention the navigation subsystem operates to sense the position of the tip and the past history of tip positions and to determine the location of the tip in the living organism and relative to the reference pathway.
In accordance with a further preferred embodiment of the present invention, the insertable element is an endotracheal tube and the physical surface includes surfaces of the larynx and trachea. Alternatively, the insertable element is a gastroscope and the physical surface includes surfaces of the intestine. In accordance with another preferred embodiment, the insertable element is a catheter and the physical surface includes interior surfaces of the circulatory system.
Further in accordance with a preferred embodiment of the present invention the insertion device also includes a reference pathway generator operative to image at least a portion of the living organism and to generate the reference pathway based at least partially on an image generated thereby.
Preferably, the reference pathway includes a standard contour map of a portion of the human anatomy. Additionally, the standard contour map is precisely adapted to a specific patient. Alternatively, the standard contour map is automatically precisely adapted to a specific patient.
Further in accordance with a preferred embodiment of the present invention the reference pathway is operator adaptable to designate at least one impediment.
Additionally in accordance with a preferred embodiment of the present invention the insertable element includes a housing in which is disposed the driving subsystem, a mouthpiece, a cube inserted through the mouthpiece and a flexible guide inserted through the tube, the surface following element being mounted at a front end of the guide.
Preferably, the mouthpiece includes a curved pipe through which the tube is inserted. Additionally, the driving subsystem is operative to move the guide in and-out of the housing, through the curved pipe and through the tube. Preferably, the driving subsystem also operates to selectably bend a front end of the guide.
Additionally or alternatively, the driving subsystem is operative to move the insertable element in and out of the living organism. Additionally, the driving subsystem is also operative to selectably bend a front end of the insertable element.
Further in accordance with a preferred embodiment of the present invention the surface following element includes a tactile sensing element.
Preferably, the surface following element includes a tip sensor including a tip integrally formed at one end of a short rod having a magnet on its other end, the rod extends through the center of a spring disk and is firmly connected thereto, the spring disk being mounted on one end of a cylinder whose other end is mounted on a Front end of the insertable element.
Further in accordance with a preferred embodiment of the present invention the tip sensor also includes two Hall effect sensors, which are mounted inside the cylinder on a support and in close proximity to the magnet, the Hall effect sensors being spaced in the plane of the curvature of the curved pipe. Each Hall effect sensor includes electrical terminals operative to provide electric current representing the distance of the magnet therefrom. The tip sensor operates such that when a force is exerted on the tip along an axis of symmetry of the cylinder, the tip is pushed against the spring disk, causing the magnet to approach the Hall effect sensors and when a force is exerted on the tip sideways in the plane of the Hall effect sensors, the tip rotates around a location where the rod engages the spring disk, causing the magnet to rotate away from one of the Hall effect sensors and closer to the other of the Hall effect sensors.
Still further in accordance with a preferred embodiment of the present invention the driving subsystem operates, following partial insertion of the insertable element into the oral cavity, to cause the guide to extend in the direction of the trachea and bend the guide clockwise until the surface following element engages a surface of the tongue, whereby this engagement applies a force to the surface following element.
Additionally in accordance with a preferred embodiment of the present invention the navigation subsystem is operative to measure the changes in the electrical outputs produced by the Hall effect sensors indicating the direction in which the tip is bent.
Moreover in accordance with a preferred embodiment of the present invention the navigation subsystem operates to sense the position of the tip and the past history of tip positions and to determine the location of the tip in the living organism and relative to the reference pathway.
4 In accordance with yet another preferred embodiment, the navigation subsystem operates to navigate the tip according to the reference pathway.
Additionally, the navigation subsystem operates to sense that the tip touches the end of the trough beneath the epiglottis. Additionally or alternatively, the navigation subsystem is operative to sense that the tip reaches the tip of the epiglottis. In accordance with another preferred embodiment; the navigation subsystem operates to sense that the tip reached the first cartilage of the trachea. Additionally, the navigation subsystem operates to sense that the tip reached the second cartilage of the trachea.
Additionally or alternatively, the navigation subsystem is operative to sense that the tip reached the third cartilage of the trachea. Preferably, the navigation subsystem operates to load the reference pathway from a memory.
Further in accozdance with a preferred embodiment of the present invention the driving subsystem is operative to push the tube forward.
Still further in accordance with a prefezred embodiment of the present invention the driving subsystem includes a first motor which operates to selectably move the insertable element forward or backward, a second motor which operates to selectably bend the insertable element and electronic circuitry operative to control the first motor, the second motor and the surface following element.
Preferably, the electronic circuitry includes a microprocessor operative to execute a program, the program operative to control the first and second motors and the surface following element and to insert and bend the insertable element inside the living organism along the reference pathway.
Further in accordance with a preferred embodiment of the present invention the driving subsystem is operative to measure the electric current drawn by at least one of the first and second motors to evaluate the position of the surface following element.
Still further in accordance with a preferred embodiment of the present invention the reference pathway is operative to be at least partially prepared before the insertion process is activated. Preferably, the medical insertion device includes a medical imaging system and wherein the medical imaging system is operative to at least partially prepare the reference pathway. Preferably, the medical imaging subsystem includes at least one of an ultrasound scanner, an X-ray imager, a CAT scan system and an MRI system.
Further in accordance with a preferred embodiment of the present invention the medical imaging system operates to prepare the reference pathway by marking at least one contour of at least one organ of the living organism.
In accordance with another preferred embodiment, the medical imaging system operates to prepare the reference pathway by creating an insertion instruction table including at least one insertion instruction. Preferably, the insertion instruction includes instruction to at least one of extend, retract and bend the insertable element.
Further in accordance with a preferred embodiment of the present invention the navigation subsystem is operative to control the driving subsystem based at least partially on a perceived location of the surface following element and according to the insertion instruction table stored in the navigation subsystem.
Additionally in accordance with a preferred embodiment of the present invention the operative medical insertion device operates to at least partially stare a log of a process of insertion of the insertable element. Additionally, the operative medical insertion device transmits the log of a process of insertion of the insertable element.
Further in accordance with a preferred embodiment of the present invention the computer operates to aggregate the logs of a process of insertion of the insertable element. Additionally, the computer prepares the reference pathway based at least partially on the aggregate.
Still further in accordance with a preferred embodiment of the present invention the computer transmits the reference pathway to the medical insertion device.
Further in accordance with a preferred embodiment of the present invention the insertable element includes a guiding element and a guided element.
Additionally, the driving subsystem operates to direct the guiding element and the guided element at least partially together. Additionally or alternatively, the driving subsystem is operative to at least partially automatically direct the guide in a combined motion comprising a longitudinal motion and lateral motion.
In accordance with yet another preferred embodiment, the mouthpiece includes a disposable mouthpiece.
In accordance with still another preferred embodiment of the present invention, the insertable element is extendable. In accordance with yet another preferred embodiment, the insertable element includes a mounting element which is arranged to be removably engaged with an intubator assembly and an extendable tube operatively associated with the mounting element. Preferably, the extendable tube is arranged to be pulled by a flexible guide operated by the intubator assembly.
In accordance with yet another preferred embodiment of the present invention, the extendable cube includes a coil spring. Additionally or alternatively, the extendable tube also includes a forward end member, on a distal end thereof.
Preferably, the forward end member includes a diagonally cut pointed forward facing tube end surface. Additionally or alternatively, the medical insertion device also includes a forward end member mounted inflatable and radially outwardly expandable circumferential balloon.
Preferably, the forward end member mounted inflatable and radially outwardly expandable circumferential balloon receives inflation gas through a conduit formed in a wall of the forward end member and continuing through the tube to a one way valve.
In accordance with another preferred embodiment, the medical insertion device also includes a flexible guide having mounted at a distal end thereof a tip sensor.
Preferably, the flexible guide is formed with an inflatable and radially outwardly expandable guide mounted balloon. Additionally, the inflatable and radially outwardly expandable guide mounted balloon receives inflation gas through a conduit formed in the flexible guide and extending therealong. Preferably, the conduit is connected to a source of pressurized inflation gas. Additionally or alternatively, the source of pressurized inflation gas is located within the intubator assembly.
Preferably, the inflation gas comprises pressurized air.
It is appreciated that the distances and angles referenced in the specification and claims are typical values and should not be construed in any way as limiting values.
BRIEF DESCRIPTION OF THE DRAWINGS AND APPENDICES
The present invention will be understood and appreciated more fully from the following detailed description, taken in conjunction with the drawings and appendices in which:
Figs. lA to 1L are a series of simplified pictorial illustrations of a process of employing a preferred embodiment of the present invention for the intubation of a human;
Figs. ZA to 2F taken together are a flowchart illustrating a preferred implementation of the present invention, operative for an intubation process as shown in Figs. 1 A to 1 L;
Fig. 3 is a simplified illustration of the internal structure of a preferred embodiment of the present invention for intubation of a human;
Fig. 4 is a simplified block diagram of a preferred embodiment of the present invention;
Figs. SA to SH are electrical schematics of a preferred embodiment of the present invention for incubation of a human;
Figs. 6A to 6K are a series of simplified pictorial illustrations of a process of employing a preferred embodiment of the present invention for insertion of an element into the intestine of a human;
Fig. 7 is a preferred embodiment of a table comprising instruction, operative in accordance with a preferred embodiment of the present invention, for insertion of an element into the intestine of a human as shown in Figs. SA to SK;
Fig. 8 is a flowchart illustrating a preferred implementation of the present invention, operative for a process of insertion of an element into the intestine of a human as shown in Figs. 6A to 6K;
Figs. 9A to 9F are a series of simplified pictorial illustrations of an extendable endotracheal tube assembly constructed and operative in accordance with a preferred embodiment of the present invention in various operative orientations;
Figs. l0A to lOG are a series of simplified pictorial illustrations of the extendable endotracheal tube assembly of Figs. 9A - 9F employed with the medical insertion device of Figs. lA - 8 for the intubation of a human;
a Figs. 11A to 11F are a series of simplified pictorial illustrations of an extendable endotracheal tube assembly constructed and operative in accordance with another preferred embodiment of the present invention in various operative orientations;
and Figs. 12A to 12G are a series of simplified pictorial illustrations of the extendable endotracheal tube assembly of Figs. 9A - 9F employed with the medical insertion device of Figs. lA - 8 for the intubation of a human.
LIST OF APPENDICES
Appendices 1 to 3 are computer listings which, taken together, form a preferred software embodiment of the present invention.
DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS
Reference is now made to Figs. lA to 1L, which are a series of simplified pictorial illustrations of a system and methodology for the incubation of a human in accordance with a preferred embodiment of the present invention.
It is appreciated that the general configuration of the mouth and trachea is generally the same for all humans except for differences in scale, such as between an infant, a child and an adult. In a preferred implementation of the present invention, a standard contour map 10 of the human mouth and trachea is employed. The scale of the map 10 may be further precisely adapted to the specific patient, preferably automatically. Alternatively. the scale of the map 10 is adapted to the specific patient semi-automatically. In this alternative the operator can select the scale of the map 10, for example by selecting between a child and an adult. Thereafter the scale of the map is automatically adapted to size of the specific patient as a part of the intubation process. As a further alternative or in addition the operator is enabled to designate one or more typical impediments such as: a tumor, a swelling, an infection and an injury.
Selecting an impediment preferably creates a suitable variation of the general map 10.
Fig. lA shows the map 10 and the location therein where a tip sensor 11 of an intubator engages the mouth and trachea of the patient. It is a particular feature of the present invention that intubation is at least partially automatically effected by utilizing the contour map 10 to monitor the progress of tip sensor 11 and thus to navigate the intubator accordingly.
As seen in Fig. 1 A, an intubator assembly 12, suitable for the intubation of a human, is partially inserted into an oral cavity of a patient. The intubator assembly 12 preferably comprises a housing 14 in which is disposed a guide driver 15, a mouthpiece 16, a cube 18 inserted through the mouthpiece 16, a flexible guide inserted through the tube 18, and tip sensor 11 mounted at the distal end of the guide 20.
The mouthpiece 16 preferably comprises a rigid curved pipe 24 through which the tube 18 is inserted. Preferably the curved pipe 24 comprises a slit 49 on each side.
Alternatively, the curved pipe 24 is eliminated.
It is appreciated that some of the components comprising the intubator assembly 12 may be disposable, for example, the tube 18 and the mouthpiece 16.
The guide driver 15 is operative to move the guide 20 in and out of the housing 14, through the curved pipe 24 and through the tube 18. The guide driver 15 is also operative to selectably bend the distal end of the guide 20 clockwise and counterclockwise in the plane of the curvature of the curved pipe 24 in the sense of Fig.
I A.
Referring now to an enlargement of the tip sensor 11, it is seen that tip sensor l l preferably comprises a tip 28 preferably integrally formed at one end of a short rod 30 having a magnet 32 on its other end. The rod 30 preferably extends thraugh the center of a spring disk 34 and is firmly connected thereto. The spring disk 34 is preferably mounted on one end of a cylinder 36 whose other end is mounted on the distal end of the guide 20. Preferably, the tip sensor 11 also comprises two Hall effect sensors, 38 and 40, which are mounted inside the cylinder 36 on a support 41 and in close proximity to the magnet 32. The Hall effect sensors 38 and 40 are preferably spaced in the plane of the curvature of the curved pipe 24. Typically, each Hall effect sensor has electrical terminals operative to provide electric current representing the distance of the magnet 32 therefrom.
When a force is exerted on the tip 28 along the axis of symmetry 42 of cylinder 36, the tip 28 is pushed against the spring disk 34, causing the magnet 32 to approach the Hall effect sensors 38 and 40. Since the distance between the magnet 32 and each of the Hall effect sensors 38 and 40 decreases, both Hall effect sensors 38 and 40 produce an increase in their output electric current. When a force is exerted on the tip 28 sideways in the plane of the Hall effect sensors 38 and 40, the tip 28 rotates around the location where the rod 30 engages the spring disk 34, as is shown in Fig.
lA. This causes the magnet 32 to rotate away from the Hall effect sensor 40 and closer to the Hall effect sensor 38. The output electric current of the Hall effect sensor 40 typically decreases and the output electric current of the Hall effect sensor 38 typically correspondingly increases. Thus, it may be appreciated that the tip sensor 11 enables electronic circuitry (not shown) to measure the amplitude and the direction of force exerted on the tip 28 in the plane of the Hall effect sensors 38 and 40 and to compute the orientation of a surface of a tissue against which the sensor tip 28 is depressed, relative to the axis of symmetry 42.
It is appreciated that sensors other than Hall effect sensors can be used to measure the direction and the amplitude of the force exerted on the tip 28, or otherwise to measure the proximity and the orientation of the adjacent surface.
During automatic operation of the system, following partial insertion of the intubator assembly 12 into the oral cavity, as shown in Fig. lA, the guide driver 15 typically causes the guide 20 to extend in the direction of the trachea 44 and bends the guide 20 clockwise until the tip 28 engages a surface of the tongue 46. This engagement applies a Force to tip 28, which causes the tip to rotate counterclockwise wherein the magnet 32 approaches the Hall effect sensor 38. Electronic circuitry (not shown) inside the housing 14, which measures the changes in the electrical outputs produced by the Hall effect sensors 38 and 40, indicates that the tip 28 is bent clockwise.
By sensing the position of the tip and employing the past history of tip positions, the system of the present invention determines the location of the tip sensor 1 I in the oral cavity and relative to the map 10. This location is employed in order to navigate the intubator correctly, as described hereinbelow.
Reference is now made to Fig. 1B, which illustrates a further step in the intubation in accordance with the present invention. Fig. 1B shows the guide extended further and reaching an area between the base of the tongue 46 and the epiglottis 48 of the patient.
As seen in Fig. 1C, the guide 20 extends further forward until the tip 28 touches the end of the trough beneath the epiglottis 48.
As seen in Fig. 1D, the guide 20 bends counterclockwise and touches the bottom surface of the epiglottis 48. Then the guide 20 retracts a little, while preserving continuous tactile contact between the tip 28 with the bottom surface of the epiglottis 48.
As seen in Fig. lE, the guide 20 retracts further until the tip 28 of the tip sensor 11 reaches the tip 165 of the epiglottis 48 and then the tip 28 loses tactile contact with the surface of the tip 165 of the epiglottis 48.
As seen in Fig. 1F, the guide 20 bends further counterclockwise, then extends forward and then bends clockwise until the tip 28 touches the upper surface of the epiglottis 48.
1z As seen in Fig. 1G, the guide 20 extends forward, preserving continuous tactile contact with the epiglottis 48, until the tip 28 senses the first trough of the trachea 44.
As seen in Figs. 1H and lI, the guide 20 extends furkher forward until the tip 28 senses the second trough of the trachea 44.
As seen in Figs. 1J and 1K, the guide 20 extends further forward until the tip 28 senses the trough of the third cartilage of the trachea 44. Then the guide 20 further ettends, typically for adults by 5 centimeters, to ensure that the tube 16 reaches to the third cartilage.
As seen in Fig. 1 L, the guide driver 15 is pulled out with the guide 20 leaving the mouthpiece 16 and the tube 18 inside the patient's mouth and trachea 44.
Reference is now made to Figs. 2A to 2F, which, taken together, are a flowchart of the process of the intubation of a human shown in Figs. lA to 1K.
Fig. 2A and 2B, taken together, correspond to the step of the intubation process shown in Fig. lA.
In step 100 of Fig. 2A the intubator assembly 12 is set to perform intubation.
In step 102 the incubator loads an incubation pattern map 10 from its memory.
In steps 104, 106 and 108 the intubator enables the operator to set the scale of the incubation pattern map to the corresponding size of the patient by selecting between an infant, a child and an adult.
In steps 110, 112 and 114 the incubator enables the operator to adapt the intubation pattern map 10 to a type of incubation impediment, preferably by selecting from a menu. As seen in Fig. 2A the menu typically provides the operator with four optional impediments: an infection, a swelling, a tumor and an injury, and a fifth option not to select any impediment. It is appreciated that various types of impediments can be defined as is typical for a specific organ.
As seen in Fig. 2B, steps 120, 122, 124, 126, 128 and 130 cause the guide 20 to extend in the direction of the throat and simultaneously bend clockwise until the tip sensor is depressed against the surface of the tongue or until extension and bending limits are reached. As seen in step 128, the bending limit is preferably 50 degrees and the eltension limit is preferably 2 centimeters. If the tip sensor is depressed, the scale of the incubation pattern map 10 is preferably updated (step 132) to match the particular scale or size of the intubated patient. If at least one of the extension limit and the bending limit is reached an error message is displayed (step 134) and the intubation process is stopped.
Reference is now made to Fig. 2C, which corresponds to Figs. 1B and 1 C. As illustrated in Fig. 2C, the guide driver 15 performs sequential steps 140, 142, I44 and 146 in a loop, eltending (step 140) guide 20 further into the patient's throat and along the throat surface, following the intubation pattern map 10 and keeping the tip in contact with the surface (steps I44, 146). When the output electric currents from both Hall effect sensors 38 and 40 increase, the intubator assumes (step 142) that the tip 28 has reached the end of the trough beneath the epiglottis 48. The point of engagement between the tip 28 and the body is designated in Fig. 1C by reference numeral 147. The scale of the intubation pattern map 10 is then preferably updated to match the patient's organ structure (step 148).
Reference is now made to Fig. 2D, which corresponds to Figs. 1D and 1 E. As seen in Fig. 2D the guide driver 15 performs steps 150, 152 and 154 in a loop, bending the distal end of the guide 20 counterclockwise until the tip 28 touches the epiglottis 48, or until a bending limit, preferably of 45 degrees is reached (step 154) and the intubation stops (step 156), The preferred point of engagement between the tip 28 and the surface of the epiglottis is designated in Fig. 1D by reference numeral 155.
After sensing an engagement between the tip 28 and the surface of the epiglottis, the guide driver 15 performs steps 158, 160, 162, and 164 in a loop, retracting the guide 20 further (step 158), and increasing the bending of the guide 20 (step 164), until the tip of the guide reaches the tip of the epiglottis 48, designated in Fig. lE by reference numeral 165. When the tip 28 reaches the tip of the epiglottis 48, the tip 28 is released and the output electric currents from both Hall effect sensors decrease to a minimum.
Preferably the intubation pattern map 10 is updated (step 166) to match the patient's organ structure.
Reference is now made to Fig. 2E, which corresponds to Figs. lE and 1F.
As seen in Fig. 2E, the guide driver 15 causes the guide 20 to move above and around the tip of the epiglottis 48 by causing the guide 20 to bend counterclockwise, preferably by 45 degrees, then to move forward down the throat by 5 millimeters and then to bend clockwise, preferably by 10 degrees (Step 170), Then the guide driver 15 performs steps 172, 174 and 176 in a loop, bending and extending (step 174) until the tip 28 of the guide touches the upper surface of the epiglottis 48 or until an extension limit, preferably of 1 centimeter, or a bending limit, preferably of 50 degrees, is reached, and the intubation is stopped (step 178). A preferred point of engagement between the tip 28 and the epiglottis is designated in Fig. 1F by reference numeral 177.
Reference is now made to Fig. 2F, which corresponds to Figs. 1G to 1K.
As seen in Fig. 2F, a ''cartilage crest counter N" is first zeroed (step 180).
Then the guide driver 15, performing steps 182 to 198 in a loop, causes the guide 20 to move the sensor tip 11 forward (step 182) along the surface of the trachea 44, preserving contact between the tip 28 and the surface of the trachea (steps 186 and 188) by increasing the bend (step 188) as needed. Each time a crest (189 in Figs, 1H, lI, 1J) of a cartilage of the trachea 44 is located the "cartilage crest counter" is incremented (step 190), the tip 28 is moved about the crest (steps I92, 194, 196 and 198) and the loop process repeats until the third cartilage is located. Then the guide 20 further extends, typically for adults by 5 centimeters, to ensure that the tube 16 reaches to the third cartilage.
The guide driver 15 then signals to the operator that the insertion is completed successfully (step 200).
Reference is now made to Fig. 3, which is a simplified illustration of the internal structure of a preferred embodiment of the present invention useful for intubation of a human. The intubator assembly 12 preferably comprises the housing 14, the guide driver 15, the mouthpiece 16, the tube 18, the flexible guide 20 inserted inside the tube 18 and the tip sensor 11 mounted at the distal end of the guide 20.
Preferably the mouthpiece comprises a curved pipe 24.
Preferably, the guide driver 15 comprises a first motor 210 that drives a gearbox 212 that rotates a threaded rod 214. A floating nut 216 is mounted on the threaded rod 214. As the motor 210 rotates the threaded rod 214, the floating nut 216 is moved forward or backward according to the direction of the rotation. The floating nut 216 is operative to move a carriage 218 along a bar 220 and thus to push or pull the guide 20. When the carriage 218 touches a stopper 222 the stopper 222 moves with the carriage 218 along the bar 220 and pushes the tube 18 forward.
A second motor 224 is connected to a disk 226 to which two guide angulation wires 228 are attached at first end thereof. The guide angulation wires 228 are threaded inside the guide 20 and their other ends are connected to the distal end of the guide .just short of the tip sensor 11. When the motor 224 rotates the disk 226 clockwise one of the wires 228 is pulled and the second wire is loosened. The wire that is pulled pulls and bends the distal end of the guide 20 counterclockwise in the sense of Fig. 3. Accordingly, when the motor 224 rotates counter-clockwise the second wire of the rivo wires 228 is pulled and the first wire is loosened. The wire that is pulled pulls and bends the distal end of the guide 20 clockwise in the sense of Fig. 3.
Electronic circuitry 229 is provided within the housing 14 and is preferably electrically connected to operating switches 230, a display 232, the motors 210 and 224 and to the Hall effect sensors 38 and 40 (Fig. lA) in the tip sensor 11.
Preferably, the electronic circuitry 229 also comprises a microprocessor, operative to execute a program. The program is preferably adapted to control the switches 230, the display 232, motors 210 and 224 and the Hall effect sensors 38 and 40 and to insert and bend the guide inside a living organism, according to a predefined map until the tip of the guide reaches a destination point inside the living organism. Preferably the program is operative to cause the tip 28 of the guide 20 to follow a predefined internal contour of an organ of the living organism. Preferably program is operative employ tactile sensing to measure the position of the tip of the guide relative to the surface organ of the living organism.
It is appreciated that the term "microprocessor" also includes inter alia a ''microcontroller".
Electrical batteries (not shown) are preferably provided within the housing 14 to supply electric power to the electronic circuitry, the tip sensor 11, the motors 210 and 224, the display 232 and all other elements of the present invention that consume electricifiy. It is appreciated that external sources of electricity can also be employed to provide power to the intubator assembly 12.
Communication interface (not shown), preferably employing infra-red communication technology, is provided to enable communication with external data processing equipment.
Preferably, a balloon 234 is provided at the distal end of the tube 18 and a thin pipe (not shown) is inserted through the pipe 18 and is connected, through the side of the pipe, to the balloon. The thin pipe enables an operator to inflate the balloon when the distal end of the pipe 18 reaches the appropriate place in the trachea, thus securing the distal end of the pipe to the trachea.
Reference is now made to Fig. 4, which is a simplified functional block diagram of a preferred embodiment of the guide driver 15 described hereinabove. In Fig. 4 the guide 20 is driven by two drivers. A longitudinal driver 240 preferably comprises a motor 210, the gear 212, the threaded rod 214, the floating nut 146 and the carriage 218 of Fig. 3. A bending guide driver 242 preferably comprises the motor 224, the disk 226 and wires 228 (Fig. 3). The longitudinal driver 240 and the bending guide driver 242 are controlled by two software driver modules. A longitudinal software driver module 244 controls the longitudinal driver 240 and comprises two functions: an extend function 246 and a retract function 248. A bending software driver 250 controls the bending guide driver 242 and comprises two functions: a bend counterclockwise function 252 and a bend clockwise function 254. The functions 246, 248, 252 and 254 are operated by a propagation control software module 256.
At the other end of the guide 20, the tip sensor 11 measures the proximity and orientation of an adjacent surface. In a preferred embodiment of the present invention the tip sensor 11 performs the proximity and orientation measurements by measuring the force applied to a tactile tip by a surface of an adjacent tissue. A tip sensor software driver module 260, operative to receive input signals from the tip sensor 11, provides two input functions: a counterclockwise tip rotation function 262 and a clockwise tip rotation function 264. The measurements of the tip positions as provided by the tip sensor software driver module 260 are collected and stored by a sensor log module 266.
The map 10 is loaded into memory and serves as an updatable map 268.
A comparator 270 compares the accumulated measurements from the tip sensor 11 with the updated reference map 268. The results of the comparisons are calculated by an update scale module 272 to provide a scaling factor that is applied to update the updated map 268. Consequently a navigation module 274 employs the updated map information to instruct the propagation control 256 to execute the next step of the insertion program.
It is appreciated that a measurement of the electric current drawn by at least one of the longitudinal guide drive and the bending guide drive can also serve as an input to the comparator 270 to evaluate the position of the tip sensor.
Reference is now made to Figs. SA to SH, which are, taken together, an electrical schematic of a preferred embodiment of the present invention useful for intubation of a human. Reference is especially made to microprocessor 278, which is preferably operative to operate a program to control the elements of the intubator assembly 12, such as the operating switches 230, the display 232, the motors 210 and 224 (Fig. 3), and the Hall effect sensors 38 and 40 in the tip sensor 11 (Fig.
lA), and to perform the incubation process, such as the process shown and described hereinabove with reference to Figs. 2A to 2F.
Reference is now made to Figs. 6A to 6K, which are a series of simplified pictorial illustrations of ten typical steps in a process of employing a preferred embodiment of the present invention useful for insertion of an element into the intestine of a human.
It is appreciated that some of the organ systems of a living organism are generally similar up to a scale factor, such as the mouth and trachea system.
Other organs, such as the intestine system, are generally different from one human body to the other. Therefore, in order to employ the present invention to insert a medical device or apply a medicine to a specific location within a generally variable organ, a map of the organ, at least from the entry point and until the required location, is prepared before the insertion process is activated. The required map is preferably prepared by employing an appropriate medical imaging system, such as an ultrasound scanner, an x-ray imager, a CAT scan system or a MRI system. The map can be a two dimensional map or a three-diinensional map as appropriate for the specific organ. Typically for the intestine system a three dimensional map is required.
It is appreciated that an inserter according to a preferred embodiment of the present invention for use in organs that are variable in three dimensions is similar to the incubator assembly 12, preferably with the following modifications:
(1) The tube 18 may be replaced with a different insertable device;
(2) An additional guide bending system employing elements similar to motor 222, disk 224 and wires 226 is added and mounted perpendicularly to the first system of motor 222, disk 224 and wires 26, so that it is possible to bend the end of the guide in three dimensions. It is appreciated that three-dimensional manipulation is possible also by employing three or more motors; and (3) The tip sensor 11 preferably comprises four Hall effect sensors to sense the motion of the tip 28 in three dimensions. It is appreciated that it is possible to operate the tip sensor in a three-dimensional space also by employing three Hall effect sensors. It is also appreciated that other types of sensors can be employed to measure the proximity and orientation of an adjacent surface in three dimensions.
In a preferred embodiment of the present invention, when the guide 20 performs longitudinal motion, such as insertion or retraction, the guide 20 also performs a small and relatively fast lateral motion. The combined longitudinal and lateral motions are useful for sensing the surface of the organ in three dimensions and hence to better determine the location of the tip sensor 11 in the organ and relative to the map 10.
Due to limitations of the graphical representation, a two-dimensional imaging and map is shown in Figs. 6A to 6K.
As seen in Fig. 6A, a human organ, the intestine in this example, is imaged, typically by a CAT scan system 280, and an image 282 of the internal structure of the organ is produced.
In Fig. 6B the image 282 of the organ is used to create an insertion map 284. Typically the image 282 is displayed on a computer screen (not shown) and a pointing device, such as a computer mouse or a light pen, is used to draw a preferred path 286 that the tip of the guide is to follow. The path is typically drawn by marking a contour of the organ, and optionally marking the guide bending points, as is shown and described with reference to Figs. lA to 1 K. Alternatively, a preferred path is created, such as path 286, not necessarily continuously following the contours of the organ. As a further alternative, the map 10 or the path 286 is converted into a set of insertion steps as is shown and described hereinbelow with reference to Fig. 7.
Reference is no4v made to Fig. 7 together with Fig. 8 and with Figs. 6C to 6K. As shown in Fig. 7, a table 290 is provided for storage in a computer memory and for processing by a computer processor. The table 290 contains rows 292, wherein each row 292, preferably comprises an instruction to perform one step in the process of insertion of a medical insertion device into a living organism such as shown and described with reference to Figs. 6C to 6K. Preferably each row 292 contains the expected values or the maximal values for the extension of an insertion guide such as guide 20, the bending of the insertion guide and the electrical outputs from the Hall effect sensors 38 and 40 (Fig. lA). In a preferred embodiment of the present invention the row 292 contains five sets of values:
(a) Initial bend 294 contains two values for bending the guide from a straight position, in two perpendicular planes.
(b) Initial insertion 295 contains a longitudinal value for extending or retracting the guide in centimeters.
(c) Initial sensor measurements 296 contains expected output values of four sensors such as four Hall effect sensors, for example, Hall effect sensors 38 and 40 of Fig. lA. The initial sensors measurements 296 are expected to be measured by the time the guide reaches the value of the initial insertion 295.
(d) Insert distance 297 contains a longitudinal value for further extending or retracting the guide in centimeters. Typically the initial sensor measurements 296 are expected to be preserved, while the guide is extended or retracted, by adapting the bending of the guide.
(e) Final sensor measurements 298 contain expected output values of the four sensors of step (c). The initial sensor measurements 298 are expected to be measured by the time the guide reaches the value of the insert distance 297.
It is appreciated that the path drawn in Fig. 6B can be employed to prepare a table of instructions, such as table 290 of Fig. 7.
Referring to Fig. 8, which is a flowchart illustrating a preferred implementation of the present invention, operative for a process of insertion of an element into the intestine of a human as shown in Figs. 6A to 6K. The flowchart of Fig.
8 is a preferred embodiment of a program, operative to be executed by a processor, such as microprocessor 278 of Fig. 5A, comprised in a preferred embodiment of the present invention, for insertion of an element into a living organism, preferably by employing a table 290 shown and described with reference to Fig. 7.
The preferred flowchart shown in Fig. 8 starts by loading the table (step 300) such as the map shown in Fig. 7. The program then reads a first row 292 from the map (step 302) and causes the distal end of the guide 20 to bend according to the initial bending values 294. Then the program causes the guide 20 to extend or retract according to the initial insertion distance 295 of the first row in the map.
The program continues to bend and insert the guide 20 until output values of the sensors match the expected initial sensor measurement 296 of the row (steps 304, 306 and 308), or until a limit is surpassed, an error message is displayed and the program is stopped (step 310).
Preferably, the initial values of the sensors are measured and then the program continues to extend or retract the guide 20 (step 312) until the sensors produce the final sensors measurements 298 values (step 314), while keeping in contact with the surface (steps 316 and 318) or until at least one of predefined limits is surpassed (step 320) where the program is stopped (step 310). If the final sensor measurements values are measured the program proceeds to step 320 and Ioops through steps 302 and 320 until all the rows 292 of the table are processed. Then the program displays an insertion success message on the display 232 and halts (step 322).
As indicated by row No. 1 of Fig. 7 and Fig. 6C the guide is bent, preferably by up to 45 degrees, to the Ieft in the plane of Fig. 6C and, while preserving contact with the left side of the intestine, is extended up to 5 centimeters or until the sensor tip engages the internal surface of the intestine head on at a point in the map 284 designated by reference numeral 330.
As indicated by row No.2 of Fig. 7 and Fig. 6D the guide is bent by up to 45 degrees to the right in the plane of Fig. 6D and, while preserving contact with the left side of the intestine, is extended up to 2.5 centimeters or until the sensor tip does not sense the internal surface of the intestine at a point in the map 284 designated by reference numeral 332.
As indicated by row No.3 of Fig. 7 and Fig. 6E the guide is bent by up to 110 degrees to the left in the plane of Fig. 6E and, while preserving contact with the left side of the intestine, is extended by 1 centimeter to a point in the map 284 designated by reference numeral 334.
In accordance with row 4 of Fig. 7 and Fig. 6F the guide is bent by up to 45 degrees to the right in the plane of Fig. 6F and is extended by 6 centimeter to a point in the map 284 designated by reference numeral 336.
As indicated by row No.S of Fig. 7 and Fig. 6G the guide is bent by up to 20 degrees to the right in the plane of Fig. 5G and, while preserving contact with the right side of the intestine, is extended by 4 centimeters to a point in the map 284 designated by reference numeral 338.
As indicated by row No.6 of Fig. 7 and Fig. 6H the guide is bent by up to -60 degrees to the left in the plane of Fig. 6H and is extended by up to 3 centimeters or until the sensor tip engages the internal surface of the intestine head on at a point in the map 284 designated by reference numeral 340.
As indicated by row No.7 of Fig. 7 and Fig. 6I the guide is bent by up to 45 degrees to the right in the plane of Fig. 6I and is extended by up to 1 centimeter or until the sensor tip engages the internal surface of the intestine with its right side in a point in the map 284 designated by reference numeral 342.
As indicated by row No.8 of Fig. 7 and Fig. 6J the guide is extended by up to 1 centimeters or until the sensor tip engages the internal surface of the intestine with its left side at a point in the map 284 designated by reference numeral 344.
As indicated by row No.9 of Fig. 7 and Fig. 6K the guide is bent by up to 45 degrees to the right in the plane of Fig. 6K and is extended by up to 1 centimeter or until the sensor tip engages the internal surface of the intestine head on at a point in the map 284 designated by reference numeral 346.
In a preferred embodiment of the present invention the system and the method are operative for automatic operation. Alternatively the present invention can be operated manually, by providing to the operator the information collected by the sensor log 266 form the tip sensor 11 and enabling the operator to control manually the guide 20. In another alternative part of the procedure is performed automatically and another part is performed manually. For example, the guide 20 may be inserted automatically and a medical device, such as the tube 18 may be inserted manually.
It is appreciated that a log of the process of insertion of an insertable element into a living organism such as a human body is preferably stored in an internal memory of the present invention and that this log can be transmitted to a host computer.
It is appreciated that the host computer can aggregate insertion process logs and thereby continuously improve relevant insertion pattern maps such as the standard contour map 10. Thereafter, from time to time or before starting an insertion process, the present invention is capable of loading an updated map such as standard contour map 10.
It is also appreciated that the accumulated logs of processes of insertions can be employed to improve the algorithm for processing the maps, such as the algorithms shown and described with reference to Figs. 2A - 2F and Fig. 8. The improved algorithm can be transmitted to the present invention as necessary.
Reference is now made to Figs. 9A to 9F, which are a series of simplified pictorial illustrations of an extendable endotracheal tube assembly constructed and operative in accordance with a preferred embodiment of the present invention, in various operative orientations.
Turning to Fig. 9A, it is seen that the extendable endotracheal tube assembly, designated generally by reference numeral 400, preferably comprises a mounting element 402 which is arranged to be removably engaged with an incubator assembly (not shown) such as intubator assembly 12 (Figs. lA - 1L). Fixed to or integrally formed with mounting element 402 is a mouthpiece 404, which is preferably integrally formed with a rigid curved pipe 406. Fixedly mounted onto mounting element 402, interiorly of rigid curved pipe 406, is a mounting base 408 onto which is, in turn, mounted, an extendable tube 410, preferably including a coil spring 411, typically formed of metal. Fixedly mounted onto a distal end of extendable tube 410 there is preferably provided a forward end member 412, preferably presenting a diagonally cut pointed forward facing tube end surface 414.
Upstream of end surface 414, forward end member 412 is preferably provided with an inflatable and radially outwardly expandable circumferential balloon 416, which receives inflation gas, preferably pressurized air, preferably through a conduit 418 embedded in a wall of forward end member 412 and continuing through tube 410 to a one way valve 419.
It is noted that the extendable endotracheal tube assembly 400 may comprise an integrally formed mouthpiece assembly and an integrally formed insertable extendable tube assembly. The integrally formed mouthpiece assembly may comprise the mouthpiece 404 and the rigid curved pipe 406. The integrally formed extendable tube assembly may comprise the extendable tube 410, the mounting element 402, the mounting base 408, the coil spring 411, the forward end member 412 with the end surface 414 and the circumferential balloon 416, the conduit 418 and the one way valve 419.
Extending slidably through forward end member 412, tube 410, mounting base 408 and mounting element 402 is a flexible guide 420, which preferably corresponds in function inter alia to guide 20 in the embodiment of Figs. lA -1L and preferably has mounted at a distal end thereof a tip 421, which preferably corresponds in structure and function inter alia to the tip 28 in the embodiment of Figs.
lA - 1L. Tip 421 forms part of a tip sensor, preferably enclosed in guide 420, which preferably corresponds in structure and function inter alia to the tip sensor 11 in the embodiment of Figs. lA - 1L.
As distinct from that described hereinabove with reference to Figs. lA -8. the flexible guide is preferably formed with an inflatable and radially outwardly expandable balloon 422, which receives inflation gas, preferably pressurized air, preferably through a conduit 424 formed in flexible guide 420 and extending therealong, preferably to a source of pressurized inflation gas, preferably located within the incubator assembly (not shown).
Fig. 9B shows inflation of balloon 422 by means of pressurized air supplied via conduit 424, causing balloon 422 to tightly engage the interior of forward end member 412.
Fig. 9C illustrates extension of tube 410, which is preferably achieved by forward driven movement of flexible guide 420 in tight engagement with forward end member 412, thus pulling forward end member 412 and the distal end of tube 410 forwardly therewith.
Fig. 9D illustrates inflation of balloon 416 by means of pressurized air through one way valve 419 and conduit 418. As will be described hereinbelow, this inflation is employed for sealing the tube 410 within a patient's trachea.
Fig. 9E illustrates deflation of balloon 422 following inflation of balloon 416, corresponding to desired placement and sealing of tube 410 within the patient's trachea. Fig. 9F illustrates removal of the flexible guide 420 from the tube 410.
Reference is now made to Figs. l0A to lOG, which are a series of simplified pictorial illustrations of the extendable endotracheal cube assembly of Figs.
9A - 9F employed with the medical insertion device of Figs. lA - 8 for the intubation of a human.
Turning to Fig. 10A, it is seen that the extendable endotracheal cube assembly, designated generally by reference numeral 500, preferably comprises a mounting element (not shown) which is arranged to be removably engaged with an intubator assembly 503 which is preferably similar to intubator assembly 12 (Figs. lA -1 L) or any other incubator assembly described hereinabove but may alternatively be any other suitable intubator assembly. Fixed to or integrally formed with the mounting element is a mouthpiece 504, which is preferably integrally formed with a rigid curved pipe 506. The extendable entotracheal tube assembly 500 is shown inserted into a patient's oral cavity, similar to the placement shown in Fig. lA.
Fixedly mounted onto the mounting element, interiorly of rigid curved pipe 506, is a mounting base 508 onto which is, in turn, mounted, an extendable tube 510, preferably including a coil spring 511 (Fig. lOC), typically formed of metal.
Fixedly mounted onto a distal end of extendable tube 510 there is preferably provided a forward end member 512, preferably presenting a diagonally cut pointed forward facing tube end surface 514.
Upstream of end surface 514, forward end member 512 is preferably provided with an inflatable and radially outwardly expandable circumferential balloon 516, which receives inflation gas, preferably pressurized air, preferably through a conduit 518 embedded in a wall of forward end member 512 and continuing through tube 510 to a one way valve 519.
It is noted that the extendable endotracheal tube assembly 500 may comprise a mouthpiece assembly and an extendable tube assembly, which is inserted therein. The mouthpiece assembly comprises the mouthpiece 504, which is integrally formed with the rigid curved pipe 506. The extendable tube assembly comprises the extendable tube 510, which is integrally formed together with the mounting element, the mounting base 508, the coil spring 511, the forward end member 512 with the end surface 514 and the circumferential balloon 516, the conduit 518 and the one way valve 519.
Extending slidably through forward end member 512, tube 510, mounting base 508 and the mounting element is a flexible guide 520, which preferably corresponds in function inter alts to guide 20 in the embodiment of Figs. lA -1L and preferably has mounted at a distal end thereof a tip, which preferably corresponds in structure and function inter alts to the tip 28 in the embodiment of Figs. lA -1L. The tip forms part of a tip sensor, preferably enclosed in guide 520, which preferably corresponds in structure and function inter alia to the tip sensor 11 in the embodiment of Figs. 1 A - 1 L.
As distinct from that described hereinabove with reference to Figs. lA -8, the flexible guide is preferably formed with an inflatable and radially outwardly expandable balloon 522, which receives inflation gas, preferably pressurized air, preferably through a conduit 524 formed in flexible guide 520 and extending therealong, preferably to a source of pressurized inflation gas preferably located within the intubator assembly 503.
The source of pressurized inflation gas may be an automatic inflatorldeflator 526. Additionally or alternatively, a one way valve 528 may be provided for manual inflation. The automatic inflator/deflator 526 may be fixed within intubator assembly 503 or alternatively may be mounted therewithin for motion together with flexible guide 520.
Fig. lOB shows inflation of balloon 522 by means of pressurized air supplied via conduit 524, causing balloon 522 to tightly engage the interior of forward end member 512.
Fig. 10C illustrates extension of tube 510, which is preferably achieved by forward driven movement of flexible guide 520 in tight engagement with forward end member 512, thus pulling forward end member S I2 and the distal end of tube 510 forwardly therewith.
Fig. 10D illustrates further extension of tube 510, by forward driven movement of flexible guide 520 in tight engagement with forward end member 512, thus pulling forward end member 512 and the distal end of tube 510 forwaxdly therewith. This further motion is preferably provided based on the navigation functionality described hereinabove with reference to Figs. lA - 8. It is appreciated that the forward driven movement of tube 510 as described hereinabove with reference to Figs. lA - 8, may be provided by driven forward motion of the flexible guide 520.
Fig. l0E illustrates inflation of balloon 516 by means of pressurized air through conduit 518 and one way valve 519. As will be described hereinbelow, this inflation is employed for sealing the tube 510 within a patient's trachea.
Fig, lOF illustrates deflation of balloon 522 following inflation of balloon 516, corresponding to desired placement and sealing of tube 510 within the patient's trachea. Fig. lOG illustrates removal of the flexible guide 520 from the tube 510.
Reference is now made to Figs. 11A to 11F, which are a series of simplified pictorial illustrations of an extendable endotracheal tube assembly constructed and operative in accordance with another preferred embodiment of the present invention in various operative orientations.
Turning to Fig. 11A, it is seen that the extendable endotracheal tube assembly, designated generally by reference numeral 600, preferably comprises a mounting element 602 which is arranged to be removably engaged with an intubator assembly (not shown) such as intubator assembly 12 (Figs. lA - 1L). Fixed to or integrally formed with mounting element 602 is a mouthpiece 604.
Fixedly mounted onto mounting element 602 is a mounting base 608 onto which is, in turn, mounted, an extendable tube 610, preferably including a coil spring 611, typically formed of metal. Fixedly mounted onto a distal end of extendable tube 610 there is preferably provided a forward end member 612, preferably presenting a diagonally cut pointed forward facing tube end surface 614.
Upstream of end surface 614, forward end member 612 is preferably provided with an inflatable and radially outwardly expandable circumferential balloon 616, which receives inflation gas, preferably pressurized air, preferably through a conduit 618 embedded in a wall of forward end member 612 and continuing through tube 610 to a one way valve 619.
It is noted that the extendable endotracheal tube assembly 600, comprising at least one of mounting element 602, mouthpiece 604, mounting base 608, cube 610, coil spring 611, forward end member 612, end surface 614, circumferential balloon 616, conduit 618 and one way valve 619, may also be integrally formed as a unified structure.
Extending slidably through forward end member 612, tube 610, mounting base 608 and mounting element 602 is a flexible guide 620, which preferably corresponds in function inter alia to guide 20 in the embodiment of Figs. lA -1L and preferably has mounted at a distal end thereof a tip 621, which preferably corresponds in structure and function inter alia to the tip 28 in the embodiment of Figs.
lA - 1L. Tip 621 forms part of a tip sensor (not shown), preferably enclosed in guide 620, which preferably corresponds in structure and function inter alia to the tip sensor 11 in the embodiment of Figs. 1 A - 1 L.
As distinct from that described hereinabove with reference to Figs. lA -8, the flexible guide is preferably formed with an inflatable and radially outwardly expandable balloon 622, which receives inflation gas, preferably pressurized air;
preferably through a conduit 624 formed in flexible guide 620 and extending therealong, preferably to a source of pressurized inflation gas preferably located within the incubator assembly (not shown).
Fig. 11B shows inflation of balloon 622 by means of pressurized air supplied via conduit 624, causing balloon 622 to tightly engage the interior of forward end member 612.
Fig. 11C illustrates extension of tube 610, which is preferably achieved by forward driven movement of flexible guide 620 in tight engagement with forward end member 612, thus pulling forward end member 612 and the distal end of tube forwardly therewith.
Fig. 11 D illustrates inflation of balloon 616 by means of pressurized air through conduit 6I8 and one way valve 619. As will be described hereinbelow, this inflation is employed for sealing the tube 610 within a patient's trachea.
Fig. 11 E illustrates deflation of balloon 622 following inflation of balloon 616, corresponding to desired placement and sealing of tube 610 within the patient's trachea. Fig. 11F illustrates removal of the flexible guide 620 from the tube 610.
Reference is now made to Figs. 12A to 12G, which are a series of simplified pictorial illustrations of the extendable endotracheal tube assembly of Figs.
11A - I 1F employed with the medical insertion device of Figs. 1A - 8 for the intubation of a human.
Turning to Fig. 12A, it is seen that the extendable endotracheal tube assembly, designated generally by reference numeral 700, preferably comprises a mounting element (not shown) which is arranged to be removably engaged with an intubator assembly 703 which is preferably similar to incubator assembly I2 (Figs. lA -1 L) or any other incubator assembly described hereinabove but may alternatively be any other suitable intubator assembly. Fixed to or integrally formed with the mounting element is a mouthpiece 704. The extendable entotracheal tube assembly 700 is shown inserted into a patient's oral cavity, similar to the placement shown in Fig.
lA.
Fixedly mounted onto the mounting element is a mounting base 708 onto which is. in turn, mounted; an extendable tube 710, preferably including a coil spring 711 (Fig. 12C), typically formed of metal. Fixedly mounted onto a distal end of e~aendable tube 710 there is preferably provided a forward end member 712, preferably presenting a diagonally cut pointed forward facing tube end surface 714.
Upstream of end surface 714, forward end member 712 is preferably provided with an inflatable and radially outwardly expandable circumferential balloon 716, which receives inflation gas, preferably pressurized air, preferably through a conduit 718 embedded in a wall of forward end member 712 and continuing through tube 710 to a one way valve 719.
It is noted that the extendable endotracheal tube assembly 700, comprising at least one of mounting element, mouthpiece 704, mounting base 708, tube 710, coil spring 711 (Fig. 12C), forward end member 712, end surface 714, circumferential balloon 716, conduit 718 and one way valve 719, may also be integrally formed as a unified structure.
Extending slidably through forward end member 712, tube 710, mounting base 708 and the mounting element is a flexible guide 720, which preferably corresponds in function inter alia to guide 20 in the embodiment of Figs. lA -1L and preferably has mounted at a distal end thereof a tip, which preferably corresponds in structure and function inter alia to the tip 28 in the embodiment of Figs. lA -1L. The tip forms part of a tip sensor, preferably enclosed in guide 720, which preferably corresponds in structure and function inter alia to the tip sensor 11 in the embodiment of Figs. 1 A - 1 L.
As distinct from that described hereinabove with reference to Figs. lA -8, the flexible guide is preferably formed with an inflatable and radially outwardly expandable balloon 722, which receives inflation gas, preferably pressurized air, preferably through a conduit 724 formed in flexible guide 720 and extending therealong, preferably to a source of pressurized inflation gas preferably located within the intubator assembly 703.
The source of pressurized inflation gas may be an automatic inflator/deflator 726. Additionally or alternatively, a one way valve 728 may be provided For manual inflation. The automatic inflatorldeflator 726 may be fixed within intubator assembly 703 or alternatively may be mounted therewithin for motion together with flexible guide 720.
Fig. 12B shows inflation of balloon 722 by means of pressurized air supplied via conduit 724, causing balloon 722 to tightly engage the interior of forward end member 712.
Fig. 12C illustrates extension of tube 710, which is preferably achieved by forward driven movement of flexible guide 720 in tight engagement with forward end member 712, thus pulling forward end member 712 and the distal end of tube forwardly therewith.
Fig. 12D illustrates further extension of tube 710, by forward driven movement of flexible guide 720 in tight engagement with forward end member 712, thus pulling forward end member 712 and the distal end of tube 710 forwardly therewith. This further motion is preferably provided based on the navigation functionality described hereinabove with reference to Figs. lA - 8. It is appreciated that the forward driven movement of cube 710 as described hereinabove with reference to Figs. lA - 8, may be provided by driven forward motion of the flexible guide 720.
Fig. 12E illustrates inflation of balloon 716 by means of pressurized air through conduit 718 and one way valve 719. As will be described hereinbelow, this inflation is employed for sealing the tube 710 within apatient's trachea.
Fig. 12F illustrates deflation of balloon 722 following inflation of balloon 716, corresponding to desired placement and sealing of tube 710 within the patient's trachea. Fig. 12G illustrates removal of the flexible guide 720 from the cube 710.
Appendices 1 to 3 are software listings of the following computer files:
Appendix 1: containing file intumed.asm.
Appendix 2: containing file c8cdr.inc.
Appendix 3: containing file ram.inc.
The method for providing the software functionality of the microprocessor 278, in accordance with a preferred embodiment of the present invention. includes the following steps:
1. Provide an Intel compatible computer with a Pentium II CPU or higher, 128MB RAM, a Super VGA monitor and an available serial port.
2. Install Microsoft Windows 95 or Microsoft Windows 98 Operating System.
3. Install the Testpoint Development kit version 40 available from Capital Equipment Corporation, 900 Middlesex Turnpike, Building 2, Billereca, MA 0821, USA.
4. Connect a flash processor loading device COPBEM Flash, COP8 In Circuit Emulator for Flash Based Families to the serial port of the Intel compatible computer. The COP8EM flash processor loading device is available from National Semiconductors Corp. 2900 Semiconductor Dr., P.O.Box 58090, Santa Clara, CA
95052-8090, USA
Additionally, the navigation subsystem operates to sense that the tip touches the end of the trough beneath the epiglottis. Additionally or alternatively, the navigation subsystem is operative to sense that the tip reaches the tip of the epiglottis. In accordance with another preferred embodiment; the navigation subsystem operates to sense that the tip reached the first cartilage of the trachea. Additionally, the navigation subsystem operates to sense that the tip reached the second cartilage of the trachea.
Additionally or alternatively, the navigation subsystem is operative to sense that the tip reached the third cartilage of the trachea. Preferably, the navigation subsystem operates to load the reference pathway from a memory.
Further in accozdance with a preferred embodiment of the present invention the driving subsystem is operative to push the tube forward.
Still further in accordance with a prefezred embodiment of the present invention the driving subsystem includes a first motor which operates to selectably move the insertable element forward or backward, a second motor which operates to selectably bend the insertable element and electronic circuitry operative to control the first motor, the second motor and the surface following element.
Preferably, the electronic circuitry includes a microprocessor operative to execute a program, the program operative to control the first and second motors and the surface following element and to insert and bend the insertable element inside the living organism along the reference pathway.
Further in accordance with a preferred embodiment of the present invention the driving subsystem is operative to measure the electric current drawn by at least one of the first and second motors to evaluate the position of the surface following element.
Still further in accordance with a preferred embodiment of the present invention the reference pathway is operative to be at least partially prepared before the insertion process is activated. Preferably, the medical insertion device includes a medical imaging system and wherein the medical imaging system is operative to at least partially prepare the reference pathway. Preferably, the medical imaging subsystem includes at least one of an ultrasound scanner, an X-ray imager, a CAT scan system and an MRI system.
Further in accordance with a preferred embodiment of the present invention the medical imaging system operates to prepare the reference pathway by marking at least one contour of at least one organ of the living organism.
In accordance with another preferred embodiment, the medical imaging system operates to prepare the reference pathway by creating an insertion instruction table including at least one insertion instruction. Preferably, the insertion instruction includes instruction to at least one of extend, retract and bend the insertable element.
Further in accordance with a preferred embodiment of the present invention the navigation subsystem is operative to control the driving subsystem based at least partially on a perceived location of the surface following element and according to the insertion instruction table stored in the navigation subsystem.
Additionally in accordance with a preferred embodiment of the present invention the operative medical insertion device operates to at least partially stare a log of a process of insertion of the insertable element. Additionally, the operative medical insertion device transmits the log of a process of insertion of the insertable element.
Further in accordance with a preferred embodiment of the present invention the computer operates to aggregate the logs of a process of insertion of the insertable element. Additionally, the computer prepares the reference pathway based at least partially on the aggregate.
Still further in accordance with a preferred embodiment of the present invention the computer transmits the reference pathway to the medical insertion device.
Further in accordance with a preferred embodiment of the present invention the insertable element includes a guiding element and a guided element.
Additionally, the driving subsystem operates to direct the guiding element and the guided element at least partially together. Additionally or alternatively, the driving subsystem is operative to at least partially automatically direct the guide in a combined motion comprising a longitudinal motion and lateral motion.
In accordance with yet another preferred embodiment, the mouthpiece includes a disposable mouthpiece.
In accordance with still another preferred embodiment of the present invention, the insertable element is extendable. In accordance with yet another preferred embodiment, the insertable element includes a mounting element which is arranged to be removably engaged with an intubator assembly and an extendable tube operatively associated with the mounting element. Preferably, the extendable tube is arranged to be pulled by a flexible guide operated by the intubator assembly.
In accordance with yet another preferred embodiment of the present invention, the extendable cube includes a coil spring. Additionally or alternatively, the extendable tube also includes a forward end member, on a distal end thereof.
Preferably, the forward end member includes a diagonally cut pointed forward facing tube end surface. Additionally or alternatively, the medical insertion device also includes a forward end member mounted inflatable and radially outwardly expandable circumferential balloon.
Preferably, the forward end member mounted inflatable and radially outwardly expandable circumferential balloon receives inflation gas through a conduit formed in a wall of the forward end member and continuing through the tube to a one way valve.
In accordance with another preferred embodiment, the medical insertion device also includes a flexible guide having mounted at a distal end thereof a tip sensor.
Preferably, the flexible guide is formed with an inflatable and radially outwardly expandable guide mounted balloon. Additionally, the inflatable and radially outwardly expandable guide mounted balloon receives inflation gas through a conduit formed in the flexible guide and extending therealong. Preferably, the conduit is connected to a source of pressurized inflation gas. Additionally or alternatively, the source of pressurized inflation gas is located within the intubator assembly.
Preferably, the inflation gas comprises pressurized air.
It is appreciated that the distances and angles referenced in the specification and claims are typical values and should not be construed in any way as limiting values.
BRIEF DESCRIPTION OF THE DRAWINGS AND APPENDICES
The present invention will be understood and appreciated more fully from the following detailed description, taken in conjunction with the drawings and appendices in which:
Figs. lA to 1L are a series of simplified pictorial illustrations of a process of employing a preferred embodiment of the present invention for the intubation of a human;
Figs. ZA to 2F taken together are a flowchart illustrating a preferred implementation of the present invention, operative for an intubation process as shown in Figs. 1 A to 1 L;
Fig. 3 is a simplified illustration of the internal structure of a preferred embodiment of the present invention for intubation of a human;
Fig. 4 is a simplified block diagram of a preferred embodiment of the present invention;
Figs. SA to SH are electrical schematics of a preferred embodiment of the present invention for incubation of a human;
Figs. 6A to 6K are a series of simplified pictorial illustrations of a process of employing a preferred embodiment of the present invention for insertion of an element into the intestine of a human;
Fig. 7 is a preferred embodiment of a table comprising instruction, operative in accordance with a preferred embodiment of the present invention, for insertion of an element into the intestine of a human as shown in Figs. SA to SK;
Fig. 8 is a flowchart illustrating a preferred implementation of the present invention, operative for a process of insertion of an element into the intestine of a human as shown in Figs. 6A to 6K;
Figs. 9A to 9F are a series of simplified pictorial illustrations of an extendable endotracheal tube assembly constructed and operative in accordance with a preferred embodiment of the present invention in various operative orientations;
Figs. l0A to lOG are a series of simplified pictorial illustrations of the extendable endotracheal tube assembly of Figs. 9A - 9F employed with the medical insertion device of Figs. lA - 8 for the intubation of a human;
a Figs. 11A to 11F are a series of simplified pictorial illustrations of an extendable endotracheal tube assembly constructed and operative in accordance with another preferred embodiment of the present invention in various operative orientations;
and Figs. 12A to 12G are a series of simplified pictorial illustrations of the extendable endotracheal tube assembly of Figs. 9A - 9F employed with the medical insertion device of Figs. lA - 8 for the intubation of a human.
LIST OF APPENDICES
Appendices 1 to 3 are computer listings which, taken together, form a preferred software embodiment of the present invention.
DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS
Reference is now made to Figs. lA to 1L, which are a series of simplified pictorial illustrations of a system and methodology for the incubation of a human in accordance with a preferred embodiment of the present invention.
It is appreciated that the general configuration of the mouth and trachea is generally the same for all humans except for differences in scale, such as between an infant, a child and an adult. In a preferred implementation of the present invention, a standard contour map 10 of the human mouth and trachea is employed. The scale of the map 10 may be further precisely adapted to the specific patient, preferably automatically. Alternatively. the scale of the map 10 is adapted to the specific patient semi-automatically. In this alternative the operator can select the scale of the map 10, for example by selecting between a child and an adult. Thereafter the scale of the map is automatically adapted to size of the specific patient as a part of the intubation process. As a further alternative or in addition the operator is enabled to designate one or more typical impediments such as: a tumor, a swelling, an infection and an injury.
Selecting an impediment preferably creates a suitable variation of the general map 10.
Fig. lA shows the map 10 and the location therein where a tip sensor 11 of an intubator engages the mouth and trachea of the patient. It is a particular feature of the present invention that intubation is at least partially automatically effected by utilizing the contour map 10 to monitor the progress of tip sensor 11 and thus to navigate the intubator accordingly.
As seen in Fig. 1 A, an intubator assembly 12, suitable for the intubation of a human, is partially inserted into an oral cavity of a patient. The intubator assembly 12 preferably comprises a housing 14 in which is disposed a guide driver 15, a mouthpiece 16, a cube 18 inserted through the mouthpiece 16, a flexible guide inserted through the tube 18, and tip sensor 11 mounted at the distal end of the guide 20.
The mouthpiece 16 preferably comprises a rigid curved pipe 24 through which the tube 18 is inserted. Preferably the curved pipe 24 comprises a slit 49 on each side.
Alternatively, the curved pipe 24 is eliminated.
It is appreciated that some of the components comprising the intubator assembly 12 may be disposable, for example, the tube 18 and the mouthpiece 16.
The guide driver 15 is operative to move the guide 20 in and out of the housing 14, through the curved pipe 24 and through the tube 18. The guide driver 15 is also operative to selectably bend the distal end of the guide 20 clockwise and counterclockwise in the plane of the curvature of the curved pipe 24 in the sense of Fig.
I A.
Referring now to an enlargement of the tip sensor 11, it is seen that tip sensor l l preferably comprises a tip 28 preferably integrally formed at one end of a short rod 30 having a magnet 32 on its other end. The rod 30 preferably extends thraugh the center of a spring disk 34 and is firmly connected thereto. The spring disk 34 is preferably mounted on one end of a cylinder 36 whose other end is mounted on the distal end of the guide 20. Preferably, the tip sensor 11 also comprises two Hall effect sensors, 38 and 40, which are mounted inside the cylinder 36 on a support 41 and in close proximity to the magnet 32. The Hall effect sensors 38 and 40 are preferably spaced in the plane of the curvature of the curved pipe 24. Typically, each Hall effect sensor has electrical terminals operative to provide electric current representing the distance of the magnet 32 therefrom.
When a force is exerted on the tip 28 along the axis of symmetry 42 of cylinder 36, the tip 28 is pushed against the spring disk 34, causing the magnet 32 to approach the Hall effect sensors 38 and 40. Since the distance between the magnet 32 and each of the Hall effect sensors 38 and 40 decreases, both Hall effect sensors 38 and 40 produce an increase in their output electric current. When a force is exerted on the tip 28 sideways in the plane of the Hall effect sensors 38 and 40, the tip 28 rotates around the location where the rod 30 engages the spring disk 34, as is shown in Fig.
lA. This causes the magnet 32 to rotate away from the Hall effect sensor 40 and closer to the Hall effect sensor 38. The output electric current of the Hall effect sensor 40 typically decreases and the output electric current of the Hall effect sensor 38 typically correspondingly increases. Thus, it may be appreciated that the tip sensor 11 enables electronic circuitry (not shown) to measure the amplitude and the direction of force exerted on the tip 28 in the plane of the Hall effect sensors 38 and 40 and to compute the orientation of a surface of a tissue against which the sensor tip 28 is depressed, relative to the axis of symmetry 42.
It is appreciated that sensors other than Hall effect sensors can be used to measure the direction and the amplitude of the force exerted on the tip 28, or otherwise to measure the proximity and the orientation of the adjacent surface.
During automatic operation of the system, following partial insertion of the intubator assembly 12 into the oral cavity, as shown in Fig. lA, the guide driver 15 typically causes the guide 20 to extend in the direction of the trachea 44 and bends the guide 20 clockwise until the tip 28 engages a surface of the tongue 46. This engagement applies a Force to tip 28, which causes the tip to rotate counterclockwise wherein the magnet 32 approaches the Hall effect sensor 38. Electronic circuitry (not shown) inside the housing 14, which measures the changes in the electrical outputs produced by the Hall effect sensors 38 and 40, indicates that the tip 28 is bent clockwise.
By sensing the position of the tip and employing the past history of tip positions, the system of the present invention determines the location of the tip sensor 1 I in the oral cavity and relative to the map 10. This location is employed in order to navigate the intubator correctly, as described hereinbelow.
Reference is now made to Fig. 1B, which illustrates a further step in the intubation in accordance with the present invention. Fig. 1B shows the guide extended further and reaching an area between the base of the tongue 46 and the epiglottis 48 of the patient.
As seen in Fig. 1C, the guide 20 extends further forward until the tip 28 touches the end of the trough beneath the epiglottis 48.
As seen in Fig. 1D, the guide 20 bends counterclockwise and touches the bottom surface of the epiglottis 48. Then the guide 20 retracts a little, while preserving continuous tactile contact between the tip 28 with the bottom surface of the epiglottis 48.
As seen in Fig. lE, the guide 20 retracts further until the tip 28 of the tip sensor 11 reaches the tip 165 of the epiglottis 48 and then the tip 28 loses tactile contact with the surface of the tip 165 of the epiglottis 48.
As seen in Fig. 1F, the guide 20 bends further counterclockwise, then extends forward and then bends clockwise until the tip 28 touches the upper surface of the epiglottis 48.
1z As seen in Fig. 1G, the guide 20 extends forward, preserving continuous tactile contact with the epiglottis 48, until the tip 28 senses the first trough of the trachea 44.
As seen in Figs. 1H and lI, the guide 20 extends furkher forward until the tip 28 senses the second trough of the trachea 44.
As seen in Figs. 1J and 1K, the guide 20 extends further forward until the tip 28 senses the trough of the third cartilage of the trachea 44. Then the guide 20 further ettends, typically for adults by 5 centimeters, to ensure that the tube 16 reaches to the third cartilage.
As seen in Fig. 1 L, the guide driver 15 is pulled out with the guide 20 leaving the mouthpiece 16 and the tube 18 inside the patient's mouth and trachea 44.
Reference is now made to Figs. 2A to 2F, which, taken together, are a flowchart of the process of the intubation of a human shown in Figs. lA to 1K.
Fig. 2A and 2B, taken together, correspond to the step of the intubation process shown in Fig. lA.
In step 100 of Fig. 2A the intubator assembly 12 is set to perform intubation.
In step 102 the incubator loads an incubation pattern map 10 from its memory.
In steps 104, 106 and 108 the intubator enables the operator to set the scale of the incubation pattern map to the corresponding size of the patient by selecting between an infant, a child and an adult.
In steps 110, 112 and 114 the incubator enables the operator to adapt the intubation pattern map 10 to a type of incubation impediment, preferably by selecting from a menu. As seen in Fig. 2A the menu typically provides the operator with four optional impediments: an infection, a swelling, a tumor and an injury, and a fifth option not to select any impediment. It is appreciated that various types of impediments can be defined as is typical for a specific organ.
As seen in Fig. 2B, steps 120, 122, 124, 126, 128 and 130 cause the guide 20 to extend in the direction of the throat and simultaneously bend clockwise until the tip sensor is depressed against the surface of the tongue or until extension and bending limits are reached. As seen in step 128, the bending limit is preferably 50 degrees and the eltension limit is preferably 2 centimeters. If the tip sensor is depressed, the scale of the incubation pattern map 10 is preferably updated (step 132) to match the particular scale or size of the intubated patient. If at least one of the extension limit and the bending limit is reached an error message is displayed (step 134) and the intubation process is stopped.
Reference is now made to Fig. 2C, which corresponds to Figs. 1B and 1 C. As illustrated in Fig. 2C, the guide driver 15 performs sequential steps 140, 142, I44 and 146 in a loop, eltending (step 140) guide 20 further into the patient's throat and along the throat surface, following the intubation pattern map 10 and keeping the tip in contact with the surface (steps I44, 146). When the output electric currents from both Hall effect sensors 38 and 40 increase, the intubator assumes (step 142) that the tip 28 has reached the end of the trough beneath the epiglottis 48. The point of engagement between the tip 28 and the body is designated in Fig. 1C by reference numeral 147. The scale of the intubation pattern map 10 is then preferably updated to match the patient's organ structure (step 148).
Reference is now made to Fig. 2D, which corresponds to Figs. 1D and 1 E. As seen in Fig. 2D the guide driver 15 performs steps 150, 152 and 154 in a loop, bending the distal end of the guide 20 counterclockwise until the tip 28 touches the epiglottis 48, or until a bending limit, preferably of 45 degrees is reached (step 154) and the intubation stops (step 156), The preferred point of engagement between the tip 28 and the surface of the epiglottis is designated in Fig. 1D by reference numeral 155.
After sensing an engagement between the tip 28 and the surface of the epiglottis, the guide driver 15 performs steps 158, 160, 162, and 164 in a loop, retracting the guide 20 further (step 158), and increasing the bending of the guide 20 (step 164), until the tip of the guide reaches the tip of the epiglottis 48, designated in Fig. lE by reference numeral 165. When the tip 28 reaches the tip of the epiglottis 48, the tip 28 is released and the output electric currents from both Hall effect sensors decrease to a minimum.
Preferably the intubation pattern map 10 is updated (step 166) to match the patient's organ structure.
Reference is now made to Fig. 2E, which corresponds to Figs. lE and 1F.
As seen in Fig. 2E, the guide driver 15 causes the guide 20 to move above and around the tip of the epiglottis 48 by causing the guide 20 to bend counterclockwise, preferably by 45 degrees, then to move forward down the throat by 5 millimeters and then to bend clockwise, preferably by 10 degrees (Step 170), Then the guide driver 15 performs steps 172, 174 and 176 in a loop, bending and extending (step 174) until the tip 28 of the guide touches the upper surface of the epiglottis 48 or until an extension limit, preferably of 1 centimeter, or a bending limit, preferably of 50 degrees, is reached, and the intubation is stopped (step 178). A preferred point of engagement between the tip 28 and the epiglottis is designated in Fig. 1F by reference numeral 177.
Reference is now made to Fig. 2F, which corresponds to Figs. 1G to 1K.
As seen in Fig. 2F, a ''cartilage crest counter N" is first zeroed (step 180).
Then the guide driver 15, performing steps 182 to 198 in a loop, causes the guide 20 to move the sensor tip 11 forward (step 182) along the surface of the trachea 44, preserving contact between the tip 28 and the surface of the trachea (steps 186 and 188) by increasing the bend (step 188) as needed. Each time a crest (189 in Figs, 1H, lI, 1J) of a cartilage of the trachea 44 is located the "cartilage crest counter" is incremented (step 190), the tip 28 is moved about the crest (steps I92, 194, 196 and 198) and the loop process repeats until the third cartilage is located. Then the guide 20 further extends, typically for adults by 5 centimeters, to ensure that the tube 16 reaches to the third cartilage.
The guide driver 15 then signals to the operator that the insertion is completed successfully (step 200).
Reference is now made to Fig. 3, which is a simplified illustration of the internal structure of a preferred embodiment of the present invention useful for intubation of a human. The intubator assembly 12 preferably comprises the housing 14, the guide driver 15, the mouthpiece 16, the tube 18, the flexible guide 20 inserted inside the tube 18 and the tip sensor 11 mounted at the distal end of the guide 20.
Preferably the mouthpiece comprises a curved pipe 24.
Preferably, the guide driver 15 comprises a first motor 210 that drives a gearbox 212 that rotates a threaded rod 214. A floating nut 216 is mounted on the threaded rod 214. As the motor 210 rotates the threaded rod 214, the floating nut 216 is moved forward or backward according to the direction of the rotation. The floating nut 216 is operative to move a carriage 218 along a bar 220 and thus to push or pull the guide 20. When the carriage 218 touches a stopper 222 the stopper 222 moves with the carriage 218 along the bar 220 and pushes the tube 18 forward.
A second motor 224 is connected to a disk 226 to which two guide angulation wires 228 are attached at first end thereof. The guide angulation wires 228 are threaded inside the guide 20 and their other ends are connected to the distal end of the guide .just short of the tip sensor 11. When the motor 224 rotates the disk 226 clockwise one of the wires 228 is pulled and the second wire is loosened. The wire that is pulled pulls and bends the distal end of the guide 20 counterclockwise in the sense of Fig. 3. Accordingly, when the motor 224 rotates counter-clockwise the second wire of the rivo wires 228 is pulled and the first wire is loosened. The wire that is pulled pulls and bends the distal end of the guide 20 clockwise in the sense of Fig. 3.
Electronic circuitry 229 is provided within the housing 14 and is preferably electrically connected to operating switches 230, a display 232, the motors 210 and 224 and to the Hall effect sensors 38 and 40 (Fig. lA) in the tip sensor 11.
Preferably, the electronic circuitry 229 also comprises a microprocessor, operative to execute a program. The program is preferably adapted to control the switches 230, the display 232, motors 210 and 224 and the Hall effect sensors 38 and 40 and to insert and bend the guide inside a living organism, according to a predefined map until the tip of the guide reaches a destination point inside the living organism. Preferably the program is operative to cause the tip 28 of the guide 20 to follow a predefined internal contour of an organ of the living organism. Preferably program is operative employ tactile sensing to measure the position of the tip of the guide relative to the surface organ of the living organism.
It is appreciated that the term "microprocessor" also includes inter alia a ''microcontroller".
Electrical batteries (not shown) are preferably provided within the housing 14 to supply electric power to the electronic circuitry, the tip sensor 11, the motors 210 and 224, the display 232 and all other elements of the present invention that consume electricifiy. It is appreciated that external sources of electricity can also be employed to provide power to the intubator assembly 12.
Communication interface (not shown), preferably employing infra-red communication technology, is provided to enable communication with external data processing equipment.
Preferably, a balloon 234 is provided at the distal end of the tube 18 and a thin pipe (not shown) is inserted through the pipe 18 and is connected, through the side of the pipe, to the balloon. The thin pipe enables an operator to inflate the balloon when the distal end of the pipe 18 reaches the appropriate place in the trachea, thus securing the distal end of the pipe to the trachea.
Reference is now made to Fig. 4, which is a simplified functional block diagram of a preferred embodiment of the guide driver 15 described hereinabove. In Fig. 4 the guide 20 is driven by two drivers. A longitudinal driver 240 preferably comprises a motor 210, the gear 212, the threaded rod 214, the floating nut 146 and the carriage 218 of Fig. 3. A bending guide driver 242 preferably comprises the motor 224, the disk 226 and wires 228 (Fig. 3). The longitudinal driver 240 and the bending guide driver 242 are controlled by two software driver modules. A longitudinal software driver module 244 controls the longitudinal driver 240 and comprises two functions: an extend function 246 and a retract function 248. A bending software driver 250 controls the bending guide driver 242 and comprises two functions: a bend counterclockwise function 252 and a bend clockwise function 254. The functions 246, 248, 252 and 254 are operated by a propagation control software module 256.
At the other end of the guide 20, the tip sensor 11 measures the proximity and orientation of an adjacent surface. In a preferred embodiment of the present invention the tip sensor 11 performs the proximity and orientation measurements by measuring the force applied to a tactile tip by a surface of an adjacent tissue. A tip sensor software driver module 260, operative to receive input signals from the tip sensor 11, provides two input functions: a counterclockwise tip rotation function 262 and a clockwise tip rotation function 264. The measurements of the tip positions as provided by the tip sensor software driver module 260 are collected and stored by a sensor log module 266.
The map 10 is loaded into memory and serves as an updatable map 268.
A comparator 270 compares the accumulated measurements from the tip sensor 11 with the updated reference map 268. The results of the comparisons are calculated by an update scale module 272 to provide a scaling factor that is applied to update the updated map 268. Consequently a navigation module 274 employs the updated map information to instruct the propagation control 256 to execute the next step of the insertion program.
It is appreciated that a measurement of the electric current drawn by at least one of the longitudinal guide drive and the bending guide drive can also serve as an input to the comparator 270 to evaluate the position of the tip sensor.
Reference is now made to Figs. SA to SH, which are, taken together, an electrical schematic of a preferred embodiment of the present invention useful for intubation of a human. Reference is especially made to microprocessor 278, which is preferably operative to operate a program to control the elements of the intubator assembly 12, such as the operating switches 230, the display 232, the motors 210 and 224 (Fig. 3), and the Hall effect sensors 38 and 40 in the tip sensor 11 (Fig.
lA), and to perform the incubation process, such as the process shown and described hereinabove with reference to Figs. 2A to 2F.
Reference is now made to Figs. 6A to 6K, which are a series of simplified pictorial illustrations of ten typical steps in a process of employing a preferred embodiment of the present invention useful for insertion of an element into the intestine of a human.
It is appreciated that some of the organ systems of a living organism are generally similar up to a scale factor, such as the mouth and trachea system.
Other organs, such as the intestine system, are generally different from one human body to the other. Therefore, in order to employ the present invention to insert a medical device or apply a medicine to a specific location within a generally variable organ, a map of the organ, at least from the entry point and until the required location, is prepared before the insertion process is activated. The required map is preferably prepared by employing an appropriate medical imaging system, such as an ultrasound scanner, an x-ray imager, a CAT scan system or a MRI system. The map can be a two dimensional map or a three-diinensional map as appropriate for the specific organ. Typically for the intestine system a three dimensional map is required.
It is appreciated that an inserter according to a preferred embodiment of the present invention for use in organs that are variable in three dimensions is similar to the incubator assembly 12, preferably with the following modifications:
(1) The tube 18 may be replaced with a different insertable device;
(2) An additional guide bending system employing elements similar to motor 222, disk 224 and wires 226 is added and mounted perpendicularly to the first system of motor 222, disk 224 and wires 26, so that it is possible to bend the end of the guide in three dimensions. It is appreciated that three-dimensional manipulation is possible also by employing three or more motors; and (3) The tip sensor 11 preferably comprises four Hall effect sensors to sense the motion of the tip 28 in three dimensions. It is appreciated that it is possible to operate the tip sensor in a three-dimensional space also by employing three Hall effect sensors. It is also appreciated that other types of sensors can be employed to measure the proximity and orientation of an adjacent surface in three dimensions.
In a preferred embodiment of the present invention, when the guide 20 performs longitudinal motion, such as insertion or retraction, the guide 20 also performs a small and relatively fast lateral motion. The combined longitudinal and lateral motions are useful for sensing the surface of the organ in three dimensions and hence to better determine the location of the tip sensor 11 in the organ and relative to the map 10.
Due to limitations of the graphical representation, a two-dimensional imaging and map is shown in Figs. 6A to 6K.
As seen in Fig. 6A, a human organ, the intestine in this example, is imaged, typically by a CAT scan system 280, and an image 282 of the internal structure of the organ is produced.
In Fig. 6B the image 282 of the organ is used to create an insertion map 284. Typically the image 282 is displayed on a computer screen (not shown) and a pointing device, such as a computer mouse or a light pen, is used to draw a preferred path 286 that the tip of the guide is to follow. The path is typically drawn by marking a contour of the organ, and optionally marking the guide bending points, as is shown and described with reference to Figs. lA to 1 K. Alternatively, a preferred path is created, such as path 286, not necessarily continuously following the contours of the organ. As a further alternative, the map 10 or the path 286 is converted into a set of insertion steps as is shown and described hereinbelow with reference to Fig. 7.
Reference is no4v made to Fig. 7 together with Fig. 8 and with Figs. 6C to 6K. As shown in Fig. 7, a table 290 is provided for storage in a computer memory and for processing by a computer processor. The table 290 contains rows 292, wherein each row 292, preferably comprises an instruction to perform one step in the process of insertion of a medical insertion device into a living organism such as shown and described with reference to Figs. 6C to 6K. Preferably each row 292 contains the expected values or the maximal values for the extension of an insertion guide such as guide 20, the bending of the insertion guide and the electrical outputs from the Hall effect sensors 38 and 40 (Fig. lA). In a preferred embodiment of the present invention the row 292 contains five sets of values:
(a) Initial bend 294 contains two values for bending the guide from a straight position, in two perpendicular planes.
(b) Initial insertion 295 contains a longitudinal value for extending or retracting the guide in centimeters.
(c) Initial sensor measurements 296 contains expected output values of four sensors such as four Hall effect sensors, for example, Hall effect sensors 38 and 40 of Fig. lA. The initial sensors measurements 296 are expected to be measured by the time the guide reaches the value of the initial insertion 295.
(d) Insert distance 297 contains a longitudinal value for further extending or retracting the guide in centimeters. Typically the initial sensor measurements 296 are expected to be preserved, while the guide is extended or retracted, by adapting the bending of the guide.
(e) Final sensor measurements 298 contain expected output values of the four sensors of step (c). The initial sensor measurements 298 are expected to be measured by the time the guide reaches the value of the insert distance 297.
It is appreciated that the path drawn in Fig. 6B can be employed to prepare a table of instructions, such as table 290 of Fig. 7.
Referring to Fig. 8, which is a flowchart illustrating a preferred implementation of the present invention, operative for a process of insertion of an element into the intestine of a human as shown in Figs. 6A to 6K. The flowchart of Fig.
8 is a preferred embodiment of a program, operative to be executed by a processor, such as microprocessor 278 of Fig. 5A, comprised in a preferred embodiment of the present invention, for insertion of an element into a living organism, preferably by employing a table 290 shown and described with reference to Fig. 7.
The preferred flowchart shown in Fig. 8 starts by loading the table (step 300) such as the map shown in Fig. 7. The program then reads a first row 292 from the map (step 302) and causes the distal end of the guide 20 to bend according to the initial bending values 294. Then the program causes the guide 20 to extend or retract according to the initial insertion distance 295 of the first row in the map.
The program continues to bend and insert the guide 20 until output values of the sensors match the expected initial sensor measurement 296 of the row (steps 304, 306 and 308), or until a limit is surpassed, an error message is displayed and the program is stopped (step 310).
Preferably, the initial values of the sensors are measured and then the program continues to extend or retract the guide 20 (step 312) until the sensors produce the final sensors measurements 298 values (step 314), while keeping in contact with the surface (steps 316 and 318) or until at least one of predefined limits is surpassed (step 320) where the program is stopped (step 310). If the final sensor measurements values are measured the program proceeds to step 320 and Ioops through steps 302 and 320 until all the rows 292 of the table are processed. Then the program displays an insertion success message on the display 232 and halts (step 322).
As indicated by row No. 1 of Fig. 7 and Fig. 6C the guide is bent, preferably by up to 45 degrees, to the Ieft in the plane of Fig. 6C and, while preserving contact with the left side of the intestine, is extended up to 5 centimeters or until the sensor tip engages the internal surface of the intestine head on at a point in the map 284 designated by reference numeral 330.
As indicated by row No.2 of Fig. 7 and Fig. 6D the guide is bent by up to 45 degrees to the right in the plane of Fig. 6D and, while preserving contact with the left side of the intestine, is extended up to 2.5 centimeters or until the sensor tip does not sense the internal surface of the intestine at a point in the map 284 designated by reference numeral 332.
As indicated by row No.3 of Fig. 7 and Fig. 6E the guide is bent by up to 110 degrees to the left in the plane of Fig. 6E and, while preserving contact with the left side of the intestine, is extended by 1 centimeter to a point in the map 284 designated by reference numeral 334.
In accordance with row 4 of Fig. 7 and Fig. 6F the guide is bent by up to 45 degrees to the right in the plane of Fig. 6F and is extended by 6 centimeter to a point in the map 284 designated by reference numeral 336.
As indicated by row No.S of Fig. 7 and Fig. 6G the guide is bent by up to 20 degrees to the right in the plane of Fig. 5G and, while preserving contact with the right side of the intestine, is extended by 4 centimeters to a point in the map 284 designated by reference numeral 338.
As indicated by row No.6 of Fig. 7 and Fig. 6H the guide is bent by up to -60 degrees to the left in the plane of Fig. 6H and is extended by up to 3 centimeters or until the sensor tip engages the internal surface of the intestine head on at a point in the map 284 designated by reference numeral 340.
As indicated by row No.7 of Fig. 7 and Fig. 6I the guide is bent by up to 45 degrees to the right in the plane of Fig. 6I and is extended by up to 1 centimeter or until the sensor tip engages the internal surface of the intestine with its right side in a point in the map 284 designated by reference numeral 342.
As indicated by row No.8 of Fig. 7 and Fig. 6J the guide is extended by up to 1 centimeters or until the sensor tip engages the internal surface of the intestine with its left side at a point in the map 284 designated by reference numeral 344.
As indicated by row No.9 of Fig. 7 and Fig. 6K the guide is bent by up to 45 degrees to the right in the plane of Fig. 6K and is extended by up to 1 centimeter or until the sensor tip engages the internal surface of the intestine head on at a point in the map 284 designated by reference numeral 346.
In a preferred embodiment of the present invention the system and the method are operative for automatic operation. Alternatively the present invention can be operated manually, by providing to the operator the information collected by the sensor log 266 form the tip sensor 11 and enabling the operator to control manually the guide 20. In another alternative part of the procedure is performed automatically and another part is performed manually. For example, the guide 20 may be inserted automatically and a medical device, such as the tube 18 may be inserted manually.
It is appreciated that a log of the process of insertion of an insertable element into a living organism such as a human body is preferably stored in an internal memory of the present invention and that this log can be transmitted to a host computer.
It is appreciated that the host computer can aggregate insertion process logs and thereby continuously improve relevant insertion pattern maps such as the standard contour map 10. Thereafter, from time to time or before starting an insertion process, the present invention is capable of loading an updated map such as standard contour map 10.
It is also appreciated that the accumulated logs of processes of insertions can be employed to improve the algorithm for processing the maps, such as the algorithms shown and described with reference to Figs. 2A - 2F and Fig. 8. The improved algorithm can be transmitted to the present invention as necessary.
Reference is now made to Figs. 9A to 9F, which are a series of simplified pictorial illustrations of an extendable endotracheal tube assembly constructed and operative in accordance with a preferred embodiment of the present invention, in various operative orientations.
Turning to Fig. 9A, it is seen that the extendable endotracheal tube assembly, designated generally by reference numeral 400, preferably comprises a mounting element 402 which is arranged to be removably engaged with an incubator assembly (not shown) such as intubator assembly 12 (Figs. lA - 1L). Fixed to or integrally formed with mounting element 402 is a mouthpiece 404, which is preferably integrally formed with a rigid curved pipe 406. Fixedly mounted onto mounting element 402, interiorly of rigid curved pipe 406, is a mounting base 408 onto which is, in turn, mounted, an extendable tube 410, preferably including a coil spring 411, typically formed of metal. Fixedly mounted onto a distal end of extendable tube 410 there is preferably provided a forward end member 412, preferably presenting a diagonally cut pointed forward facing tube end surface 414.
Upstream of end surface 414, forward end member 412 is preferably provided with an inflatable and radially outwardly expandable circumferential balloon 416, which receives inflation gas, preferably pressurized air, preferably through a conduit 418 embedded in a wall of forward end member 412 and continuing through tube 410 to a one way valve 419.
It is noted that the extendable endotracheal tube assembly 400 may comprise an integrally formed mouthpiece assembly and an integrally formed insertable extendable tube assembly. The integrally formed mouthpiece assembly may comprise the mouthpiece 404 and the rigid curved pipe 406. The integrally formed extendable tube assembly may comprise the extendable tube 410, the mounting element 402, the mounting base 408, the coil spring 411, the forward end member 412 with the end surface 414 and the circumferential balloon 416, the conduit 418 and the one way valve 419.
Extending slidably through forward end member 412, tube 410, mounting base 408 and mounting element 402 is a flexible guide 420, which preferably corresponds in function inter alia to guide 20 in the embodiment of Figs. lA -1L and preferably has mounted at a distal end thereof a tip 421, which preferably corresponds in structure and function inter alia to the tip 28 in the embodiment of Figs.
lA - 1L. Tip 421 forms part of a tip sensor, preferably enclosed in guide 420, which preferably corresponds in structure and function inter alia to the tip sensor 11 in the embodiment of Figs. lA - 1L.
As distinct from that described hereinabove with reference to Figs. lA -8. the flexible guide is preferably formed with an inflatable and radially outwardly expandable balloon 422, which receives inflation gas, preferably pressurized air, preferably through a conduit 424 formed in flexible guide 420 and extending therealong, preferably to a source of pressurized inflation gas, preferably located within the incubator assembly (not shown).
Fig. 9B shows inflation of balloon 422 by means of pressurized air supplied via conduit 424, causing balloon 422 to tightly engage the interior of forward end member 412.
Fig. 9C illustrates extension of tube 410, which is preferably achieved by forward driven movement of flexible guide 420 in tight engagement with forward end member 412, thus pulling forward end member 412 and the distal end of tube 410 forwardly therewith.
Fig. 9D illustrates inflation of balloon 416 by means of pressurized air through one way valve 419 and conduit 418. As will be described hereinbelow, this inflation is employed for sealing the tube 410 within a patient's trachea.
Fig. 9E illustrates deflation of balloon 422 following inflation of balloon 416, corresponding to desired placement and sealing of tube 410 within the patient's trachea. Fig. 9F illustrates removal of the flexible guide 420 from the tube 410.
Reference is now made to Figs. l0A to lOG, which are a series of simplified pictorial illustrations of the extendable endotracheal cube assembly of Figs.
9A - 9F employed with the medical insertion device of Figs. lA - 8 for the intubation of a human.
Turning to Fig. 10A, it is seen that the extendable endotracheal cube assembly, designated generally by reference numeral 500, preferably comprises a mounting element (not shown) which is arranged to be removably engaged with an intubator assembly 503 which is preferably similar to intubator assembly 12 (Figs. lA -1 L) or any other incubator assembly described hereinabove but may alternatively be any other suitable intubator assembly. Fixed to or integrally formed with the mounting element is a mouthpiece 504, which is preferably integrally formed with a rigid curved pipe 506. The extendable entotracheal tube assembly 500 is shown inserted into a patient's oral cavity, similar to the placement shown in Fig. lA.
Fixedly mounted onto the mounting element, interiorly of rigid curved pipe 506, is a mounting base 508 onto which is, in turn, mounted, an extendable tube 510, preferably including a coil spring 511 (Fig. lOC), typically formed of metal.
Fixedly mounted onto a distal end of extendable tube 510 there is preferably provided a forward end member 512, preferably presenting a diagonally cut pointed forward facing tube end surface 514.
Upstream of end surface 514, forward end member 512 is preferably provided with an inflatable and radially outwardly expandable circumferential balloon 516, which receives inflation gas, preferably pressurized air, preferably through a conduit 518 embedded in a wall of forward end member 512 and continuing through tube 510 to a one way valve 519.
It is noted that the extendable endotracheal tube assembly 500 may comprise a mouthpiece assembly and an extendable tube assembly, which is inserted therein. The mouthpiece assembly comprises the mouthpiece 504, which is integrally formed with the rigid curved pipe 506. The extendable tube assembly comprises the extendable tube 510, which is integrally formed together with the mounting element, the mounting base 508, the coil spring 511, the forward end member 512 with the end surface 514 and the circumferential balloon 516, the conduit 518 and the one way valve 519.
Extending slidably through forward end member 512, tube 510, mounting base 508 and the mounting element is a flexible guide 520, which preferably corresponds in function inter alts to guide 20 in the embodiment of Figs. lA -1L and preferably has mounted at a distal end thereof a tip, which preferably corresponds in structure and function inter alts to the tip 28 in the embodiment of Figs. lA -1L. The tip forms part of a tip sensor, preferably enclosed in guide 520, which preferably corresponds in structure and function inter alia to the tip sensor 11 in the embodiment of Figs. 1 A - 1 L.
As distinct from that described hereinabove with reference to Figs. lA -8, the flexible guide is preferably formed with an inflatable and radially outwardly expandable balloon 522, which receives inflation gas, preferably pressurized air, preferably through a conduit 524 formed in flexible guide 520 and extending therealong, preferably to a source of pressurized inflation gas preferably located within the intubator assembly 503.
The source of pressurized inflation gas may be an automatic inflatorldeflator 526. Additionally or alternatively, a one way valve 528 may be provided for manual inflation. The automatic inflator/deflator 526 may be fixed within intubator assembly 503 or alternatively may be mounted therewithin for motion together with flexible guide 520.
Fig. lOB shows inflation of balloon 522 by means of pressurized air supplied via conduit 524, causing balloon 522 to tightly engage the interior of forward end member 512.
Fig. 10C illustrates extension of tube 510, which is preferably achieved by forward driven movement of flexible guide 520 in tight engagement with forward end member 512, thus pulling forward end member S I2 and the distal end of tube 510 forwardly therewith.
Fig. 10D illustrates further extension of tube 510, by forward driven movement of flexible guide 520 in tight engagement with forward end member 512, thus pulling forward end member 512 and the distal end of tube 510 forwaxdly therewith. This further motion is preferably provided based on the navigation functionality described hereinabove with reference to Figs. lA - 8. It is appreciated that the forward driven movement of tube 510 as described hereinabove with reference to Figs. lA - 8, may be provided by driven forward motion of the flexible guide 520.
Fig. l0E illustrates inflation of balloon 516 by means of pressurized air through conduit 518 and one way valve 519. As will be described hereinbelow, this inflation is employed for sealing the tube 510 within a patient's trachea.
Fig, lOF illustrates deflation of balloon 522 following inflation of balloon 516, corresponding to desired placement and sealing of tube 510 within the patient's trachea. Fig. lOG illustrates removal of the flexible guide 520 from the tube 510.
Reference is now made to Figs. 11A to 11F, which are a series of simplified pictorial illustrations of an extendable endotracheal tube assembly constructed and operative in accordance with another preferred embodiment of the present invention in various operative orientations.
Turning to Fig. 11A, it is seen that the extendable endotracheal tube assembly, designated generally by reference numeral 600, preferably comprises a mounting element 602 which is arranged to be removably engaged with an intubator assembly (not shown) such as intubator assembly 12 (Figs. lA - 1L). Fixed to or integrally formed with mounting element 602 is a mouthpiece 604.
Fixedly mounted onto mounting element 602 is a mounting base 608 onto which is, in turn, mounted, an extendable tube 610, preferably including a coil spring 611, typically formed of metal. Fixedly mounted onto a distal end of extendable tube 610 there is preferably provided a forward end member 612, preferably presenting a diagonally cut pointed forward facing tube end surface 614.
Upstream of end surface 614, forward end member 612 is preferably provided with an inflatable and radially outwardly expandable circumferential balloon 616, which receives inflation gas, preferably pressurized air, preferably through a conduit 618 embedded in a wall of forward end member 612 and continuing through tube 610 to a one way valve 619.
It is noted that the extendable endotracheal tube assembly 600, comprising at least one of mounting element 602, mouthpiece 604, mounting base 608, cube 610, coil spring 611, forward end member 612, end surface 614, circumferential balloon 616, conduit 618 and one way valve 619, may also be integrally formed as a unified structure.
Extending slidably through forward end member 612, tube 610, mounting base 608 and mounting element 602 is a flexible guide 620, which preferably corresponds in function inter alia to guide 20 in the embodiment of Figs. lA -1L and preferably has mounted at a distal end thereof a tip 621, which preferably corresponds in structure and function inter alia to the tip 28 in the embodiment of Figs.
lA - 1L. Tip 621 forms part of a tip sensor (not shown), preferably enclosed in guide 620, which preferably corresponds in structure and function inter alia to the tip sensor 11 in the embodiment of Figs. 1 A - 1 L.
As distinct from that described hereinabove with reference to Figs. lA -8, the flexible guide is preferably formed with an inflatable and radially outwardly expandable balloon 622, which receives inflation gas, preferably pressurized air;
preferably through a conduit 624 formed in flexible guide 620 and extending therealong, preferably to a source of pressurized inflation gas preferably located within the incubator assembly (not shown).
Fig. 11B shows inflation of balloon 622 by means of pressurized air supplied via conduit 624, causing balloon 622 to tightly engage the interior of forward end member 612.
Fig. 11C illustrates extension of tube 610, which is preferably achieved by forward driven movement of flexible guide 620 in tight engagement with forward end member 612, thus pulling forward end member 612 and the distal end of tube forwardly therewith.
Fig. 11 D illustrates inflation of balloon 616 by means of pressurized air through conduit 6I8 and one way valve 619. As will be described hereinbelow, this inflation is employed for sealing the tube 610 within a patient's trachea.
Fig. 11 E illustrates deflation of balloon 622 following inflation of balloon 616, corresponding to desired placement and sealing of tube 610 within the patient's trachea. Fig. 11F illustrates removal of the flexible guide 620 from the tube 610.
Reference is now made to Figs. 12A to 12G, which are a series of simplified pictorial illustrations of the extendable endotracheal tube assembly of Figs.
11A - I 1F employed with the medical insertion device of Figs. 1A - 8 for the intubation of a human.
Turning to Fig. 12A, it is seen that the extendable endotracheal tube assembly, designated generally by reference numeral 700, preferably comprises a mounting element (not shown) which is arranged to be removably engaged with an intubator assembly 703 which is preferably similar to incubator assembly I2 (Figs. lA -1 L) or any other incubator assembly described hereinabove but may alternatively be any other suitable intubator assembly. Fixed to or integrally formed with the mounting element is a mouthpiece 704. The extendable entotracheal tube assembly 700 is shown inserted into a patient's oral cavity, similar to the placement shown in Fig.
lA.
Fixedly mounted onto the mounting element is a mounting base 708 onto which is. in turn, mounted; an extendable tube 710, preferably including a coil spring 711 (Fig. 12C), typically formed of metal. Fixedly mounted onto a distal end of e~aendable tube 710 there is preferably provided a forward end member 712, preferably presenting a diagonally cut pointed forward facing tube end surface 714.
Upstream of end surface 714, forward end member 712 is preferably provided with an inflatable and radially outwardly expandable circumferential balloon 716, which receives inflation gas, preferably pressurized air, preferably through a conduit 718 embedded in a wall of forward end member 712 and continuing through tube 710 to a one way valve 719.
It is noted that the extendable endotracheal tube assembly 700, comprising at least one of mounting element, mouthpiece 704, mounting base 708, tube 710, coil spring 711 (Fig. 12C), forward end member 712, end surface 714, circumferential balloon 716, conduit 718 and one way valve 719, may also be integrally formed as a unified structure.
Extending slidably through forward end member 712, tube 710, mounting base 708 and the mounting element is a flexible guide 720, which preferably corresponds in function inter alia to guide 20 in the embodiment of Figs. lA -1L and preferably has mounted at a distal end thereof a tip, which preferably corresponds in structure and function inter alia to the tip 28 in the embodiment of Figs. lA -1L. The tip forms part of a tip sensor, preferably enclosed in guide 720, which preferably corresponds in structure and function inter alia to the tip sensor 11 in the embodiment of Figs. 1 A - 1 L.
As distinct from that described hereinabove with reference to Figs. lA -8, the flexible guide is preferably formed with an inflatable and radially outwardly expandable balloon 722, which receives inflation gas, preferably pressurized air, preferably through a conduit 724 formed in flexible guide 720 and extending therealong, preferably to a source of pressurized inflation gas preferably located within the intubator assembly 703.
The source of pressurized inflation gas may be an automatic inflator/deflator 726. Additionally or alternatively, a one way valve 728 may be provided For manual inflation. The automatic inflatorldeflator 726 may be fixed within intubator assembly 703 or alternatively may be mounted therewithin for motion together with flexible guide 720.
Fig. 12B shows inflation of balloon 722 by means of pressurized air supplied via conduit 724, causing balloon 722 to tightly engage the interior of forward end member 712.
Fig. 12C illustrates extension of tube 710, which is preferably achieved by forward driven movement of flexible guide 720 in tight engagement with forward end member 712, thus pulling forward end member 712 and the distal end of tube forwardly therewith.
Fig. 12D illustrates further extension of tube 710, by forward driven movement of flexible guide 720 in tight engagement with forward end member 712, thus pulling forward end member 712 and the distal end of tube 710 forwardly therewith. This further motion is preferably provided based on the navigation functionality described hereinabove with reference to Figs. lA - 8. It is appreciated that the forward driven movement of cube 710 as described hereinabove with reference to Figs. lA - 8, may be provided by driven forward motion of the flexible guide 720.
Fig. 12E illustrates inflation of balloon 716 by means of pressurized air through conduit 718 and one way valve 719. As will be described hereinbelow, this inflation is employed for sealing the tube 710 within apatient's trachea.
Fig. 12F illustrates deflation of balloon 722 following inflation of balloon 716, corresponding to desired placement and sealing of tube 710 within the patient's trachea. Fig. 12G illustrates removal of the flexible guide 720 from the cube 710.
Appendices 1 to 3 are software listings of the following computer files:
Appendix 1: containing file intumed.asm.
Appendix 2: containing file c8cdr.inc.
Appendix 3: containing file ram.inc.
The method for providing the software functionality of the microprocessor 278, in accordance with a preferred embodiment of the present invention. includes the following steps:
1. Provide an Intel compatible computer with a Pentium II CPU or higher, 128MB RAM, a Super VGA monitor and an available serial port.
2. Install Microsoft Windows 95 or Microsoft Windows 98 Operating System.
3. Install the Testpoint Development kit version 40 available from Capital Equipment Corporation, 900 Middlesex Turnpike, Building 2, Billereca, MA 0821, USA.
4. Connect a flash processor loading device COPBEM Flash, COP8 In Circuit Emulator for Flash Based Families to the serial port of the Intel compatible computer. The COP8EM flash processor loading device is available from National Semiconductors Corp. 2900 Semiconductor Dr., P.O.Box 58090, Santa Clara, CA
95052-8090, USA
5. Place a COP8CDR9HVA8 microcontroller available from National Semiconductors Corp., 2900 Semiconductor Dr., P.O.Box 58090, Santa Clara, CA
950.2-8090, USA in the COP8EM Flash.
950.2-8090, USA in the COP8EM Flash.
6. Copy the files intumed.asm, c8cdr.inc, and ram.inc, respectively labeled Appendix l, Appendix 2 and Appendix 3 to a temporary directory.
7. Load the file intumed. asm by using the operating software available with the COPBEM Flash device from National Semiconductors.
8. To run the intumed.asm; Install the COP8CDR9HVA8 microcontroller in its socket in the electrical circuit, which detailed electronic schematics are provided in Figs. SA to 5H, where the microcontroller is designated by reference numeral 278.
It is appreciated that the software components of the present invention may, if desired, be implemented in ROM (read-only memory) form. The software components may, generally, be implemented in hardware, if desired, using conventional techniques.
It is appreciated that the particular embodiment implemented by the Appendix is intended only to provide an extremely detailed disclosure of the present invention and is not intended to be limiting.
It is appreciated that various features of the invention which are, for clarity, described in the contexts of separate embodiments may also be provided in combination in a single embodiment. Conversely, various features of the invention which are; for brevity, described in the context of a. single embodiment may also be provided separately or in any suitable subcombination.
It will be appreciated by persons skilled in the art that the present invention is not limited by what has been particularly shown and described hereinabove.
Rather the scope of the present invention includes both combinations and subcombinations of the various features described hereinabove as well as variations and modifications which would occur to persons skilled in the art upon reading the specification and which are not in the prior art.
Appendices 1 through 3 are as follows:
Appendix 1 Files: intumed.asm, ram.inc and c8cdr.inc.
#UPPERCASE
verify .TITLE intumed .LIST Off ;complete listing. ; X'040 .CONTRL 3 ; 0- disable all code alteration, 3- re-enable code alteration.
and incld c8cdr.inc ; File that include all the definitions of cop8cdr.
incld ram.inc ; File that include all the variables, constants, registers bits definitions.
----------------CONFIGURATION
.sect option,conf from db O l ; 5=0 security dis, 2=0 wdog dis, 1=0 halt dis, 0=1 flex.
flex=1 -execution following reset will be from flash memory.
flex=0 -flash memory is erased. execution following reset will be boot rom with the mictowire plus isp routines.
_____________________________________________ .sect begin_rst,rom,abs=0 reset: rend ~______-_____ Clear memory ___________________ ld s,#0 ; Clean segment0 0-6fH.
ld b,#0 ;
ld a,#06f ; Cleans the memory between st00: ld [b+],#0 ; b to a ifgt a,b ;
,jmp st00 ;
(last LD SP,#Ole ; Stack Pointer in Memory leH. The stack works in LIFO
ld Ole,#OfF ; in first out) with "push a" and "pop a" instructions.
ld Ol f,#Off ; The stack starts from 1 eH until OH.
ld s,#1 ; Clean sl 0-7tH.
ld b,#0 ;
ld a,#07f ; Cleans the memory between st01: ld [b+],#0 ; b to a ifgt a,b ;
jmp st01 ;
Id s,#2 ; Clean s2 0-7fl1.
ld b,#0 ;
ld a,#07f ; Cleans the memory between st02: Id [b+],#0 ; b to a ifgt a,b ;
jmp st02 ;
packets of blockes of Id 05c,#'E' ; when the pc send moving command, the cop8 transmit Id 05d,#'D' ; information every 160 msec. in every packet We have 10
It is appreciated that the software components of the present invention may, if desired, be implemented in ROM (read-only memory) form. The software components may, generally, be implemented in hardware, if desired, using conventional techniques.
It is appreciated that the particular embodiment implemented by the Appendix is intended only to provide an extremely detailed disclosure of the present invention and is not intended to be limiting.
It is appreciated that various features of the invention which are, for clarity, described in the contexts of separate embodiments may also be provided in combination in a single embodiment. Conversely, various features of the invention which are; for brevity, described in the context of a. single embodiment may also be provided separately or in any suitable subcombination.
It will be appreciated by persons skilled in the art that the present invention is not limited by what has been particularly shown and described hereinabove.
Rather the scope of the present invention includes both combinations and subcombinations of the various features described hereinabove as well as variations and modifications which would occur to persons skilled in the art upon reading the specification and which are not in the prior art.
Appendices 1 through 3 are as follows:
Appendix 1 Files: intumed.asm, ram.inc and c8cdr.inc.
#UPPERCASE
verify .TITLE intumed .LIST Off ;complete listing. ; X'040 .CONTRL 3 ; 0- disable all code alteration, 3- re-enable code alteration.
and incld c8cdr.inc ; File that include all the definitions of cop8cdr.
incld ram.inc ; File that include all the variables, constants, registers bits definitions.
----------------CONFIGURATION
.sect option,conf from db O l ; 5=0 security dis, 2=0 wdog dis, 1=0 halt dis, 0=1 flex.
flex=1 -execution following reset will be from flash memory.
flex=0 -flash memory is erased. execution following reset will be boot rom with the mictowire plus isp routines.
_____________________________________________ .sect begin_rst,rom,abs=0 reset: rend ~______-_____ Clear memory ___________________ ld s,#0 ; Clean segment0 0-6fH.
ld b,#0 ;
ld a,#06f ; Cleans the memory between st00: ld [b+],#0 ; b to a ifgt a,b ;
,jmp st00 ;
(last LD SP,#Ole ; Stack Pointer in Memory leH. The stack works in LIFO
ld Ole,#OfF ; in first out) with "push a" and "pop a" instructions.
ld Ol f,#Off ; The stack starts from 1 eH until OH.
ld s,#1 ; Clean sl 0-7tH.
ld b,#0 ;
ld a,#07f ; Cleans the memory between st01: ld [b+],#0 ; b to a ifgt a,b ;
jmp st01 ;
Id s,#2 ; Clean s2 0-7fl1.
ld b,#0 ;
ld a,#07f ; Cleans the memory between st02: Id [b+],#0 ; b to a ifgt a,b ;
jmp st02 ;
packets of blockes of Id 05c,#'E' ; when the pc send moving command, the cop8 transmit Id 05d,#'D' ; information every 160 msec. in every packet We have 10
9 bytes in sl and 10 in s2. At the end of the packet there is 1 byte of check sum and then the 2 bytes of'E','D' to signal end of transmition.
Id s,#0 --- port definitions --- see ram.inc for bits definitions.
ld pgc,#033; clkdly enabled ; g2=tlb=cha2,g3=tla=chal - inputs ld pg,#0 ; sk idle phase=0 ld plc,#057 Id pl,#Oaf Id pbc,#010; b0-3 = a2d(in), b5-7 = limit switches(in) Id pb,#Of0 ld pac,#Off Id pa,#03 ---- DART initialization ---Id enu,#0 ; no parity, 8 bit data Id enur,#0 Id enui,#022 ; 1 stop bit, Asynch. mode,psr+baud clock enable receive int.,disable trans. int.
ld baud,#4 ; 38400 baud rate.
Id psr,#060 ; IOMHz*2 /(16*(4+1)*6.5) ----- LCD initialization -------------jsr init_lcd ld temp,#low(wordmm); type in line 1 of Icd " mm ", in the left side there is for jsr type string0 ; space for 3 digits of mm, and in the right side 3 spaces direction (+/- up/down) and 2 digits of movement.
ld temp,#low(wordpoweron) jsr type stringl ----- PWM,TO,interupts initialization -----------ld cntrl,#080 ; timer 1 - pwm mode - stopped.
ld a,#Off ; timer 1 would be used in capture mode, meaning that pulse timer 1 angular control3,4.
x a,tmrllo ; received from linear motor will capture the value of Id a.#Off ; in timer 1 auto reload A (tlrahi/lo) and pulse from a,tmrlhi ; motor in B (tlrbhi/lo).
ld t2cntrl,#OaO; timer 2 - pwm toggle mode stopped.
Id t3cntrl,#OaO; timer 3 - pwm toggle mode stopped.
shit t2a,pl ; enable linear motor and lock it by putting 0 in controll,?.
shit t3a,p1 ; enable angular motor and lock it by putting 0 in sbit t2hs,hstcr shit t3hs,hstcr ld cntrl,#060 ; timer 1 - capture mode.
rbit tlpndb,icntrl shit tlenb,icntrl ; timer 1 - capture mode, t2enB=1 rbit tlpnda,psw shit tlena,psw ; timer 1 - capture mode, t2enA=1 shit itsel0,itmr; 8,192 inst. cycles - 4,096 m. sec timer 0 interrupts.
rbit tOpnd,icntrl sbit t0en,icntrl ; start timer0.
---- Program initialization sbit 7,pls-yl ; pls_y=08000H
over 80 is positive angle and under 80 is negative angel.
ld data_cntr,#21 sbit stop2,aflags sbit direction,lflags sbit stopl,lflags shit en calc,lflags Id pls xl,#068 sbit limits c_en,limits_flags shit home_command,buttons_flags sbit gie,psw ; enable interupts.
jmp main .*************************************************
.sect pc module,rom main: ifbit limits_c_en,limits flags jsr limits_check ifbit start stop,buttons flags jsr autorun states ifbit stop command,buttons flags jsr stop operation ifbit buttons_t_en,buttons_flags jsr buttons test ifbit home command,buttons_flags jsr homed states ifbit self t_command,buttons flags jmp self t states main0: jmp linear states ; linear_states + angular states.
maim: jsrupdatelcd ifbit a2den,flags2 ; a2d check.
jsr a2d00 ld a,#0 add a,linear stet add a,ang-stet add a,autorun_stat add a,selft stet add a,home stet ifeq a,#0 shit enddata,flagsl ; if 2 motors are stopped, set enddata bit to stop transmitting to PC.
Id a,buttons_flags and a,#09e ; if one of the commands flags is set, reset enddata bit.
ifgt a,#0 rbit enddata,flagsl ifbit enddata,flagsl rbit start,flags 1 ifbit fix_t_en,flags2 jsr data send ,imp mam .*************************************************
.sect autorun_select,rom,inpage autorun_states:ld a,autorun_stat add a,#low(jmp a r stet) jid ; jmp pcu,[a]
jmp a r stet: .addr a r0,a _ _ _rl,a r2,a r3,a r4,a r5,a r6,a r7,a r8,a r9,a rl0,a rll,a rl2;,a rl3,a rl4 a r0: jmp a r stat0 a rl: jmp a r statl a r2: jmp a r stat2 a r3: jmp a r stat3 a r4: jmp a r stat4 a r5: jmp a r stat5 a r6: jmp a r stat6 a r7: jmp a r stat7 a r8: jmp a r stat8 a r9: jmp a r stat9 a r10:jmp a r statl0 a r j mp a r 11: stat 11 a_r j mp a_r_stat 12: 12 ;a jmp a_r_statl3 r13:
;a jmp a r statl4 r14:
end a r stat:ret .************************************
.sect autorun,rom a_r stat0:ld autorun_stat,#1 ld home stat,#0 sbit home command,buttons flags a_r_statl:ifbit home_command,buttons flags ret linear motor.
ld linear_stat,# 1 ; move linear forwards lmm.
ld rbytel,#08 ; 0,1,2=0=speedl ; 3=1= direction forwards ; 4=0=
ld rbyte2,#136 Id rbyte3,#0 ; lmm*136pulse per mm =136 pulses.
Id autorun_stat,#2 ld temp,#low(wordautorun) jsr type stringl a r statl-l:rbit limits c en,limits flags rbit stopl,lflags rbit stuck,flagsl a_r_statl_2abit fix_t en,flags2 jmp end a r stat a_r_stat2:ifeq linear stat,#0 ; wait until linear motor complete mission.
jmp a r stat2 0 jmp end a r stat a_r_stat2_O:Id a,halll a,zero hl Id a,hall2 z a,zero_h2 rbit home,flagsl ld ang stet,#1 ; move angular down 2000 pulses.
ld rbytel,#010 ; 0,1,2=0= speedl ; 3=0= direction down ; 4=1=
angular motor.
ld rbyte2,#low(2000) ld rbyte3,#high(2000) rbit stop2,aflags ld autorun_stat,#3 rbit stuck,flagsl jmp a r statl 2 a_r_stat3:ld linear_stat,# 1 ; move linear forwards 40mm.
Id rbytel,#08 ; 0,1,2=0= speedl ; 3=1= direction forwards ; 4=0=
linear motor.
Id rbyte2,#low(5440) ld rbyte3,#high(5440) ; 40mm* 136pulse per mm = 5440.
ld autorun stet,#4 jmp a r statl_l a r stat4:jsr epi check ; check if epiglotis sensed.
ifbit epi,flagsl j mp a r stat4_0 ifeq linear_stat,#0 ; wait until linear motor complete mission.
jmp a r stat7 0 jmp end a r stet a_r_stat4 O:Id linear_stat,#1 ; move linear backwards 6mm.
ld rbytel,#0 ; 0,1,2=0= speedl ; 3=0= direction backwards 4=0= linear motor.
ld rbyte2,#low(816) ld rbyte3,#high(816); 6mm*136pulse per mm = 816.
ld autorun_stat.#5 jmp a r statl-1 a_r_stat5:ifeq linear stet,#0 ; wait until linear motor complete mission.
jmp a r stat5 0 jmp end a r stet a_r_stat5_O:ld ang stet,#l ; move angular up 70 pulses.
ld rbytel,#Ol 8 ; 0,1,2=0= speedl ; 3=1= direction up ; 4=1=
angular motor.
ld rbyte2,#70 ld rbyte3,#0 ld autorun stet,#6 rbit stop2,aflags jmp a r statl 2 a_r_stat6:ifeq ang stet,#0 ; wait until angular motor complete mission.
jmp a r stat6 0 jmp end a r stet a_r stat6 Orbit epi,flagsl ld linear stet,#1 ; move linear forwards lOmm.
ld rbytel,#08 ; 0,1,2=0= speedl ; 3=1= direction forwards ; 4=0=
linear motor.
Id rbyte2,#low(1360) ld rbyte3;#high(1360) ; lOmm*136pulse per mm= 1360.
Id autorun stet,#7 _jmp a r~statl_1 a_r_stat7:ifeq linear stet,#0 ; wait until linear motor complete mission.
jmp a r stat7 0 jmp end a'r stet a_r_stat7 O:Id ang stet,#I ; move angular down 2000 pulses.
ld rbytel,#010 ; 0,1,2=0= speedl ; 3=0= direction down ; 4=1=
angular motor.
ld rbyte2,#low(2000) ld rbyte3,#high(2000) ld autorun_stat,#8 rbit stop2,aflags rbit stuck,llagsl jmp a r statl 2 a r stat8:;ld linear_stat,#1 ; move linear forwards 50mm.
;ld rbytel,#08 . ; 0,1,2=0= speedl ; 3=1= direction forwards ; 4=0=
linear motor.
;ld rbyte2,#low(8160) ;ld rbyte3,#high(8160) ; 50mm*136pulse per mm = 6800.
ld pls cntr0,#low(6800) ld pls cntrl,#high(6800) ; 50mm*136pulse per mm = 6800.
shit direction,lflags ; turn motor forwards rbit t2c0,t2cntrl shit t2a,pl rbit control2,pa sbit controll,pa ld linear stet,#6 rbit en calc,lflags ld autorun_stat,#9 jmp a r statl-1 a_r_stat9:ifeq linear stet,#0 ; wait until linear motor complete mission.
jmp a r stat9 0 jmp end a r stet a_r_stat9 O:ld ang stat,#l ; move angular up 2000 pulses.
ld rbytel,#Ol 8 ; 0, I,2=0= speedl ; 3=1= direction up ; 4=1=
angular motor.
Id rbyte2,#low(2000) Id rbyte3,#high(2000) Id autorun_stat,#10 rbit stop2,aflags .j mp a r stat 1 2 a r statl0:;ld linear_stat,#1 ; move linear forwards 70mm.
;ld rbytel,#08 ; 0,1,2=0= speedl ; 3=1= direction forwards ; 4=0=
linear motor.
;Id rbyte2,#low(9520) ;ld rbyte3,#high(9520) ; 70mm*136pulse per mm = 9520.
ld pls cntr0,#low(9520) ld pls cntrl,#high(9520) ; 70mm* 136pulse per mm = 9520.
shit direction,lflags ; turn motor forwards rbit t2c0,t2cntrl shit t2a,p1 rbit control2,pa shit controll,pa ld linear stat,#6 ld autorun_stat,#11 ,jmp a r statl-1 a r statl l :ifeq linear stat,#0 ; wait until linear motor complete mission.
_j mp a r stat 11 0 jmp end a._r stat a r statl 1 Oabit stop2,aflags rbit t3c0,t3cntrl sbit t3a,pl shit control3,pa ; iurn off motor 2 shit control4,pa ;ld linear_stat,#1 ; move linear forwards SOmm.
;ld rbytel,#08 ; 0,1,2=0= speedl ; 3=1= direction forwards ; 4=0=
linear motor.
;ld rbyte2,#low(6800) ;ld rbyte3,#high(6800) ; SOmm*136pulse per mm = 6800.
Id pls cntr0,#low(6800) Id pls cntrl,#high(6800) ; SOmm* 136pulse per mm = 6800.
Qo sbit direction,lflags ; turn motor forwards rbit t2c0,t2cnirl shit t2a,pl rbit control2,pa sbit controll,pa ld linear stat,#6 ld autorun_stat,#12 jmp a r statl_l a_r statl Z:ifeq linear_stat,#0 ; wait until linear motor complete mission.
j mp a r_stat 12 0 jmp end a r stat a_r_statl2_O:Id autorun_stat,#0 jsr stop2motors sbit en calc,lflags rbit start stop,buttons'flags rbit stuck,flagsl Id temp,#Iow(wordinplace) jsr type stringl jmp end a r stat .*************************************************
epi check:;ld a,#4 ;ifgt a,pls ~1 ;ret SC
ld a,halll ifgt a,zero_hl jmp epi checkO~I
Id a,zero_hl subc a,halll ,jmp epi check0 2 epi~check0_l:subc a,zero hl epi check0 2:ifgt a,#20 sbit epi,flagsl sc ld a,hall2 ifgt a,zero~h2 jmp epi check0 3 ld a,zero h2 subc a,hall2 jmp epi,check0 4 epi~check0_3aubc a,zero_h2 epi~checl:0_4:ifgt a,#20 shit epi,flagsl ret .*************************************************
a .sect I_s_select,rom,inpage linear_states:ld a,linear_stat add a,#low(jmp 1 stat) jid ; jmp pcu,[a]
jmp I stat: .addr 1 s0,1 sl,l s2,1 s3,1 s4,1 s5,1 s6 I s0: jmp 1 stat0 1 sl: jmp 1 statl I s2: jmp I stat2 I s3: jmp 1 stat3 I s4: .jmp 1 stat4 1 s5: jmp 1 stat5 1 sE: jmp I stat6 end 1 stat:jmp angular states .******************~*****************
.sect linear states,rom 1 stat0: ifbit pulse,lflags jmp 1 stat0_Ol ; the motor made another pulse after stop order.
jmp a 1 stat0 I stat0 Ol :rbit pulse,lflags 1 stat0 02ac ifbit direction,lflags ; x update jmp 1 stat0 03 ; x forwards Id a,pls_xl ; before decreasing pls x, check if pls x>1 ifne a,#0 jmp 1 stat0 02 Id a,pls_x0 ifgt a,#0 j mp I stat0_02 ifeq pls x0,#0 jmp a 1 stat0 ; do not decrease pls x if 0.
Id a,pls x0 ; x downwards subc a,# 1 x a,pls x0 Id a,pls xl subc a,#0 x a,plS xl jmp a 1 stat0 1 stat0_03:rc ; x forwards ld a,pls x0 adc a,#1 x a,pls x0 Id a,pls xl adc a,#0 x a,pls_xl a 1 stat0:jmp end 1 stat ; ->O
.*******************************************
a I_statl : ifbit direction,lflags ; check the previous direction.
,jmp 1 statl 02 ; the direction was backwards.
ifbit new_direction,rbytel ; check the new direction.
jmp 1 statl O1 jmp 1 stat3 I statl O1:ld nxt 1 stat,#4 ; change direction to forwards.
jmp 1 statl OS
; the direction was forwards.
I_statl 02:ifbit new_direction,rbytel ; check the new direction.
jmp 1 stat4 ld a,pls xl ; before changing diretion to backwards ifne a,#0 ; check if pls x=0.
jmp 1 statl 04 ; if not then...
ld a,pls x0' ifne a,#0 jmp 1 statl 04 1 statl 03:1d linear stat,#0 ; if 0 then just stop motor.
shit stopl,lflags ; stop motor 1.
rbit stop,flagsl sbit limits c en,limits flags sc ifbit stop2,aflags rc ifc jmp 1 statl_06 rbit start,flagsl shit end,flagsl sbit type end,lcd flags jmp 1 statl 06 1 statl 04:1d nxt 1 stat,#3 ; stop motor, wait and then change direction to backwards.
1_statl~OS:ld linear stet,#2 Id cd_dly,#020 I statl 06:rbit t2c0,t2cntrl sbit t2a,p1 rbit controll,pa ; stop motor 1.
rbit control2,pa jmp end 1 stet ; ->O
.*****************~*~*************************************************
l stat2: ifeq cdydly,#0 ; delay before changing direction.
j mp 1 stat2 O l jmp end 1lstat ; ->O
I stat2 Ol :ld a,nxt 1 stet x a,linear_stat jmp end I stet ; ->O
1'stat3: Id a,pls_xl ; the direction is still backwards.
ifne a,#0 ; check if pls x=0 jmp 1 stat3 O1 ; if not then...
Id a,pls 10 ifne a,#0 jmp 1 stat3_Ol jmp 1 statl_03 ; if 0 then just stop motor and return to linear stet 0.
I_stat3_Ol:ifbit home_limit,pbi jmp 1 stat3 02 jmp 1 statl_03 I stat3 02:rbit direction,Iflags ; turn motor backwards.
rbit t2c0,t2cntrl sbit t2a,p1 rbit controll,pa sbit control2,pa rbit t2a,p1 jmp 1 stag02 I stat4: ;Id a,pls-sl ; 255mm*128pulsepermm=7f80H
;ifgt a,#Ofe ; if pls Y>7f00H then stop motorl.
xjmp 1 statl_03 ifbit bottom_limit,pbi jmp 1 stagOl jmp 1 statl 03 ld linear stet,#0 sbit stopl,lflags jmp end 1 stet I stat4 Ol abit direction,lflags ; turn motor forwards rbit t2c0,t2cntrl sbit t2a,pl rbit control2,pa sbit controll,pa rbit t2a,pl I stat4 02:1d a,rbyte2 ce update ; distan s a,pls cntr0 Id a,rbyte3 v a,plslcntrl Id a,rbytel ; velocity update and a,#7 ifne a,#0 jmp 1 stat4_03 Id t_ref0,#Iow(1000) ; 1000 -> SOOu per pulse Id t_refl,#high(1000) jmp end 1 stat4 1 stat4,03:ifne a,#1 jmp 1 stat4_04 ld t red,#low(2000) ; 2000 -> 1000u per pulse ld t refl,#high(2000) jmp end 1 stat4 I stat4_04:ifne a,#2 jmp I stat4_OS
ld t_ref0,#low(3000) ; 3000 -> 1500u per pulse Id t refl,#high(3000) jmp end Ilstat4 I_stat4_OS:ifne a,#3 jmp end 1 stat4 Id t ref0,#low(4000) ; 4000 -> 2000u per pulse ld t refl,#high(4000) end I stat4:
.****************************************************
1 stat5: ifbit t2c0,t2cntrl ; if motor 1 is already on.
jmp a l,stat5 rbit first~ulse,lflags rbit t2cl,t2cntrl ; turn off the toggle output.
rbit t2a,pl ld ptlhi,#020 Id pt2hi,#080 ld tmr2lo,#Off Id tmr2hi,#0ff ld t2ralo,#Off Id t2rahi,#Off ld t2rblo,#Off Id t2rbhi,#Off rbit t2pndb,t2cntrl shit t2c0,t2cntrl ; start timer 2 - pwm.
I_stat5 Ol :ifbit t2pndb,t2cntrl jp 1 stat5_02 jp 1 stat5_O1 I_stat5_02:rbit t2c0,t2cntrl ; stop timer 2 - pwm.
ld tmr2lo,#250 ; 250->t2.
Id tmr2hi,#0 ld t2ralo,#low(400) ; 400->r2a.
id t2rahi,#high(400) Id t2rblo,#low(600) ; 600->r2b.
Id t2rbhi,#high(600) rbit t2a,p1 shit t2cl,t2cntrl ; turn on the toggle output.
shit t2c0,t2cntrl ; start timer 2 - pwm.
v rbit stopl,lflags a 1 stat5:ld a<int cntr se subc a,#20 s a,nolpulsetmr shit limits_c_en,limits_flags Id linear_stat,#6 ld nit l stat,#0 jmp end 1 stat ; ->O
.*****************************************************************
stat6: ifbit pulse,lflags jmp 1 stat6_O1 ld a,nolpulsetmr ifne a,int cntr jmp 1 stat6_OS
sbit st~pl,lflags shit stuck,flagsl jmp 1 stat6 OS
I stat6 01:rbit pulse,lflags Id a,int_cntr SC
subc a,#20 x a,nolpulsetmr shit limits c en,limits_flags sc i ; dec. pls cntr ld a,pls_cntr0 subc a,# 1 1 a,pls~cntr0 ld a,pls_cntrl subs a,#0 s a;pls cntrl ld a,pls,cntrl ; check if pls cntz=0 ifne a,#0 jmp 1 stat6 02 ld a,pls cntr0 ifne a,#0 jmp 1 stat6_02 sbit stopl,lflags 1 stat6~02:;ifbit first_pulse,lflags sbit en calc,lflags sbit first_pulse,lflags ifbit direction;lflags ;1 update ,jmp I stat6-04 ld a,pls~tl ; check if pls x>1 ifne a.#0 j mp 1 stat6_03 Id a,pls ~0 ifgt a,#0 jmp 1 stat6_03 Id ply Y0,#0 sbit stopl,lflags 1d nit 1 stat,#0 jmp I stat6 OS
1 stat6 03ac ; x_downwards ld a,pls x0 subc a,# 1 s a,pls x0 ld a,pls_~1 subc a,#0 x a,pls xl jmp I stat6 05 l stat6 04:rc ; ~ forwards ld a,pls x0 adc a,#1 1 a,pls YO
ld a,plslll adc a,#0 a,pls x1 ifgt a,#086 ; the 1cd can show only 256 mm (_ 256*136=34816=08800~I).
shit stopl,lflags I_stat6_OS:ifbit stopl,lflags jmp a I stat6 ifbit enl calc,lflags jsr vyealc jmp end 1 stet ; ->0 a 1 stat6:rbit t2c0,t2cntrl sbit t2a,p1 rbit controll,pa ; iurn off motor 2.
rbit control2,pa ld a,nxtl stet x a,linear stet itbit stop2,aflags jmp a I stat6 0 jmp end_l~stat ; ->0 a~l stat6 Orbit start,flagsl rbit stop,flagsl ifbit self t_command,buttons flags jmp end 1 stet ; ->O
ifbit start_stop,buttons_flags jmp end 1 stet ; ->0 ifbit home_command,buttons flags jmp end I stet ; ->0 shit type end,lcd_flags shit end,flagsl jmp end I'stat ; ->0 .***************************************************
.sect a_s_select,rom,inpage angular states:ld a,ang stet add a,#low(jmp a stet) jid ; jmp pcu,[a]
jmpla stet: .addr a s0,a sl,a s2,a s3,a s4,a s5,a s6,a s7 a s0: jmp a stat0 a sl: jmp a statl a s2: ,jmp a stat2 a s3: jmp a stat3 a s4: jmp a stat4 a s5: j mp a stat5 a sE: jmp a stat6 a s7: jmp a stat7 end a stat:jmp maim .************************************
.sect angular_states,rom a_stat0: ifbit pulseZ,aflags jmp a stat0 Ol _jmp a a stat0 a_stat0 Ol:rbit pulse2,aflags ifbit direction2,aflags ; y update jmp a stat0_02 jmp a stat0 03 a stat0_02ac ; y down ld a,pls_y0 subc a,#1 1 a,pls-y0 ld a,pls_yl subc a,#0 1 a,pls-yl jmp a a stat0 a stat0 03:rc ; y up Id a,pls_y0 adc a,#1 a,pls-y0 ld a,pls-yl adc a,#0 i a,pls-yl a a stat0:jmp end a stat ; ->O
.**********************************
a statl:
ld a,pls_yl ; check if the the probe is not too high or to low.
ifgt a,#094 jmp a statl 00 ld a,#066 ifgt a,pls_yl jmp a statl O1 jmp a statl 03 ;a statl OO:ifbit new_direction,rbytel ; if too high enable only down movment.
jmp a statl_02 jmp a statl_03 ;a statl Ol :ifbit new direction,rbytel ; if too low enable only up movment.
imp a statl_03 jmp a statl-02 ;a statl 02:1d ang_stat,#0 ; just stop motor ld nlt a stat,#0 sbit stop2,aflags ; stop motor 2.
sbit type end,flags2 jmp a statl 08 a stat1V03:ifbit direction2,aflags ; check the previous direction.
jmp a statl OS
direction.
ifbit new direction,rbytel ; the direction was down-check the new jmp a statl 04 jmp a stat3 a statl 04:1d nlt a stat,#4 ; stop motor, wait and then change direction to up.
jmp a statl 07 a statl OS:ifbit new_direction,rbytel ; the direction was up-check the new direction.
jmp a~stat~l a statl 06:1d mt a stat,#3 ; stop motor, wait and then change direction to down.
a_statl 07:1d ang_stat,#2 ; delay for the motor to make a complete stop.
ld cd_dly,# 17 a_statl 08:rbit t3c0.t3cntrl sbit t3a,p1 shit control3,pa ; stop motor 2.
shit control4,pa jmp end a stat ; ->0 .*******************~*************************************************
a stat2: ifeq cd_dly,#0 ; delay before changing direction.
jmp a stat2; Ol jmp end_a stat ; ->O
a_stat2~Ol:ld a,n~t_a_stat x a,angstat jmp end a stat ; ->O
.******************~~**************************************************
*
a stat3: rbit direction2,aflags ; turn motor backwards.
rbit t3c0,t3cntrl sbit t3a,pl rbit control3,pa shit control4,pa rbit t3a,pl jmp a stag O1 .*******************************************
a_stat~.: sbit direction2,aflags ; turn motor forwards rbit t3c0,t3cntrl sbit t3a,p1 rbit control4,pa sbit control3,pa rbit t3a,p1 a_stat~ Ol:ld a,rbyte2 ; distance update 1 a,plsy cntr0 Id a,rbyte3 v a,plsy_cntrl Id a,rbytel ; velosity update and a,#7 ifne a,#0 _jmp a stat4_02 ld at_ref0,#low(6000) ; 6000 -> 3000u per pulse ld at_refl,#high(6000) jmp end a stat4 a_stat4 02:ifne a,#1 jmp a stat4 03 ld at_ref0,#low(7000) ; 7000 -> 3500u per pulse ld at_refl,#high(7000) jmp end a stat4 a_stat4_03:ifne a,#2 jmp a stat4_04 Id at_ref0,#low(8000) ; 8000 -> 4000u per pulse ld at_refl,#high(8000) jmp end a stat4 a stat4 04:ifne a,#3 .
jmp end_a stat4 ld at_ref0,#low(9000) ; 9000 -> 4500u per pulse Id at refl,#high(9000) end a stat4:ld nit a Stat,#6 .****************************************************
a stat5: ;ifbit t3c0,t3cntrl ; if motor 2 is already on.
xjmp a a stat5 ld aptlhi,#020 ld apt2hi,#080 rbit firsty_pulse,aflags rbit t3cl,t3cntrl ; turn off the toggle output.
rbit t3a,p1 ld tmr3lo,#Off ld tmr3hi,#Off ld t3ralo.#Off Id t3rahi,#0ff ld t3rblo,#Off ld t3rbhi,#Off rbit t3pndb,t3cntrl sbit t3c0,t3cntrl ; start timer 3 - pwm.
a_stat5 Ol:ifbit t3pndb,t3cntrl jp a stat5 02 j p a stat5-O l a stat5 02:rbit t3c0,t3cntrl ; stop timer 3 - pwm ld tmr3lo.#250 : 250->t3.
Id tmr3hi,#0 Id t3ralo;#low(500) ; 500->r3a.
ld t3rahi,#high(500) ld t3rblo,#low(500) ; 500->r3b.
ld t3rbhi,#high(500) rbit t3a,pl shit t3cl,t3cntrl ; turn on the toggle output.
sbit t3c0,t3cntrl ; start timer 3 - pwm.
a a stat5:;ld a,int cntr ac ;subc a,#50 ;1 a,noapulsetmr ld a,n~t a stat 1 a,ang stat Id nxt a stat,#0 _j mp end a stat ; ->O
.**********************************
a_stat6: ifbit pulse2,aflags ,jmp a stat6 O1 ;ld a,noapulsetmr ;ifne a,int cntr ;jmp a stat6_06 ;sbit stop2,aflags ;shit stuck,flagsl _jmp a stat6 06 a_stat6-Ol:rbit pulse2,aflags ;ld a,int cntr ;sc ;subc a,#50 ;x a,noapulsetmr sc ; dec. plsy cntr ld a,plsy cntr0 subc a,# 1 x a,plsy,cntr0 Id a,plsy_cntrl subc a#0 x a,plsy cntrl ld a,plsy_cntrl ; check if plsy_cntr=0 ifne a,#0 .jmp a stat6 02 Id a,plsy cntr0 ifne a,#0 ,jmp a stat6 02 shit stop2,aflags ld nxt a stat,#0 a_stat6 02:;ifbit firsty_pulse,aflags sbit en_calc2,aflags shit firsty_pulse,aflags ifbit direction2,aflags ; y update jmp a stat6 04 ld a,pls_yl ; check if pls_y>6500H
ifgt a,#0 ; 065 jmp a stat6_03 sbit stop2,,aflags ld n1t a stat,#0 jmp a stat6 06 a stat6 03ac ; y down ld a,pls_y0 subc a,#1 x a,pls_y0 Id a,pls-yl subc a,#0 v a,pls-yT
jmp a stat6 06 a_stat6-04:Id a,#Off ; 096 ifgt a,pls_yl jmp a stat6_05 sbit stop2,aflags ld nxt a scat,#0 jmp a stat6 06 a stat6 05:rc ; y up ld a,pls_y0 adc a,#1 1 a,pls-y0 ld a,pls~l adc a,#0 1 a,pls_yl a_stat6 06:ifbit stop2,aflags jmp a a stat6 ifbit enl_calc?;aflags jsr v2_calc jmp end a stat ; ->p a a s tat6:
rbit t3c0,t3cntrl sbit t3a,p1 sbit control3,pa ; turn off motor 2 sbit control4,pa ld a;nlt a stet a,ang-stet ifbit stopl,lflags jmp a a stat6 0 jmp end_a stet ; ->0 e_a_stat6 Orbit start,flagsl rbit stop,flagsl ifbit self_t command,buttons flags jmp -end a stet ; ->p ifbit start stop,buttons_flags jmp end a stet ; ->O
ifbit home_command,buttons_flags jmp end_I stet ; ->O
sbit end,flags 1 sbit type end,lcd_flags ifbit stuck,flagsl sbit type stuck,lcd_flags jmp end a stet ; ->0 .***************************************************
a stat7: ifbit pulse2,aflags _Imp a stat7_Ol jmp a a stat7 a_stat7 Ol :rbit pulse2,aflags ifbit direction2,aflags ; y update jmp a stat0 03 a_stat7 02ac ; y down ld a,pls~0 subc a,# 1 1 a,pls~0 ld a,pls-yl subc a,#0 x a,pls_yl jmp a a stat7 a stat7 03:rc ; y up Id a,pls_y0 adc a,#1 a,pls_y0 ld a,pls~l adc a,#0 1 a,pls~l a a_stat7:jmp end_a_stat ; ->O
***************************************************
.sect stop-subroutines,rom stop2motorsabit stopl,lflags ; turn off motor 1 rbit t2c0,t2cntrl shit t2a,p1 rbit controll,pa rbit control2,pa ld linear stet,#0 ld nlt 1 stet,#0 shit stop2,aflags ; turn off motor 2 rbit t3c0,t3cntrl sbit t3a,p1 shit control3,pa sbit control4,pa ld ang stet,#0 ld nYt a stet,#0 ret stop operation:rbit stop command,buttons flags jsr stop2motors sbit en calc,lflags sbit i-il t en,flags2 rbit enddata,flagsl rbit start,flagsl rbit end,flagsl shit stop,flagsl sbit type stop,lcd_flags rbit self_t_command,buttons_flags ld selft stet,#0 rbit start_stop,buttons flags ld autorun_stat,#0 rbit home_command~c,buttons_flags rbit home command,buttons_flags ld home stet,#0 ret .***************************************************
.sect s t_select,rom,inpage self_t_states:ld a,selft_stat add a,#low(jmp st_stat) _jid ; jmp pcu,[a]
,imp st stet: .addr s t0,s tl,s t2,s t3,s t4,s t5,s t6 s t0: jmp self test0 s tl: jmp self testl s t2: jmp self test2 s t3: jmp self test3 s t4: jmp self test4 s~t5: jmp self tests s t6: jmp self test6 end st stat:jmp main0 .************************************
.sect self_test,rom self_test0:ld temp,#low(wordselftest) jsr type stringl ifbit home limit,pbi jmp self test0 0 ; 1-micro switch open - not in home position.
rbit home command,buttons_flags ld home_stat,#0 jmp self testl 0 ; 0-micro switch closed - in home position.
self_test0 Oabit home command,buttons_flags ld home stat,#0 ld selft stat,#1 jmp end st stat self_testl :ifbit home_command,buttons flags jmp end st stat self_testl O:ld linear_stat,#1 ; move linear forwards SOmm.
Id rbytel,#08 ; 0,1,2=0= speedl ; 3=1= direction forwards ; 4=0=
linear motor.
ld rbyte2,#low(6850) ld rbyte3,#high(6850) ; SOmm*136pulse per mm = 6800.
ld selft stat,#2 self_testl-l:rbit limits c_en,limits_flags rbit stopl,lflags self testl,2:jmp end st stat self test2:ifeq linear_stat,#0 ; wait until linear motor complete mission.
jmp self test2 0 jmp end st stat self_test2 O:ld ang scat,#1 ; move angular up I50 pulses.
Id rbytel,#018 ; 0,1,2=0= speedl ; 3=1= direction up ; 4=1=
angular motor.
ld rbyte2,#150 Id rbyte3,#0 ld selft_stat.#3 rbit stop2;aflags shit en_calc2,aflags jmp self testl 2 self_test3:ifeq ang stat,#0 ; wait until angular motor complete mission.
jmp self test3 0 jmp end st stet self test3 Orbit en calc2,aflags Id ang-stet,#1 ; move angular down 400 pulses.
ld rbytel,#010 ; 0,1,2=0= speedl ; 3=0= direction down ; 4=1=
angular motor.
ld rbyte2,#low(300) ld rbyte3,#high(300) Id selft stet,#4 rbit stop2,aflags jmp self testl 2 self_test4:ifeq ang stet,#0 ; wait until angular motor complete mission.
jmp self test4 0 jmp end st stet self test4-O:Id ang stet,#1 ; move angular again up 150 pulses.
ld rbytel,#018 ; 0,1,2=0=speedl ; 3=1= direction up ; 4=1=
angular motor.
ld rbyte2,#150 Id rbyte3,#0 ld selft stet,#5 rbit stop2,aflags sbit en_calc2,aflags jmp self testl 2 self_test5:ifeq ang stet,#0 ; wait until angular motor complete mission.
jmp self tests 0 jmp end st stet self_test5 Orbit en_calc2,aflags ld linear stet,#1 ; move linear backwards 50mm.
ld rbytel,#0 ; 0,1,2=0= speedl ; 3=0= direction backwards 4=0= linear motor.
ld rbyte2,#low(6850) Id rbyte3,#high(6850) ; 50mm*136pulse per mm = 6800.
Id selft stet,#6 jmp self testl-1 self_test6:ifeq linear_stat,#0 ; wait until linear motor complete mission.
jmp self test6 0 jmp end st stet self_test6 O:ld selft_stat,#0 rbit self t command,buttons flags rbit stuck,flagsl Id temp,#low(wordready) jsr type~stringl jmp end st stat .***************************************************
.sect h_p select,rom,inpage homerp,states:ld a,home_stat add a,#low(jmp h stat) jid ; jmp pcu,ja]
jmp h stag .addr h~p0,h_pI
h_p0: jmp home~p0 h_p 1: jmp homelp 1 .**********************************************************************
*****
.sect home-positioning,rom home~p0: ifbit home limit,pbi ; 0-micro switch closed - in home position, jmp home_p0 2 ; 1-micro switch open - not in home position.
jmp home_pl 0 home~a0 2: jsr stop2motors ld lcd_flags,#0 rbit direction,lflags ; so the bottom wouldn't shut down the motor.
ld linear_stat,#1 ; move linear bach-wards 200mm.
Id rbytel,#0 ; 0,1,2=0= speedl ; 3=0= direction backwards 4=0= linear motor.
ld rbyte2,#low(27200) ld rbyte3,#high(27200) ; 200mm*136pulse per mm = 27200.
rbit stopl,lflags sbit fi~_t_en,flags2 rbit start,flagsl rbit stop,flagsl rbit end,flagsl rbit enddata,flagsl ld home stat,#1 ifbit self t command,buttonslflags ret ld temp,#low(wordhome) jsr type~stringl horne_pl : ifeq linear_stat,#0 ; wait until linear motor complete mission.
jmp home_p 1 0 ret home_pl O:ld home stat,#0 rbit home_command,buttons flags rbit epi,flagsl ifbit stuck;flagsl jmp home~l_1 ld plslx0,#0 Id pls xl,#0 Id pls=y0,#0 Id pls_yl,#080 homepl_l:ifbit self_t_command,buttons flags ret ifbit stuck,flagsl ret ld temp,#low(wordready) jsr type stringl ret ***************************************************
.sect limits_check,rom limits_check:ld a,pbi ; general limits check (limits = b5,b6,b7).
and a,#060 ; Oe0 - if the angular limit switch is on.
ifne a,#060 jmp limits_check0_0 rbit home,flagsl ; signal to the pc that we are not in home position.
rbit bottom,flagsl ; signal to the pc that we are not in buttom position.
ret limits_check0 Oa a,b ifbit home_limit,b jmp limits checkl 0 position.
shit home,flagsl ; signal to the pc that we are in home position.
rbit bottom,flagsl ; signal to the pc that we are not in buttom ifbit direction,lflags jmp limits_check0~1 sbit stopl,lflags ; turn off motor 1 rbit t2c0,t2cntrl sbit t2a,pl rbit controll,pa rbit control2,pa ld linear_stat,#0 ifbit stop2,aflags rbit start,flagsl Id temp,#low(wordready) jsr type~stringl limits check0 Id pls~ll;#0 Id pls x0,#0 ld pls~0,#0 Id pls~yl,#080 jmp limits check2_1 limits. checkl_O:rbit home,flagsl ; signal to the pc that we are not in home position.
ifbit bottom_Iimit,b jmp limits_check2 0 shit bottom,flagsl ~ ; signal to the pc that we are in buttom position.
ifbit direction,lflags jmp limits_checkl_1 jmp limits,checkl 2 limits checkl_l :jsr stop2motors rbit start,flagsl ld temp,#low(wordbottom) jsr type stringl limits checkl_2:1d pls_Yl,#066 ; to be calibrated.
Id pls x0,#088 jmp limits_check2 1 limits_check?_O:rbit bottom,flagsl ; signal to the pc that we are not in buttom position.
limits_checl:2 1:
;ifbit angular limit,b ret .***************************************************
buttons test:rbit buttons t en,buttons flags ld a,pli and a,#Oa0 1 a,b ifeq b,#Oa0 jmp b t0 O1 j mp b~t0 03 b1t0~01: ifeq ritut,#0 ; no key was pressed.
jmp b t0 02 ld a,ritut dec a x a,ritut b t0 02: ld start_stop_cntr,#0 Id home_position cntr,#0 jmp end b~test b_t0_03: ifeq ritut,#0 ; a key was pressed. ritut checks if it is a real press on jmp b_tl_00 ; a key, or just a vibration of the key.
b_t0 04: ld ritut,#5 ld start_stop cntr,#0 1d home~osition_cntr,#0 jmp b t0 02 b_tI 00: ifbit start_stop,b jmp b_t2_00 ; start-stop key was not pressed.
ifbit start stop,buttons flags ; start-stop key was pressed to stop operatic.
jmp b tl 02 ifbit home_command,buttons_flags jmp b tl OZ
ifbit self_t_command,buttons_flags jmp b tl 02 ld a,start stop cntr ; start-stop key was pressed to staxt operation.
me a s a,start stop cntr ifgt a,#150 jmp b tl_O1 jmp b t2 00 ------------- start/stop autorun key was pressed ------------------b_tl O1: ifbit start_stop,buttons flags jmp b tl 02 shit start_stop,buttons_flags ; start button was pressed to start operation.
ld autorun_stat,#0 j mp b t0 04 b_tl_02: sbit stop command,buttons flags; start button was pressed again to stop operation.
rbit start_stop,buttons~flags ld autorun_stat,#0 j mp b t0 04 b_t2_00: ifbit home~osition,b jmp end b test Id a,home~position cntr me a a,home-position cntr ifgt a,#150 jmp b t2 Ol jmp end b test ------------- home positonlself test key was pressed ------------------b_t2_O1: ifbit home limit,pbi ; 0-micro switch closed - in home position, jmp b t2 03 b t2 02: rbit home_command,buttons_flags ; not in home position - go to home position.
sbit self_t_command,buttons_flags Id selft stat.#0 shit fl~ t_en,flags2 ld data_cntr.#21 ld save-ptr,#0 ld send~tr,#0 rbit enddata,flagsl rbit start,flagsl rbit end,flagsl rbit stop,flagsl jmp b t0 04 b t2 03: Id a,pls_~0 ifgt a,#0 jmp b t2 04 ifeq pls 11,#0 jmp b t2 02 b_t2 04: shit home command,buttons_flags ; not in home position - go to home position.
ld home stat,#0 sbit fib t_en,flags2 Id data cntr,#21 ld save_ptr,#0 Id send_ptr,#0 rbit enddata,flagsl rbit start,flagsl rbit end,flagsl rbit stop,flags 1 jmp b t0 04 end b test:ret ***************************************************
.sect interups,rom,abs=Off;interrupts address push a Id a,s push a Id a,b push a ld a,l push a Id a,psw push a ld s,#0 ms end intr: rc rbit hc,psw pop a and a,#Oc0 ;save only c and he or a;psw x a,psw pop a x a,x pop a x a.b pop a x a,s pop a reti .****************************
.sect int_addres,rom,abs=Oleo .addrw reset ;vis without any interrupt .addrw reset ;port 1 or wake up interupts .addrw reset ;t3 b .addrw reset ;t3 a .addrw reset ;t2 b .addrw reset ;t2 a .addrw trns0 ;transmit .addrw rec0 ;receive .addrw reset ;reserved .addrw reset ;micro wire .addrw tmrlb ;imrl ;tlb .addrw tmrl a ;tmrl ;tl a .addrw tmr0 ;timer0 .addrw reset ;external interrupt-g0 .addrw reset ;reserved .addrw reset ;software intr interrupt .************************
.sect timer0,rom tmr0: rbit tOpnd,icntrl drsz lcd_cntr ; lcd counter to enable lcd update every O.lsec (2.~*4msec).
,j mp tmr0_O 1 sbit lcdupdate,tlags2 trnr0 O1: ld a,int cntr ; timer0 interrupts counter, used to help timing a2d,fix dec a ; transmit, and other actions according to timer0 cycles.
x a,int_cntr ifbit O,int cntr; odd - ; enable fix transmit.
jmp trnr0_O11 sbit a2den,flags2 ; even - ; enable a2d.
_i mp tmr0 02 tmr0_Ol l : sbit fi~_t_enl,flags2 shit buttons t en,buttons flags tmr0_02: ifbit stopl,lflags _j mp tmr0 04 ifbit en calc,lflags _jmp tmr0 03 j mp tmr0 04 tmr0 03: sc ; pt=pt2-ptl =time per pulse ld a,pt2lo subc a,ptllo 1 a,ptlo ld a,pt2hi subc a,ptlhi 1 a,pthi sbit enl~calc,lflags tmr0 04: ifbit stop2,aflags ,j mp tmr0 06 ifbit en calc2,aflags ,jmp tmr0 OS
_j mp tmr0 06 tmr0 O5: sc ; pt=pt2-ptl =time per pulse ld a,apt2lo subc a,aptllo s a,aptlo Id a,apt2hi subc a,aptlhi x a,apthi shit enl calc2,aflags tmr0_06:
end tmr0: ld a,cd dly ; delay before changing direction ifne a,#0 dec a a,cd_dly drsz uart_tmr jmp end~intr Id rec_stat,#0 _jmp end intr .***************************************************
.sect timerl,rom tmrla: rbit tlc0,cntrl ifbit tlpnda,psw jmp tmrlal j mp end tmr 1 a tmrlal : rbit tlpnda,psw Id a,ptllo x a,pt2lo ld a,ptl hi x a,pt2hi ld a,tlralo x a,ptllo Id a,tlrahi s a,ptlhi sbit pulse,lflags end tmrla:jmp end intr .*******************************************************
tmrlb: rbit tlpndb,icntrl ld a,aptllo x a,apt2lo ld a,aptlhi x a,apt2hi ld a,tlrblo x a,aptllo ld a,tlrbhi a,aptlhi shit pulse2,aflags end tmrlb:jmp end intr .*******************************************************
.sect uart transmit,rom,inpage trns0: Id a,tms_stat add a,#low(jmp t stat) jid ; jmp pcu,[a]
jmp t stat: .addr t s0,t sl t s0: jmp t stat0 t sl: jmp t statl end t stat:jmp end intr .***********************************************************
t stat0: rbit eti_enui ld trns_stat,#0 jmp end t stet t_statl: ld a,send_ptr ifgt a,#89 ; 0-89 => 90 bytes ,jmp t statl Ol ld a,send_ptr a,b ld s,#1 id a,[b+]
x a,tbuf Id s.#0 ld a,b a,send-ptr jmp end t stet t_statl_Ol:ifgt a,# 183 ; 90-179 => 90 bytes+1(buttons flags)+1(t check)+2('ED'[=END]) jmp end t statl Id a,send_ptr sc subc a,#90 1 a,b ld s,#2 Id a,[b+]
x a_tbuf Id s,#0 ld a_b add~a,#90 v a,send-ptr _jmp end t stet end_t_statl :ld send_ptr,#0 rb it eti, enui ld trns_stat,#0 .jmp end t stet .**************************************************
.sect uart receive,rom,inpage rec0: Id a,rbuf ; receive interrupt.
1 a,b ld a,check_sum add a,b x a,check sum Id a,rec_stat add a,#low(jmp r scat) jid ; jmp pcu,[a]
jmp r stet: .addr r s0,r sl,r s2,r s3 r~s0: jmp r stat0 r sl: jmp r statl r s2: jmp r stat2 r s3: jmp r stat3 end r stat:jmp end intr .***********************************
.sect receive states,rom r stat0: Id check sum,#0 Id a,b ifne a,#Of5 j mp a r~stat0 ld rec stet,#1 ld check sum,#0f5 a r_stat0:ld uart_tmr,#Off jmp end r stet r statl : Id a,b ifeq a,#'A' ; (041) ; Advance - moving command.
jmp r stat2 00 ifeq a,#'S' ; Stop command.
jmp r statl O1 ifeq a,#'H' ; Home position command.
jmp r statl 02 ifeq a,#'T' ; Self Test command.
jmp r statl 03 ifeq a,#'0' ; Operate auto run command.
jmp r statl 04 ifeq a,#'P' ; Ping (test communication) command.
jmp r statl_05 ld rec_stat,#0 jmp end r stet r_statl O1 obit stop command,buttons_flags ; 'S' - Stop.
ld tbytel,#0f5 jmp a r stat2 r_statl_02abit home command,buttons_flags ; 'H' - Home position.
ld home stet,#0 e_r_statl:ld tbytel,#Of5 sbit fit t_en,flags2 ld data cntr,#21 ld save_ptr,#0 ld send~tr,#0 rbit enddata,flagsl rbit start,flagsl rbit end,flags 1 rbit stop,flags 1 jmp a r stat2 r statl 03 obit self_t_command,buttons_flags ;'T' - SeIf Test.
1d selft stat.#0 jmp a r statl r_statl 04abit start_stop,buttons_flags ; 'O' - Operate auto run command.
ld autorun_stat.#0 jmp a r statl r_statl OS:Id tbytel,#Of5 ;'P' - Ping.
ld pb,#Of0 jmp a r stat2 r_stat2 OO:Id rec_stat,#2 Id rbyte num,#4 ; number of bytes to be received ld receive_ptr,#rbytel jmp end r stat r stat2: Id a,receive_ptr ; rbuf -> [receive_ptr]
a a,~
ld a,b ; receive_ptr + 1 -> receive_ptr x a,[x+]
ld a,~
a,receive_ptr drsz rbyte num jmp end_r stat sbit start,flagsl rbit stop,flagsl rbit end,flagsl sbit fi~_t_en,flags2 ifeq trns stat,# 1 jmp r stat2_Ol ld data cntr,#21 ; *************
Id save_ptr,#0 ld send~tr,#0 r_stat2 0l:ifbit motor,rbytel ; 0-motorl, 1-motor2.
jmp r stat2 03 Id a,rbyte3 ; motor 1 ifne a,#0 jmp r stat2_OZ
ld a,rbyte2 ifgt a,#0 ,Imp r stat2 OZ
sbit stop l ,lflags ; distance=0 ->Stop motor!
rbit start,flagsl shit end,flags 1 Id nxt_l stat,#0 Id linear stat,#6 jmp r stat2_05 r stat2_02:Id linear_stat.#I
sbit type start,lcd_flags; type'start' at line 2 of lcd.
rbit limits_c_en,limits_flags rbit enddata,flagsl rbit stopl,lflags jmp r stat2 05 r stat2 03:1d a,rbyte3 ; motor 2 ifne a,#0 jmp r stat2 04 Id a,rbyte2 ifgt a,#0 jmp r stat2_04 sbit stop2,aflags ; distance=0 ->Stop motor!!
rbit start,flagsl sbit end,flagsl ld nxt a stat,#0 Id ang stat,#6 jmp r stat2 05 r_stat2 04:1d ang stat,# 1 ; motor 2 sbit type start,lcd_flags; type'start' at line 2 of lcd.
rbit enddata,flagsl rbit stop2,aflags r stat2 05:Id a,check sum ; load byte to transmit x a,tbytel e_r stat2:ld a,tbytel ifeq trns stat,#0 x a,tbuf ld rec stat,#0 rbit stuck,flagsl jmp end r~stat r stat3: jmp end r stat .~******************~***********************************
a .sect datasend,rom data_send:ifbit ~x_t enl,flags2 jmp d s0 ret d_s0: rbit ~Y_t_enl,flags2 drsz data_cntr jmp d sl transmit s2 and s3 ld a,#I3 ; 13 is the sync. sign.
1 a,tbuf ; then send the data to the computer ld a,buttons flags a a,b ld a,t'check Id s,#2 x a.05a ld a,b a,OSb ld s,#1 ld a,059 ld s,#0 ~. a,0 ifbit enddata,0 ifbit enddata,flagsl rbit fiY_t en,flags2 ld t check,#0 ld trns stat,#1 Id data cntr,#21 ld save~tr,#0 ld send~tr,#0 sbit eti,enui jmp end d s d s 1: ifeq data_cntr,#
ld save~ptr,#0 ld a,#11 ifgt a,data cntr jmp d s2 ld b,#flagsl ; load data to stack.
ld a,[b-] ; flagsl push a ld a,[b-] ; pls~1 push a ld a,[b-J ; pls_y0 push a ld a,[b-] ; pls_xl push a ld a,[b-] ; pls_YO
push a ld a,[b-]; ha112 push a ld a,[b-]; halll push a ld a,[b-]; current2 push a ld a,[b-]; currentl push a Id a,save-ptr; save data from stack.
s a,b Id a,b a a.s Id s.#1 pop a x a,[b+]
pop a 1 a,[b+]
pop a 1 a,[b+]
pop a a,[b+]
pop a 1 a, [b+]
pop a 1 a,[b+]
pop a x a, [b+]
pop a 1 a,[b+]
pop a a,[b+]
Id a,t ; compute check check sum.
a,b Id a,[1+]=t_check, a =
; b currentl add a,b ; a =
currentl + b ta,b ;b=a Id a,[;~+]
add a,b 1 a,b ld a,[Z+]
add a,b z a,b Id a,[i+]
add a,b x a,b ld a,[1+]
add a,b a,b W
ld a,[~+]
add a,b x a,b ld a,[:~+]
add a,b a,b Id a,[~c+]
add a,b r a,b ld a,[Y+] ; a=flagsl add a,b ; a= flagsl + b ld s.#0 : t_check = a a a,t check ld a.~
x a,save_ptr _j mp end d s d_s2: ld b,#flagsl ; load data to stack.
ld a,[b-]
push a ld a,[b-]
push a ld a,[b-]
push a Id a,[b-]
push a Id a,[b-]
push a ld a,[b-]
push a ld a,[b-]
push a Id a,[b-]
push a ld a,[b-]
push a ld a,save~tr ; save data from stack.
a,b ld a,b 1 a,;~
ld s,#2 pop a z a,[b+]
pop a x ~[b+]
pop a a,[b+]
pop a z a,[b+]
pop a a,[b+]
pop a x a,[b+]
pop a a, [b+]
pop a x a,[b+]
pop a x a,[b+]
ld a,t_check ; compute check sum.
a,b ld a,[~+]; b=13, a= currentl add ; a= currentl a,b + b xa,b ;b=a ld a,[~+]
add a,b x a,b ld a,[Y+]
add a,b x a,b ld a,[~+]
add a,b a,b ld a,[~+]
add a,b x a,b ld a,[x+]
add a,b a a,b ld a,[~+]
add a,b .
xa,b ld a,[~+]
add a,b x a,b lda,[:~+]; a=flagsl add ; a = flags 1 a,b + b Id s,#0 ; t check = a 1 a,t check ld a,a x a,save_ptr end d s: ret .*******************************************************
.sect a2d_converter,rom a2d00: rbit a2den,flags2 ; the a2d prog. checks halll+2 and currentl+2 ld enad,#082 ; c=>adch8=b0, 2=>psr=1=mclk divide by 16.
sbit adbsy,enad a2d01: ifbit adbsy,enad jmp a2d01 ld a,adrsth x a,halll ld enad,#092 ; c=>adch9=bl, 2=>psr=1=mclk divide by 16.
shit adbsy,enad a2d02: ifbit adbsy,enad jmp a2d02 ld a,adrsth s a,ha112 ld enad,#Oa2 ; c=>adchl0=b2, 2=>psr=1=mclk divide by 16.
shit adbsy,enad a2d03: ifbit adbsy,enad jmp a2d03 ld a,adrsth x a,currentl ld enad,#Ob2 ; c=>adchl 1=b3, 2=>psr=1=mclk divide by 16.
shit adbsy,enad a2d04: ifbit adbsy,enad jmp a2d04 ld a,adrsth y a,current2 ret .*******************************************************
, .sect velosity_caculation,rom v calc: rbit enl calc,lflags ld a,t ref0 a a,0 ld a,t refl r a, l ld a,pthi ifgt a, l jmp tooslow ld a, l ifgt a,pthi jmp toofast ld a,ptlo ifgt a,0 jmp tooslow ld a,0 ifgt a,ptlo jmp toofast ret ; if they are equal the speed is ok tooslow: sc ; err= (pt - t_ref) _> (4,5) ld a,ptlo ; if t2ra + err*k >1000 then pwm=1000 (fastest) subc a.0 x a,4 ld a,pthi subc a.l a a.5 J
ld a,t2ralo s a,2 ld a,t2rahi x a.3 jsr mybyk ld a,0 a,2 ld a,l x a,3 ld a,4 s a,0 ld a,5 1 a, l jmp end_v_calc toofast: sc ; err= (t ref - pt) _> (4,5) ld a,0 ; if t2rb + err*k >1000 then pwm=0 (slowest) subc a,ptlo 1 a,4 ld a, l subc a,pthi s a,5 Id a,t2rblo s a,2 Id a_t2rbhi a,3 jsr mybyk ld a,4 a,2 ld a,5 a a,3 end v calc:ld b;#t2ralo ld s,#0 ld a,#1 ld tmr2hi,#2 ;loop2: ifgt a,tmr2hi jp loop2 ld a,[~+]
1 a,[b+]
Id a,[~+]
x a,[b+]
Id a,[z+]
1 a, [b+]
ld a,[Y]
x a,[b]
~ret .*******************************************************
v2 calc: rbit enl calc2,aflags ld a,at ref0 x a.0 Id a.at_refl x a, l ld a,apthi ifgt a, l ,jmp atooslow ld a, l ifgt a,apthi jmp atoofast ld a,aptlo ifgt a,0 _jmp atooslow ld a,0 ifgt a,aptlo .jmp atoofast ret ; if they are equal the speed is ok atooslow: sc ; err= (pt2 - at_ref) _> (~.,5) ld a,aptlo ; if t3ra + err*k >1000 then pwm=1000 (fastest) subc a,0 x a,4 ld a,apthi subc a.l x a,5 Id a,t3ralo x a,2 ld a,t3rahi s a,3 jsr mybyk ld a,0 1 a,2 ld a, l z a,3 ld a,4 x a,0 Id a.5 s a, l ,jmp end v2 talc atoofast: sc ; err= (at ref - pt2) _> (4,5) ld a,0 ; if t3rb + err*k >1000 then pwm=0 (slowest) subc a,aptlo 1 a,4 ld a,l subc a,apthi x a,5 ld a.t3rblo x a,2 Id a,t3rbhi a,3 _jsr mybyk ld a,4 1 a,2 ld a,5 a,3 end v2 calc:ld b,#t3ralo ld ~,#0 ld a,# 1 ld tmr3hi,#2 ;Ioop3: ifgt a,tmr3hi jp loop3 ld a,[Y+]
t a,[b+]
ld a,[Z+]
x a,[b+]
ld a,[Z+]
s a,[b+]
ld a,[x]
x a,[b]
ret .*******************************************************
.sect math functions,rom mybyk: ld cntr,#6 ; div. by 64 (=2~6) dvby2: rc ld a,5 rrc a x a,5 Id a,4 ~7 rrc a x a,4 drsz cntr _jmp dvby2 rc ; 4,5 <- err*k + t2 ld a,4 adc a,2 a,4 ld a.5 adc ~a,3 s a,5 ifeq 5,#0 _jmp lowedge ld a,5 ifgt a,#high(980) _jmp highedge Id a,#high(980) ifgt a,5 ,jmp end_mybyk ; not edge ld a,4 ifgt a,#low(980) .jmp highedge jmp end mybyk ; not edge highedge: ld 4,#low(980) ld 5,#high(980) Id 0,#20 ld 1,#0 ret lowedge: ld a,4 ifgt a,#20 _jmp end_mybyk ld 0,#low(980) ld 1,#high(980) Id 4.#20 ld 5,#0 ret end mybykac ld a,#low(1000) subc a,4 1 a,~
ld a,#high(1000) subc a,5 s a, l 7s Id a. l ifgt.a,#0 ret ld a,0 ifgt a,#20 ret ld 0,#20 Id 4,#low(980) Id 5,#high(980) ret '****** FDV168 - Fast 16 by 8 division subroutine *******************
490 instruction cycles maximum - 245usec.
dividend in [1,0] (dd) divisor in [3] (dr) quotient in [1,0] (quot) remainder in [2] (test field) fdv168: ld cntr,#16 ; load cntr with length of dividend field ld 2.#0 : clear test field.
fd168s:Id b,#0 fd1681:rc ld a,[b]
adc a,[b]; left shift dividend to x a,[b+]
ld a,[b]
adc a, ; left shift dividend [b] hi x a, [b+]
ld a,[b]
adc a,[b]; left shift test field x a,[b]
ld a,[b+]; test field to acc ifc ;
test if bit shiefted out of test field****
.jp fd168b sc subc a,[b]; test subtract divisor from test field ifnc ; test if borrow from subtraction .jp fdl68t fd168r:Id b,#2 ; subtraction result to test field x a,[b]
ld b.#0 ~
0,[b] ; set quotient bit sbit drsz cntr; dectement and test cntr for zero jp fd1681 ret ;
return from subroutine fdl drsz cntr; dectement and test cntr 68t: for zero _jp fd168s ret ~
; return from subroutine fd168b:subc a,[b]; subtract divisor from test field***
,jp fd168r ******* BINDEC - Binary to Decimal (packed BCD) **********************
bindec: Id cntr,#8 ; Bindec - Binary to Decimal (packed BCD) rc ; 856 cycles * 0.5 ~ 428 cycles = 213usec.
ld b,#1 ; binary in 0 => decinmal in 1,2 bd 1: ld [b+],#0 ifbne #3 jmp bdl bd2: ld b,#0 bd3: ld a,[b]
adc a, [b]
1 a,[b+]
ifbne #1 _jmp bd3 bd4: ld a,[b]
add a,#066 adc a,[b]
dcor a a,[b+]
ifbne #3 ,jmp bd4 drsz cntr _jmp bd2 ret .**********************************************
.sect lcd_update,rom updatelcd:ifbit lcdupdate,flags2 _jmp updatelcd0 ifeq lcd flags,#0 ret jmp updatelcd4 updatelcd0:rbit lcdupdate,flags2 ld lcd_cntr,#50 ld a,pls s0 x a,0 ld a,pls xl a, l ld a,#lpulsepermm ; linear pulses per mm x a,3 _jsr fdv 168 ; mm = pls_x/linear_pulses-per_mm _jsr bindec Id pd,#080 ; cursor home - address 0.
.jsr lcd com ld a,2 and a,#Of add a,#'0' so x a,pd jsr Icd_dat ld a, l swap a and a,#Of add a,#'0' z a,pd jsr lcd_dat ld a,l and a,#Of add a,#'0' t a,pd jsr lcd dat Id pd,#085 ; cursor address 5.
jsr lcd_com ifbit epi,flagsl jmp updatelcd5 ifbit 7,pls_yl jmp updatelcdl sc ; angel= - 08000-pls_y ld a,#0 subc a,pls_y0 a,0 ld a,#080 subc a,pls~l a, l ld pd,#'-' jmp updatelcd2 updatelcdl:ld a,pls-yl ; angel=+ pls_y-08000 and a,#07f a, l ld a,pls-y0 1 a,0 Id pd,#'+' updatelcd2:jsr lcd dat Id cntr,#3 updatelcd3 : rc ld a, l rrc a s a, l Id a.0 rrc a 1 a,0 drsz cntr jmp updateIcd3 ld 1.#0 _jsr bindec 1d a, l swap a and a,#Of add a,#'0' s a,pd _jsr lcd_dat Id a, l and, a,#Of add a,#'0' a,pd _jsr lcd_dat _jmp updatelcd4 updatelcd5:ld pd,#'e' jsr lcd_dat Id pd,#'p' jsr lcd_dat ld pd,#'i' .jsr 1cd dat updatelcd4: ifeq lcd~flags,#0 ret ifbit self_t_command,buttons flags ld lcd_flags,#0 ifbit start stop,buttons_flags ld lcd_flags,#0 ifeq lcd flags,#0 ret ifbit type start,lcd_flags ld temp,#low(wordstart); type 'start' at line 2 of lcd.
ifbit type end,lcd flags ld temp,#low(wordend) ifbit type Stuck,lcd_flags ld temp,#lowv(wordstuck) ifbit type stop,lcd flags ld temp,#low(twordstop) _jsr type stringl Id Icd_flags,#0 end updatelcd:ret .**********************************************
.sect lcd_orders,rom clean Icd:Id pd,#Ol a2 jsr lcd_com _jmp de116 ret .*****************************************
type string0:ld pd,#080 ; type string from the start of line 0.
jsr lcd com jmp type string type siringl :Id pd #Oc0 ; type string from the start of line 0.
jsr lcd com type string:ld a,temp inc a x a,temp jsr get char ifeq a,#' cr' ret x a,pd jsr lcd_dat jmp type string ******** subrutine to initialize lcd display init_lcd: ld a_# 10 init Icdl :jsr de116 dec a ifne a,#0 jp init Icdl init lcd2:ld pd,#O1 ;display clear jsr lcd_com jsr de116 Id pd,#06 ;increment cursor (cursor moves: left to right) jsr Icd com ld pd,#0c ;display on , cursor off jsr lcd com ld pd,#03f ;8 bits jmp Icd com ret ********** subrutine to transfer command to Icd display lcd_com: rbit rs,pa ;command end_com_dai:
sbit cs_Icd,pa rbit cs_lcd,pa .
Id cntr,# 10 loopl : drsz cntr jp loopl ret ********** subrutine to transfer data to lcd display lcd dat: sbit rs,pa :command jmp end com dat .******** delay ****************
de116: ld cntr,#2 de1160: ld temp,#250 ;1.6 msec delay dell6l : drsz temp jmp de1161 ld temp,#150 dell62: drsz temp _jmp dell62 drsz cntr _jmp de1160 ret .*****************************************
.sect string table,rom,inpage get char:laid ret .*****
ascii table *********************
wordmm: . db ' mm @' wordstart:.db'start cz' wordstop:. db 'stop @' wordpoweron:.db'power on@' wordhome:.db 'home @' wordstuck:.db'stuck @' wordend:.db'end @' wordbottom:.db'bottom @' wordready:.db'ready @' wordselftest:.db 'selftest@' wordautorun:.db'autorun @' wordinplace:. db 'in place@' endsect .END 0 ;end of program listing of intumed.asm Appendix 2 This is c8cdr. inc ************************************************************
*:k*****
This file include cop8cdr.inc, cop8.inc, cop8c3r.inc, 8cdr.chp, ports. inc(shortcuts).
;port definitions in cop8 with flash ped =090 ; port a data (output); pe is already taken by parity enable.
pec =091 ; port a configuration pet =092 ; port a input pf =094 ; port f data (output) pfc =095 ; port f configuration pfi=096 ; port f input pa =Oa0 ; port a data (output) pac =Oal ; port a configuration pat =Oa2 ; port a input pb =Oa4 ; port b data (output) pbc =Oa5 ; port b configuration pbi =Oa6 ; port b input pl =Od0 ; port 1 data (output) plc =Odl ; port 1 configuration pli=Od2 ; port 1 input pg=Od4 ; port g data (output) pgc =Od5 ; port g configuration pgi =Od6 ; port g input pc =Od8 ; port c data (output) pcc =Od9 ; port c configuration pct =Oda ; port c input pd =Odc ; port d data (output) This is cop8.inc ************************************************************
************~
;* Primary Chip Names with Designators .************************************************************
*********~**~
ANYCOP = 0 COP912C = 1 ; Basic Family COP820 = 2 COP840 = 3 COP880 = 4 COP820CJ = 5 COP840CJ = 6 COP8620 = 7 COP8640 = 8 COP8720 = 9 COP8780 = 10 COP943 = l I
COP888CF = 20 ; Feature Family COP888CG= 21 COP888CL = 22 COP888CS = 23 COP888EG = 24 COP888EK = 25 COPBACC = 26 COP888BC = 27 COP888EB = 28 COP888EW = 29 COP888FH = 30 COP888GD = 31 COP888GG = 32 COP888GW = 33 COP888HG = 34 COP888KG = 35 COP8SAA = 36 COPBSAB = 37 COP8SAC =38 COPBSGR = 39 COPBSGE = 40 COPBSEC = 41 COPBSER = 42 COP8AJC = 43 COP8AKC = 44 ------------ Flash based devices from here on COPBCBR = 60 COPBCCR = 61 COPBCDR = 62 COPBSBR = 63 COP8SCR = 64 COPBSDR = 65 COPy8 = 99 ---------------- End of COPB.INC
.*******************************************************
COPCHIP = COPBCDR ; Chip Definition This is cop8C3R.inc PLEASE: Consider update for CBR,CDR, and CCR.
Predeclare I/0 and control registers frequently used by COP8 programmer.
.macro setopt .mloc sec,wd,halt,flex .ifb ~1 ; if null sec 0 ; default value (not - secure) .else sec cz l -.
endif .ifb @2 ; if null wd 0 ; default value (Watchdog - enabled) .else wd eJr 2 -.
endif .if6 cr 3 ; if null halt 0 ; default value (HALT
- enabled) .else halt @3 -.
endif .ifb @4 ; if null flex 1 ; default value (Execute - from Flash) .else flex ~4 -. f endi .sect OPTION, CONF
CONFIG: . db ((sec shI 3 or wd) shl 1 or halt) shl 1 or flex . endm . ---------------- End of setecon Macro Definition _______________________________________________________________________ ; SFR Names and Register Bit Names Agree with the Feature Family User's Manual Redundant names match corresponding functions on Basic Family Documentation PORTED = 0x90:BYTE; Port E Data PORTEC = Ox91:BYTE; Port E Configuration PORTEP = Ox92:BYTE; Port E input pins (read only) PORTFD = Ox94:BYTE; Port F Data PORTFC = Ox95:BYTE; Port F Configuration PORTFP = Ox96:BYTE; Port F input pins (read only) PORTAD = 0xA0:BYTE; Port A Data PORTAC = OxAl :BYTE; Port A Configuration PORTAP = OxA2:BYTE; Port A input pins (read only) PORTBD = OxA4:BYTE; Port B Data PORTBC = OxAS:BYTE; Port B Configuration PORTBP = OxA6:BYTE; Port B input pins (read only) ISPADLO = OxAB:BYTE; ISP Address Register Low Byte ISPADHI - OxA9:BYTE; ISP Address Register High Byte ISPRD OsAA:BYTE ; ISP Read Data Register =
ISPWR OxAB:BYTE ; ISP Write Data Register =
TTNTA OxAD:BYTE ; High Speed Timers Interrupt = A
TINTB OxAE:BYTE ; High Speed Timers Interrupt = B
HSTCR OxAF:BYTE ; High Speed Timers Control = Register TMR3L0 = OxBO:BYTE; Timer 3 low byte TMR3HI = OxBI:BYTE; Timer 3 high byte T3RAL0 = OxB2:BYTE; Timer 3 RA register low byte T3RAHI = 0xB3:BYTE; Timer 3 RA register high byte T3RBL0 = OxB4:BYTE; Timer 3 RB register low byte T3RBHI = OxBS:BYTE; Timer 3 RB register high byte T3CNTRL ; Timer 3 control register = OxB6:BYTE
TBUF - OxBB:BYTE ; UART transmit buffer RBUF - 0xB9:BYTE ; UART receive buffer ENU - OxBA:BYTE ; UART control and status register ENUR - OxBB:BYTE; UART receive control and status reg.
ENUI - OxBC:BYTE ; UART interrupt and clock source reg.
BAUD - OxBD:BYTE; BAUD register PSR - OxBE:BYTE ; UART prescaler select register TMR2L0 = OxCO:BYTE ; Timer 2 low byte s8 TMR2HI = OxCI:BYTE ; Timer 2 high byte T2RAL0 = OxC2:BYTE ; Timer 2 RA register low byte T2RAHI = OxC3:BYTE ; Timer 2 RA register high byte T2RBL0 = OxC4:BYTE ; Timer 2 RB register low byte T2RBHI = OxCS:BYTE ; Timer 2 RB register high byte T2CNTRL = OxC6:BYTE ; Timer 2 control register Byte Byte WDSVR = OxC7:BYTE; Watch dog service register WKEDG = OxCB:BYTE; MIWU edge select register WKEN - OxC9:BYTE; MIWU enable register WKPND = OxCA:BYTE; MIWU pending register ENAD - OxCB:BYTE ; A/D Converter Control register ADRSTH = OxCC:BYTE; A/D Converter Result Register High ADRSTL - OxCD:BYTE ; A/D Converter Result Register Low ITMR - OxCF:BYTE ; Idle Timer Control Register PORTLD = OxDO:BYTE; Port L data PORTLC = OxDl:BYTE; Port L configuration PORTLP = OxD2:BYTE; Port L pin PORTGD = OxD4:BYTE; Port G data PORTGC = OxDS:BYTE; Port G configuration PORTGP = OxD6:BYTE; Port G pin PORTCD = OxD8:BYTE; Port C data PORTCC = OxD9:BYTE; Port C configuration PORTCP = OxDA:BYTE; Port C pin PORTD = OxDG:BYTE; Port D
PGMTIM = OxEl :BYTE; E2 and Flash Write Timing Register ISPKEY OxE2:BYTE ; ISP Key Register =
T1RBL0 = OxE6:BYTE; Timer 1 RB register low byte T1RBHI = OxE7:BYTE; Timer 1 RB register high byte ICNTRL = OxEB:BYTE; Interrupt control register SIOR - OxE9:BYTE ; SIO shift register SIO - OxE9:BYTE ; SIO shift register TMR1LO = OxEA:BYTE; Timer 1 low byte TMR1HI = OxEB:BYTE; Timer I high byte T1RALO = OYEC:BYTE ; Timer 1 RA register low byte T1RAHI = OZED:BYTE ; Timer 1 RA register high byte CNTRL = O~EE:BYTE ; control register PSW - O~EF:BYTE ; PSW register BYTECOUNTLO = OxFI:BYTE ; When JSRB Boot Rom used S - O1FF:BYTE ; Segment register, only COP888CG/CS!
_____________________________________________________.
Bit Constant Declarations.
----- Alternatection bit definitions fun on port G
INT - 0 ; Interrupt input INTR - 0 ; Interrupt input WDOUT = 1 ; Watchdog output T1B - 2 ; Timer T1B output T1A - 3 ; Timer T1A output SO - 4 ; Seriell output SK - 5 ; Seriell clock SI - 6 ; Seriell input CKO - 7 ; Halt,restart input ;
--- Alternate function bit definitions on port L
CKX - 1 ; eYt. clock I/O-pin/IJART
TDX - 2 ; transmit data/UART
RDX - 3 ; receive data/UART
T2A - 4 ; Timer T2A output T2B - 5 ; Tirner T2B output T3A - 6 ; Timer T3A output T3B - 7 ; Timer T3B output Alternate function bit definitions on port A
ACHO - 0 ; A/D-Channel 0 ACH1 - 1 ; A/D-Channel 1 ACH2 - 2 ; A/D-Channel 2 ACH3 - 3 ; A/D-Channel 3 ACH4 - 4 ; A/D-Channel 4 ACHS - 5 ; A/D-Channel 5 ACH6 - 6 ; A/D-Channel 6 ACH7 - 7 ; A/D-Channel 7 v Alternate function bit definitions on port B
ACH8 - 0 ; A/D-Channel 8 ACH9 - 1 ; A/D-Channel 9 ACHlO 2; A/D-Channel 10 -ACHI I 3; A/D-Channel 11 -ACH12 4; A/D-Channel 12 -ACH13 5; A/D-Channel 13 -MUXOUTN -5 ; A/D Mux Negative Output ACH14 6; AID-Channel 14 -MUXOUTP -5 ; AlD Mux Positive Output ACHIS 7; A/D-Channel 15 -ADIN - ; A/D Converter Input ----- Bit definitions CNTRL register TIC3 - 7 ; Timer 1 mode control TCI - T1C3 ; COP880/8401820 control signal name TIC2 - 6 ; Timer 1 mode control TC2 - TIC2 ; COP880/8401820 control signal name T1C1 - 5 ; Timer 1 mode control TC3 - T1C1 ; COP880/840/820 control signal name TICO - 4 ; Start/Stop timer in modes 1 and 2 Underfiow interrupt pending in mode 3 TRUN - Tl CO ; COP880/840/820 control signal name MSEL - 3 ; Enable Microwire IEDG - 2 ; Selects external intern. edge polarity SL1 - 1 ; Microwire clock divide select SL0 - 0 ; Microwire clock divide select ;-----Bit definitions PSW register HC - 7 ; Half Historical Redundant carry flag C - 6 ; Carry flag TIPNDA
= 5 ;
Timer TIA interrupt pending TPND - TIPNDA ; Historical Redundant T1ENA = 4 ; Timer TlA interrupt enable ENTI - T1ENA ; Historical Redundant EXPND = 3 ; External interrupt pending IPND - EXPND ; Historical Redundant BUSY - 2 ; Microwire busy shifting EXEN - 1 ; External interurpt enable ENI - EXEN ; Historical Redundant GIE - 0 ; Global intern. enable -----Bit definitions ICNTRL
register LPEN - 6 ; L-Port intern. enable TOPND = 5 ; Timer TO intern. pending TOEN - 4 ; Timer TO intern. enable WPND - 3 ; Microwire intern. pending WEN - 2 ; Microwire intern. enable TIPND B = 1 ; Timer TIB intern. pending flag TlENB = 0 ; Timer TIB intern. enable --- Bit definitions register T2C3 - 7 ; Timer T2 mode control TZC2 - 6 ; Timer T2 mode control T2C 1 5 ; Timer T2 mode control -T2C0 - ~. ; Timer T2A start/stop T2PNDA = ; Timer T2A intern pending 3 flag T2ENA = ; Timer T2A intern. enable T2PNDB = ; Timer T2B intern. pending 1 flag T2ENB = ; Timer T2B intern. enable ----- tionsT3CNTRL register Bit defini T3C3 - 7 ; Timer T3 mode control T3C2 - 6 ; Timer T3 mode control T3C1 - 5 ; Timer T3 mode control T3C0 - 4 ; Timer T3A start/stop T3PNDA = ; Timer T3A intern. pending 3 flag T3ENA = ; Timer T3A intern. enable T3PNDB = ; Timer T3B intern. pending 1 flag T3ENB = ; Timer T3B intern. enable Bit definitions HSTCR
register T9HS - 7 ; Timer T9 High Speed Enable TBHS - 6 ; Timer T8 High Speed Enable T7HS - 5 ; Timer T7 High Speed Enable T6HS - 4 ; Timer T6 High Speed Enable TSHS - 3 ; Timer T5 High Speed Enable T4HS - 2 ; Timer T4 High Speed Enable T3HS - 1 ; Timer T3 High Speed Enable T2HS - 0 ; Timer T2 High Speed Enable ; Bit definitions TINTA
register T9INTA= 7 ; Timer 9 Interrupt A
T8INTA= 6 ; Timer 8 Interrupt A
T7INTA= 5 ; Timer 7 Interrupt A
T6INTA= 4 ; Timer 6 Interrupt A
TS1NTA= 3 ; Timer 5 Interrupt A
T4INTA= 2 ; Timer 4 Interrupt A
T3INTA= 1 ; Timer 3 Interrupt A
Bit definitions TINTB
register T9INTB 7 ; Timer 9 Interrupt B
=
T8INTB 6 ; Timer 8 Interrupt B
=
T7INTB 5 ; Timer 7 Interrupt B
=
T6INTB 4 ; Timer 6 Interrupt B
=
TSINTB 3 ; Timer 5 Interrupt B
=
T4INTB 2 ; Timer 4 Interrupt B
=
T3INTB 1 ; Timer 3 Interrupt B
=
; Bit definitions ENAD register ADCH3 = 7 ; A/D Convertor Channel Select bit 3 ADCH2 = 6 ; A/D Convertor Channel Select bit 2 ADCHI = 5 ; A/D Convertor Channel Select bit 1 ADCHO = 4 ; A/D Convertor Channel Select bit 0 ADMOD = 3 ; A/D Convertor Mode Select bit ADMUX - 2 ; A/D Mux Out Control PSC - 1 ; A/D Convertor Prescale Select bit ADBSY= 0 ; A/D Convertor Busy Bit ----- Bit ENU register definitions PEN - 7 ; Parity enable PSEL1 - 6 ; Parity select PSELO = 5 ; Parity select XBIT9 = 5 ; 9th transmission bit in 9bit data mode CHL 1 - 4 ; Select character frame format CHLO - 3 ; Select character frame format ERR - 2 ; Error flag RBFL - 1 ; Received character TBMT - 0 ; Transmited character ;----- Bit deEnitions ENUR register DOE - 7 ; Data overrun error FE - 6 ; Framing error PE - 5 ; Parity error BD = ; Break Detect RBIT9 3 ; Contains the ninth bit (nine = bit frame!) ATTN - ? ; Attention mode XMTG - 1 ; indicate transmitting mode RCVG - 0 ; indicate framing error a ----- ition ENUI register Bit defin STP2 7 ; Select number of stop bits -BRK = 6 ; Holds TDX low to Generate a BREAK
ETDX - 5 ; Select transmit-pin 12 SSEL 4 ; Select UART-mode -XRCLK = 3 ; Select clock source for the receiver XTCLK = 2 ; Select clock source for the transmitter ERI - 1 ; Enable intern. from the receiver ETI - 0 ; enable intern. from the transmitter Bit Definitions for ITMR Register LSON - 7 ; Low Speed Oscillator Enable HSON - 6 ; High Speed Oscillator Enable DCEN - 5 ; Dual Clock Enable - Switches TO To Low Speed Clock CCKSEL - 4 ; Core Clock Select - Switches Instr Execution To Low Speed Clock ITSEL2 = 2 ; IDLE Timer Period Select bit 2 ITSEL1 = 1 ; IDLE Timer Period Select bit 1 ITSELO = 0 ; IDLE Timer Period Select bit 0 KEY = 0x98 ; Required Value for ISP Key - End of COP8C3R.INC
********
************************************************************
;This is 8cdr.chip CHIP 8CDR ; specifies max. ROM address 7FFF
;RAM=1K
this Ele.
;CHIP SPEC (chip table) for COP8CDR9xxxx parts PLEASE: Consider also update of files for CBR and CCR when modifying 0 value if undefined, address value otherwise mole - 0 romsize = 0x8000 ; ROM size ramhiOx6F ; segment 0 high address =
eelo 0 ; on-chip eerom range -eehi 0 -t3lo OxBO ; timer 3 registers -t3hi OxB6 -comp =0 ; comparator uartlo- OxB8 ; uart registers uarthi- OxBE
t2lo OxCO ; timer 2 registers -t2hi OxC6 -wdog - OxC7 ; watch dog service register miwulo- OxC8 ; miwu registers miwuhi- OxCA
a2dlo- OxCB ; ald registers a2dhi- OxCD
lportlo= OxDO ; 1 port registers lporthi= OxD2 gportlo= OxD4 ; g port registers gporthi= OxD6 iport0 ; i port -cportlo= OxD8 ; c port cporthi= OxDA
dportOxDC ; d port =
eecr 0 ; eerom control register -eromdr- 0 ; eerom data register eearlo- 0 ; eerom address registers eearhi - 0 ;icntrl - OxE8 ; icntrl register ; already defined microwire ; uWire SIO
= OxE9 tlalo - OxE6 ; tl auto ld tlrb tlahi - 0xE7 tlblo - OxEA ; tl reg tl bhi - OxED
;cntrl = OxEE ; cntrl reg ; already defined ;psw - OxEF ; psw reg ; already defined rnlo - OxFO ; RAM reg range rnhi - OxFF
segramlo = 0x0100; segments low to high segramhi = Ox077F
cntrl2 - 0 wdogctr =
modrel - 0 econ - Ox7FFF ; econ hex-file location cfgsize = 1 ; econ array cell address.
;family = 0 for basic family, family = 1 for feature family family - 1 Appendix. 3 '************* Constants definitions *******************
lpulsepermm=136 ; 16 * 22 / 2.54 = 138.58 = linear pulse per mm '************* Register Definitions *****************
f0 =Of0 ; not used uart_tmr =Ofl ; used as receive watch dog - when 0, return rec stat(receiving state) _ to 0.
rbyte =Of2 ; number of bytes to be received.
num tbyte_nurn= ; number of bytes to be transmitted.
O f3 temp =Of4 ; used for temporary calculations as variable or counter.
=Of5 ; not used cntr =Of6 ; used for temporary calculations as counter.
lcd_cnir =0fl ; used to refresh lcd every 0.1 sec (according to timer0 -25 *4msec) f8 =0f8 ; not used data cntr=0~ ; used to count 20 data packets.
fa =Ofa ; not used fb =Ofb ; riot used '**********
bits definitions *****************
>
rs=2 ; ; determines if the LCD gets command(0}
pa or data(1).
cs_lcd=3 ; ; send the information in the lcd data pa pins upon rise and fall( lcd.
/\~ of -cs controll=4; ;1 pa control2=5; ; / control 1+2 determine the direction pa of motor 1 cantrol3=6; ; \
pa control4=7; ; J control 3+4 determine the direction pa of motor 2 ;home_position=5;
pI
;start ;
stop=7 pl home limit=S;
pb bottom limit=6 ; pb angular limit=7;
pb .*****x~*****~ags ***************************************
direction=0; ; direction of motor 1 lflags first-pulse=1; ; if set then there was akeady 1 pulse, lflags en_calc=2; ; enables calculation of time per pulse.
lflags en 1 calc=3; ; enables calculation of velosity every.
lflags stopl=4 ; ; signals that motorl sould be stopped lflags pulse=5 ; ; signals that there was a pulse from lflagsmotor 1 direction2=0; aflags; direction of motor 2 firsty_pulse=1; ; if set then there was already aflags 1 pulse.
en_calc2=2; aflags; enables calculation of time per pulse.
enl_calc2=3; aflags; enables calculation of velosiiy every.
stop2=4 ; aflags; signals that motor2 sould be stopped pulse2=5; aflags; signals that there was a pulse from motor 2 start=0 ; flagsl; 1 when start command is received, 0 when stop command is issued.
home=1 ; flagsl; 1 when home micro switch (Normally Closed) is closed, o when open.
bottom=2; flagsl; 1 when bottoming micro switch (NO) is closed, o when open.
epi=3 ; flagsl; 1 when Epiglottis is sensed.
stop=4 ; flags; 1 when stop command is received, 0 1 when start command is issued.
end=5 ; flags; 1 when planned mission ends.
stuck=6 ; flags; 1 when a motor is stuck.
enddata=7; flags; additional bit for the PC to know when I the micro stops sending data.
fist en=0 ; flags2 ; generatl enable for saving and transmitting the blockes of data.
fix_t_enl=1 ; flags2 ; enable 1 block saving, and set every 8msec by timer0.
a2den=2 ; flags2 ; enables a/d Icdupdate=3 ; flags2 ; being set every O.lsec by timer 0 to refresh lcd.
type start=0 ; lcd_flags ; if set lcd could type "start" in line2.
type stop=1 ; lcd_flags ; if set lcd sould type "stop" in line2.
type end=2 ; Icd_flags ; if set lcd could type "end" in line2.
type stuck=3 ; lcd flags ; if set lcd could type "stuck" in line2.
new direction=3; rbytel ; the new direction for the motors as received from the pc.
motor=4 ; rbytel ; 0 - motorl, 1 - motor2.
buttons t en=0 ; buttons flags home command=1 ; buttons_flags home coirnnand_pc=2 ; buttons_flags self_t_command=3 ; buttons flags stop command=4 ; buttons_flags home_position=5 ; buttons_flags + pl start stop=7 ; buttons flags + pl limits_c_en=0 ; limits_flags to be shifted if it is the only bit in this byte.
.****** s=0 *******bytes definitions ***************************
Iflags =020 ; flags that belongs to linear motor (motorl).
aflags =021 ; flags that belongs to angular motor (motor2).
any stat ; angular motor work states.
=022 n1t_a_stat=023; save the next ang stat that come after a subroutine or an ang stat.
plsy cntr0=024; Isb ; angular distance that motor 2 could do in start command.
plsy cnirl=025; msb plc cntr0 ; lsb ; linear distance that motor 1 could =026 do in start command.
plc cntrl ; msb =027 linear stat=028 ; linear motor work states.
nit_1 stat=029 ; save the next linear_stat that come after a subroutine or an linear stat.
flags2 =02a ; save flags of lcd, a/d and fix t en.
cd_d1y =02b _ ; delay before changing direction to aloes the motor to reach a complete .
stop rec_stat =02c ; usart receiving work state.
trns stat=02d ; usart transmitting work state.
int~cntr =02e ; counter to help with timming. decreased by I every 4msec.
currentl =030 ; digital current from motor 1.
current2 =031 ; digital current from motor 2.
hall l =032 ; digital hall senssor from motor 1.
ha112 =033 ; digital hall senssor from motor 2.
pls x0 =034 lsb ; total linear distance in pulses.
;
pls xl =035 ; msb pls~0 =036 lsb ; total angular distance in pulses.
;
pls-yl =037 ; msb flagsl =038 ;
t_check =039 ; check sum of 1 packet of 20 blocks of currentl+...+flagsl checksum =03a ; check sum of received bytes in 1 command from the pc.
save_ptr =03b ; pointer to show where the next byte should be saved in the packet locksl,s2).
of 20 (s b send~tr =03 ; pointer to show from where the next c byte should be sent in the packet locksl,s2).
of 20 (s b zero_h =03 1 d zero h2 =03 a ptl to =040 ; lsb ; save the capture time of motor 1 last pulse.
timer 1 a pt 1 hi =04 ; msb I
pt2lo =042 ; lsb ; save the capture time of 1 pulse before motor 1 last puts e.
pt2hi =043 ; msb ptlo =044 ; lsb ; save the time between the last 2 pulses of motor 1.
calculated in timer0.
pthi =045 ; msb t ref0 =046 ; lsb ; the desired time between pulses of motor 1 as received from the pc.
t refl =047 ; msb aptllo =048 ; lsb ; save the capture time of motor 2 last pulse.
timer 1 b aptl hi =049 ; msb apt2lo =04a ; lsb ; save the capture time of 1 pulse before motor 2 last puts e.
apt2hi =04b ; msb aptlo =04c ; lsb ; save the time between the last 2 pulses of motor 2.
calculatedmer0.
in ti apthi =04d ; msb at_ref0 =04e ; lsb ; the desired time between pulses of motor 2 as received from the pc.
at refl =04f ; msb receive-pir-050 ; pointer where to store the byte that will be received next, rbytel=051 rbyte2=052 ; received bytes. .
rhyte3=053 ;
rbyte4=054 rbyte5=055 ;
trns~tr=056 ; pointer where the next byte to be transmitted is stored.
tbytel=057 ;
tbyte2=058 ; bytes to be transmitted.
tbyte3=05 9 ;
tbyte4=05 a ;
tbyte5=05b ;
tbyte6=05 c ;
tbyte7=05 d ;
packet cntr=05f ; counts the packets that are send every 160msec untill the micro returns to work state 0.
limits_flags =060 ; micro(limit) switches - normally closed.
buttons_fiags =061 ; buttons - normally closed.
ritut =062 ; ritut - counter to prevent buttons vibrations, only 3sec push is considered a prese.
start_stop cnir=063 ; counter of 3 sec.
home_position_cntr=064 ; counter of 3 sec.
selft_stat=065 ; work states of self test.
autorun_sta~066 ; work states of auto run.
Icd_t7ags=067 ; lcd flags - if set, something should be typed.
nolpulsetmr=068 ; timer to turn off motor if no pulses received - assuming the motor is stuck.
noapulsetmr=069 home stat=06a ; work states of home position.
Id s,#0 --- port definitions --- see ram.inc for bits definitions.
ld pgc,#033; clkdly enabled ; g2=tlb=cha2,g3=tla=chal - inputs ld pg,#0 ; sk idle phase=0 ld plc,#057 Id pl,#Oaf Id pbc,#010; b0-3 = a2d(in), b5-7 = limit switches(in) Id pb,#Of0 ld pac,#Off Id pa,#03 ---- DART initialization ---Id enu,#0 ; no parity, 8 bit data Id enur,#0 Id enui,#022 ; 1 stop bit, Asynch. mode,psr+baud clock enable receive int.,disable trans. int.
ld baud,#4 ; 38400 baud rate.
Id psr,#060 ; IOMHz*2 /(16*(4+1)*6.5) ----- LCD initialization -------------jsr init_lcd ld temp,#low(wordmm); type in line 1 of Icd " mm ", in the left side there is for jsr type string0 ; space for 3 digits of mm, and in the right side 3 spaces direction (+/- up/down) and 2 digits of movement.
ld temp,#low(wordpoweron) jsr type stringl ----- PWM,TO,interupts initialization -----------ld cntrl,#080 ; timer 1 - pwm mode - stopped.
ld a,#Off ; timer 1 would be used in capture mode, meaning that pulse timer 1 angular control3,4.
x a,tmrllo ; received from linear motor will capture the value of Id a.#Off ; in timer 1 auto reload A (tlrahi/lo) and pulse from a,tmrlhi ; motor in B (tlrbhi/lo).
ld t2cntrl,#OaO; timer 2 - pwm toggle mode stopped.
Id t3cntrl,#OaO; timer 3 - pwm toggle mode stopped.
shit t2a,pl ; enable linear motor and lock it by putting 0 in controll,?.
shit t3a,p1 ; enable angular motor and lock it by putting 0 in sbit t2hs,hstcr shit t3hs,hstcr ld cntrl,#060 ; timer 1 - capture mode.
rbit tlpndb,icntrl shit tlenb,icntrl ; timer 1 - capture mode, t2enB=1 rbit tlpnda,psw shit tlena,psw ; timer 1 - capture mode, t2enA=1 shit itsel0,itmr; 8,192 inst. cycles - 4,096 m. sec timer 0 interrupts.
rbit tOpnd,icntrl sbit t0en,icntrl ; start timer0.
---- Program initialization sbit 7,pls-yl ; pls_y=08000H
over 80 is positive angle and under 80 is negative angel.
ld data_cntr,#21 sbit stop2,aflags sbit direction,lflags sbit stopl,lflags shit en calc,lflags Id pls xl,#068 sbit limits c_en,limits_flags shit home_command,buttons_flags sbit gie,psw ; enable interupts.
jmp main .*************************************************
.sect pc module,rom main: ifbit limits_c_en,limits flags jsr limits_check ifbit start stop,buttons flags jsr autorun states ifbit stop command,buttons flags jsr stop operation ifbit buttons_t_en,buttons_flags jsr buttons test ifbit home command,buttons_flags jsr homed states ifbit self t_command,buttons flags jmp self t states main0: jmp linear states ; linear_states + angular states.
maim: jsrupdatelcd ifbit a2den,flags2 ; a2d check.
jsr a2d00 ld a,#0 add a,linear stet add a,ang-stet add a,autorun_stat add a,selft stet add a,home stet ifeq a,#0 shit enddata,flagsl ; if 2 motors are stopped, set enddata bit to stop transmitting to PC.
Id a,buttons_flags and a,#09e ; if one of the commands flags is set, reset enddata bit.
ifgt a,#0 rbit enddata,flagsl ifbit enddata,flagsl rbit start,flags 1 ifbit fix_t_en,flags2 jsr data send ,imp mam .*************************************************
.sect autorun_select,rom,inpage autorun_states:ld a,autorun_stat add a,#low(jmp a r stet) jid ; jmp pcu,[a]
jmp a r stet: .addr a r0,a _ _ _rl,a r2,a r3,a r4,a r5,a r6,a r7,a r8,a r9,a rl0,a rll,a rl2;,a rl3,a rl4 a r0: jmp a r stat0 a rl: jmp a r statl a r2: jmp a r stat2 a r3: jmp a r stat3 a r4: jmp a r stat4 a r5: jmp a r stat5 a r6: jmp a r stat6 a r7: jmp a r stat7 a r8: jmp a r stat8 a r9: jmp a r stat9 a r10:jmp a r statl0 a r j mp a r 11: stat 11 a_r j mp a_r_stat 12: 12 ;a jmp a_r_statl3 r13:
;a jmp a r statl4 r14:
end a r stat:ret .************************************
.sect autorun,rom a_r stat0:ld autorun_stat,#1 ld home stat,#0 sbit home command,buttons flags a_r_statl:ifbit home_command,buttons flags ret linear motor.
ld linear_stat,# 1 ; move linear forwards lmm.
ld rbytel,#08 ; 0,1,2=0=speedl ; 3=1= direction forwards ; 4=0=
ld rbyte2,#136 Id rbyte3,#0 ; lmm*136pulse per mm =136 pulses.
Id autorun_stat,#2 ld temp,#low(wordautorun) jsr type stringl a r statl-l:rbit limits c en,limits flags rbit stopl,lflags rbit stuck,flagsl a_r_statl_2abit fix_t en,flags2 jmp end a r stat a_r_stat2:ifeq linear stat,#0 ; wait until linear motor complete mission.
jmp a r stat2 0 jmp end a r stat a_r_stat2_O:Id a,halll a,zero hl Id a,hall2 z a,zero_h2 rbit home,flagsl ld ang stet,#1 ; move angular down 2000 pulses.
ld rbytel,#010 ; 0,1,2=0= speedl ; 3=0= direction down ; 4=1=
angular motor.
ld rbyte2,#low(2000) ld rbyte3,#high(2000) rbit stop2,aflags ld autorun_stat,#3 rbit stuck,flagsl jmp a r statl 2 a_r_stat3:ld linear_stat,# 1 ; move linear forwards 40mm.
Id rbytel,#08 ; 0,1,2=0= speedl ; 3=1= direction forwards ; 4=0=
linear motor.
Id rbyte2,#low(5440) ld rbyte3,#high(5440) ; 40mm* 136pulse per mm = 5440.
ld autorun stet,#4 jmp a r statl_l a r stat4:jsr epi check ; check if epiglotis sensed.
ifbit epi,flagsl j mp a r stat4_0 ifeq linear_stat,#0 ; wait until linear motor complete mission.
jmp a r stat7 0 jmp end a r stet a_r_stat4 O:Id linear_stat,#1 ; move linear backwards 6mm.
ld rbytel,#0 ; 0,1,2=0= speedl ; 3=0= direction backwards 4=0= linear motor.
ld rbyte2,#low(816) ld rbyte3,#high(816); 6mm*136pulse per mm = 816.
ld autorun_stat.#5 jmp a r statl-1 a_r_stat5:ifeq linear stet,#0 ; wait until linear motor complete mission.
jmp a r stat5 0 jmp end a r stet a_r_stat5_O:ld ang stet,#l ; move angular up 70 pulses.
ld rbytel,#Ol 8 ; 0,1,2=0= speedl ; 3=1= direction up ; 4=1=
angular motor.
ld rbyte2,#70 ld rbyte3,#0 ld autorun stet,#6 rbit stop2,aflags jmp a r statl 2 a_r_stat6:ifeq ang stet,#0 ; wait until angular motor complete mission.
jmp a r stat6 0 jmp end a r stet a_r stat6 Orbit epi,flagsl ld linear stet,#1 ; move linear forwards lOmm.
ld rbytel,#08 ; 0,1,2=0= speedl ; 3=1= direction forwards ; 4=0=
linear motor.
Id rbyte2,#low(1360) ld rbyte3;#high(1360) ; lOmm*136pulse per mm= 1360.
Id autorun stet,#7 _jmp a r~statl_1 a_r_stat7:ifeq linear stet,#0 ; wait until linear motor complete mission.
jmp a r stat7 0 jmp end a'r stet a_r_stat7 O:Id ang stet,#I ; move angular down 2000 pulses.
ld rbytel,#010 ; 0,1,2=0= speedl ; 3=0= direction down ; 4=1=
angular motor.
ld rbyte2,#low(2000) ld rbyte3,#high(2000) ld autorun_stat,#8 rbit stop2,aflags rbit stuck,llagsl jmp a r statl 2 a r stat8:;ld linear_stat,#1 ; move linear forwards 50mm.
;ld rbytel,#08 . ; 0,1,2=0= speedl ; 3=1= direction forwards ; 4=0=
linear motor.
;ld rbyte2,#low(8160) ;ld rbyte3,#high(8160) ; 50mm*136pulse per mm = 6800.
ld pls cntr0,#low(6800) ld pls cntrl,#high(6800) ; 50mm*136pulse per mm = 6800.
shit direction,lflags ; turn motor forwards rbit t2c0,t2cntrl shit t2a,pl rbit control2,pa sbit controll,pa ld linear stet,#6 rbit en calc,lflags ld autorun_stat,#9 jmp a r statl-1 a_r_stat9:ifeq linear stet,#0 ; wait until linear motor complete mission.
jmp a r stat9 0 jmp end a r stet a_r_stat9 O:ld ang stat,#l ; move angular up 2000 pulses.
ld rbytel,#Ol 8 ; 0, I,2=0= speedl ; 3=1= direction up ; 4=1=
angular motor.
Id rbyte2,#low(2000) Id rbyte3,#high(2000) Id autorun_stat,#10 rbit stop2,aflags .j mp a r stat 1 2 a r statl0:;ld linear_stat,#1 ; move linear forwards 70mm.
;ld rbytel,#08 ; 0,1,2=0= speedl ; 3=1= direction forwards ; 4=0=
linear motor.
;Id rbyte2,#low(9520) ;ld rbyte3,#high(9520) ; 70mm*136pulse per mm = 9520.
ld pls cntr0,#low(9520) ld pls cntrl,#high(9520) ; 70mm* 136pulse per mm = 9520.
shit direction,lflags ; turn motor forwards rbit t2c0,t2cntrl shit t2a,p1 rbit control2,pa shit controll,pa ld linear stat,#6 ld autorun_stat,#11 ,jmp a r statl-1 a r statl l :ifeq linear stat,#0 ; wait until linear motor complete mission.
_j mp a r stat 11 0 jmp end a._r stat a r statl 1 Oabit stop2,aflags rbit t3c0,t3cntrl sbit t3a,pl shit control3,pa ; iurn off motor 2 shit control4,pa ;ld linear_stat,#1 ; move linear forwards SOmm.
;ld rbytel,#08 ; 0,1,2=0= speedl ; 3=1= direction forwards ; 4=0=
linear motor.
;ld rbyte2,#low(6800) ;ld rbyte3,#high(6800) ; SOmm*136pulse per mm = 6800.
Id pls cntr0,#low(6800) Id pls cntrl,#high(6800) ; SOmm* 136pulse per mm = 6800.
Qo sbit direction,lflags ; turn motor forwards rbit t2c0,t2cnirl shit t2a,pl rbit control2,pa sbit controll,pa ld linear stat,#6 ld autorun_stat,#12 jmp a r statl_l a_r statl Z:ifeq linear_stat,#0 ; wait until linear motor complete mission.
j mp a r_stat 12 0 jmp end a r stat a_r_statl2_O:Id autorun_stat,#0 jsr stop2motors sbit en calc,lflags rbit start stop,buttons'flags rbit stuck,flagsl Id temp,#Iow(wordinplace) jsr type stringl jmp end a r stat .*************************************************
epi check:;ld a,#4 ;ifgt a,pls ~1 ;ret SC
ld a,halll ifgt a,zero_hl jmp epi checkO~I
Id a,zero_hl subc a,halll ,jmp epi check0 2 epi~check0_l:subc a,zero hl epi check0 2:ifgt a,#20 sbit epi,flagsl sc ld a,hall2 ifgt a,zero~h2 jmp epi check0 3 ld a,zero h2 subc a,hall2 jmp epi,check0 4 epi~check0_3aubc a,zero_h2 epi~checl:0_4:ifgt a,#20 shit epi,flagsl ret .*************************************************
a .sect I_s_select,rom,inpage linear_states:ld a,linear_stat add a,#low(jmp 1 stat) jid ; jmp pcu,[a]
jmp I stat: .addr 1 s0,1 sl,l s2,1 s3,1 s4,1 s5,1 s6 I s0: jmp 1 stat0 1 sl: jmp 1 statl I s2: jmp I stat2 I s3: jmp 1 stat3 I s4: .jmp 1 stat4 1 s5: jmp 1 stat5 1 sE: jmp I stat6 end 1 stat:jmp angular states .******************~*****************
.sect linear states,rom 1 stat0: ifbit pulse,lflags jmp 1 stat0_Ol ; the motor made another pulse after stop order.
jmp a 1 stat0 I stat0 Ol :rbit pulse,lflags 1 stat0 02ac ifbit direction,lflags ; x update jmp 1 stat0 03 ; x forwards Id a,pls_xl ; before decreasing pls x, check if pls x>1 ifne a,#0 jmp 1 stat0 02 Id a,pls_x0 ifgt a,#0 j mp I stat0_02 ifeq pls x0,#0 jmp a 1 stat0 ; do not decrease pls x if 0.
Id a,pls x0 ; x downwards subc a,# 1 x a,pls x0 Id a,pls xl subc a,#0 x a,plS xl jmp a 1 stat0 1 stat0_03:rc ; x forwards ld a,pls x0 adc a,#1 x a,pls x0 Id a,pls xl adc a,#0 x a,pls_xl a 1 stat0:jmp end 1 stat ; ->O
.*******************************************
a I_statl : ifbit direction,lflags ; check the previous direction.
,jmp 1 statl 02 ; the direction was backwards.
ifbit new_direction,rbytel ; check the new direction.
jmp 1 statl O1 jmp 1 stat3 I statl O1:ld nxt 1 stat,#4 ; change direction to forwards.
jmp 1 statl OS
; the direction was forwards.
I_statl 02:ifbit new_direction,rbytel ; check the new direction.
jmp 1 stat4 ld a,pls xl ; before changing diretion to backwards ifne a,#0 ; check if pls x=0.
jmp 1 statl 04 ; if not then...
ld a,pls x0' ifne a,#0 jmp 1 statl 04 1 statl 03:1d linear stat,#0 ; if 0 then just stop motor.
shit stopl,lflags ; stop motor 1.
rbit stop,flagsl sbit limits c en,limits flags sc ifbit stop2,aflags rc ifc jmp 1 statl_06 rbit start,flagsl shit end,flagsl sbit type end,lcd flags jmp 1 statl 06 1 statl 04:1d nxt 1 stat,#3 ; stop motor, wait and then change direction to backwards.
1_statl~OS:ld linear stet,#2 Id cd_dly,#020 I statl 06:rbit t2c0,t2cntrl sbit t2a,p1 rbit controll,pa ; stop motor 1.
rbit control2,pa jmp end 1 stet ; ->O
.*****************~*~*************************************************
l stat2: ifeq cdydly,#0 ; delay before changing direction.
j mp 1 stat2 O l jmp end 1lstat ; ->O
I stat2 Ol :ld a,nxt 1 stet x a,linear_stat jmp end I stet ; ->O
1'stat3: Id a,pls_xl ; the direction is still backwards.
ifne a,#0 ; check if pls x=0 jmp 1 stat3 O1 ; if not then...
Id a,pls 10 ifne a,#0 jmp 1 stat3_Ol jmp 1 statl_03 ; if 0 then just stop motor and return to linear stet 0.
I_stat3_Ol:ifbit home_limit,pbi jmp 1 stat3 02 jmp 1 statl_03 I stat3 02:rbit direction,Iflags ; turn motor backwards.
rbit t2c0,t2cntrl sbit t2a,p1 rbit controll,pa sbit control2,pa rbit t2a,p1 jmp 1 stag02 I stat4: ;Id a,pls-sl ; 255mm*128pulsepermm=7f80H
;ifgt a,#Ofe ; if pls Y>7f00H then stop motorl.
xjmp 1 statl_03 ifbit bottom_limit,pbi jmp 1 stagOl jmp 1 statl 03 ld linear stet,#0 sbit stopl,lflags jmp end 1 stet I stat4 Ol abit direction,lflags ; turn motor forwards rbit t2c0,t2cntrl sbit t2a,pl rbit control2,pa sbit controll,pa rbit t2a,pl I stat4 02:1d a,rbyte2 ce update ; distan s a,pls cntr0 Id a,rbyte3 v a,plslcntrl Id a,rbytel ; velocity update and a,#7 ifne a,#0 jmp 1 stat4_03 Id t_ref0,#Iow(1000) ; 1000 -> SOOu per pulse Id t_refl,#high(1000) jmp end 1 stat4 1 stat4,03:ifne a,#1 jmp 1 stat4_04 ld t red,#low(2000) ; 2000 -> 1000u per pulse ld t refl,#high(2000) jmp end 1 stat4 I stat4_04:ifne a,#2 jmp I stat4_OS
ld t_ref0,#low(3000) ; 3000 -> 1500u per pulse Id t refl,#high(3000) jmp end Ilstat4 I_stat4_OS:ifne a,#3 jmp end 1 stat4 Id t ref0,#low(4000) ; 4000 -> 2000u per pulse ld t refl,#high(4000) end I stat4:
.****************************************************
1 stat5: ifbit t2c0,t2cntrl ; if motor 1 is already on.
jmp a l,stat5 rbit first~ulse,lflags rbit t2cl,t2cntrl ; turn off the toggle output.
rbit t2a,pl ld ptlhi,#020 Id pt2hi,#080 ld tmr2lo,#Off Id tmr2hi,#0ff ld t2ralo,#Off Id t2rahi,#Off ld t2rblo,#Off Id t2rbhi,#Off rbit t2pndb,t2cntrl shit t2c0,t2cntrl ; start timer 2 - pwm.
I_stat5 Ol :ifbit t2pndb,t2cntrl jp 1 stat5_02 jp 1 stat5_O1 I_stat5_02:rbit t2c0,t2cntrl ; stop timer 2 - pwm.
ld tmr2lo,#250 ; 250->t2.
Id tmr2hi,#0 ld t2ralo,#low(400) ; 400->r2a.
id t2rahi,#high(400) Id t2rblo,#low(600) ; 600->r2b.
Id t2rbhi,#high(600) rbit t2a,p1 shit t2cl,t2cntrl ; turn on the toggle output.
shit t2c0,t2cntrl ; start timer 2 - pwm.
v rbit stopl,lflags a 1 stat5:ld a<int cntr se subc a,#20 s a,nolpulsetmr shit limits_c_en,limits_flags Id linear_stat,#6 ld nit l stat,#0 jmp end 1 stat ; ->O
.*****************************************************************
stat6: ifbit pulse,lflags jmp 1 stat6_O1 ld a,nolpulsetmr ifne a,int cntr jmp 1 stat6_OS
sbit st~pl,lflags shit stuck,flagsl jmp 1 stat6 OS
I stat6 01:rbit pulse,lflags Id a,int_cntr SC
subc a,#20 x a,nolpulsetmr shit limits c en,limits_flags sc i ; dec. pls cntr ld a,pls_cntr0 subc a,# 1 1 a,pls~cntr0 ld a,pls_cntrl subs a,#0 s a;pls cntrl ld a,pls,cntrl ; check if pls cntz=0 ifne a,#0 jmp 1 stat6 02 ld a,pls cntr0 ifne a,#0 jmp 1 stat6_02 sbit stopl,lflags 1 stat6~02:;ifbit first_pulse,lflags sbit en calc,lflags sbit first_pulse,lflags ifbit direction;lflags ;1 update ,jmp I stat6-04 ld a,pls~tl ; check if pls x>1 ifne a.#0 j mp 1 stat6_03 Id a,pls ~0 ifgt a,#0 jmp 1 stat6_03 Id ply Y0,#0 sbit stopl,lflags 1d nit 1 stat,#0 jmp I stat6 OS
1 stat6 03ac ; x_downwards ld a,pls x0 subc a,# 1 s a,pls x0 ld a,pls_~1 subc a,#0 x a,pls xl jmp I stat6 05 l stat6 04:rc ; ~ forwards ld a,pls x0 adc a,#1 1 a,pls YO
ld a,plslll adc a,#0 a,pls x1 ifgt a,#086 ; the 1cd can show only 256 mm (_ 256*136=34816=08800~I).
shit stopl,lflags I_stat6_OS:ifbit stopl,lflags jmp a I stat6 ifbit enl calc,lflags jsr vyealc jmp end 1 stet ; ->0 a 1 stat6:rbit t2c0,t2cntrl sbit t2a,p1 rbit controll,pa ; iurn off motor 2.
rbit control2,pa ld a,nxtl stet x a,linear stet itbit stop2,aflags jmp a I stat6 0 jmp end_l~stat ; ->0 a~l stat6 Orbit start,flagsl rbit stop,flagsl ifbit self t_command,buttons flags jmp end 1 stet ; ->O
ifbit start_stop,buttons_flags jmp end 1 stet ; ->0 ifbit home_command,buttons flags jmp end I stet ; ->0 shit type end,lcd_flags shit end,flagsl jmp end I'stat ; ->0 .***************************************************
.sect a_s_select,rom,inpage angular states:ld a,ang stet add a,#low(jmp a stet) jid ; jmp pcu,[a]
jmpla stet: .addr a s0,a sl,a s2,a s3,a s4,a s5,a s6,a s7 a s0: jmp a stat0 a sl: jmp a statl a s2: ,jmp a stat2 a s3: jmp a stat3 a s4: jmp a stat4 a s5: j mp a stat5 a sE: jmp a stat6 a s7: jmp a stat7 end a stat:jmp maim .************************************
.sect angular_states,rom a_stat0: ifbit pulseZ,aflags jmp a stat0 Ol _jmp a a stat0 a_stat0 Ol:rbit pulse2,aflags ifbit direction2,aflags ; y update jmp a stat0_02 jmp a stat0 03 a stat0_02ac ; y down ld a,pls_y0 subc a,#1 1 a,pls-y0 ld a,pls_yl subc a,#0 1 a,pls-yl jmp a a stat0 a stat0 03:rc ; y up Id a,pls_y0 adc a,#1 a,pls-y0 ld a,pls-yl adc a,#0 i a,pls-yl a a stat0:jmp end a stat ; ->O
.**********************************
a statl:
ld a,pls_yl ; check if the the probe is not too high or to low.
ifgt a,#094 jmp a statl 00 ld a,#066 ifgt a,pls_yl jmp a statl O1 jmp a statl 03 ;a statl OO:ifbit new_direction,rbytel ; if too high enable only down movment.
jmp a statl_02 jmp a statl_03 ;a statl Ol :ifbit new direction,rbytel ; if too low enable only up movment.
imp a statl_03 jmp a statl-02 ;a statl 02:1d ang_stat,#0 ; just stop motor ld nlt a stat,#0 sbit stop2,aflags ; stop motor 2.
sbit type end,flags2 jmp a statl 08 a stat1V03:ifbit direction2,aflags ; check the previous direction.
jmp a statl OS
direction.
ifbit new direction,rbytel ; the direction was down-check the new jmp a statl 04 jmp a stat3 a statl 04:1d nlt a stat,#4 ; stop motor, wait and then change direction to up.
jmp a statl 07 a statl OS:ifbit new_direction,rbytel ; the direction was up-check the new direction.
jmp a~stat~l a statl 06:1d mt a stat,#3 ; stop motor, wait and then change direction to down.
a_statl 07:1d ang_stat,#2 ; delay for the motor to make a complete stop.
ld cd_dly,# 17 a_statl 08:rbit t3c0.t3cntrl sbit t3a,p1 shit control3,pa ; stop motor 2.
shit control4,pa jmp end a stat ; ->0 .*******************~*************************************************
a stat2: ifeq cd_dly,#0 ; delay before changing direction.
jmp a stat2; Ol jmp end_a stat ; ->O
a_stat2~Ol:ld a,n~t_a_stat x a,angstat jmp end a stat ; ->O
.******************~~**************************************************
*
a stat3: rbit direction2,aflags ; turn motor backwards.
rbit t3c0,t3cntrl sbit t3a,pl rbit control3,pa shit control4,pa rbit t3a,pl jmp a stag O1 .*******************************************
a_stat~.: sbit direction2,aflags ; turn motor forwards rbit t3c0,t3cntrl sbit t3a,p1 rbit control4,pa sbit control3,pa rbit t3a,p1 a_stat~ Ol:ld a,rbyte2 ; distance update 1 a,plsy cntr0 Id a,rbyte3 v a,plsy_cntrl Id a,rbytel ; velosity update and a,#7 ifne a,#0 _jmp a stat4_02 ld at_ref0,#low(6000) ; 6000 -> 3000u per pulse ld at_refl,#high(6000) jmp end a stat4 a_stat4 02:ifne a,#1 jmp a stat4 03 ld at_ref0,#low(7000) ; 7000 -> 3500u per pulse ld at_refl,#high(7000) jmp end a stat4 a_stat4_03:ifne a,#2 jmp a stat4_04 Id at_ref0,#low(8000) ; 8000 -> 4000u per pulse ld at_refl,#high(8000) jmp end a stat4 a stat4 04:ifne a,#3 .
jmp end_a stat4 ld at_ref0,#low(9000) ; 9000 -> 4500u per pulse Id at refl,#high(9000) end a stat4:ld nit a Stat,#6 .****************************************************
a stat5: ;ifbit t3c0,t3cntrl ; if motor 2 is already on.
xjmp a a stat5 ld aptlhi,#020 ld apt2hi,#080 rbit firsty_pulse,aflags rbit t3cl,t3cntrl ; turn off the toggle output.
rbit t3a,p1 ld tmr3lo,#Off ld tmr3hi,#Off ld t3ralo.#Off Id t3rahi,#0ff ld t3rblo,#Off ld t3rbhi,#Off rbit t3pndb,t3cntrl sbit t3c0,t3cntrl ; start timer 3 - pwm.
a_stat5 Ol:ifbit t3pndb,t3cntrl jp a stat5 02 j p a stat5-O l a stat5 02:rbit t3c0,t3cntrl ; stop timer 3 - pwm ld tmr3lo.#250 : 250->t3.
Id tmr3hi,#0 Id t3ralo;#low(500) ; 500->r3a.
ld t3rahi,#high(500) ld t3rblo,#low(500) ; 500->r3b.
ld t3rbhi,#high(500) rbit t3a,pl shit t3cl,t3cntrl ; turn on the toggle output.
sbit t3c0,t3cntrl ; start timer 3 - pwm.
a a stat5:;ld a,int cntr ac ;subc a,#50 ;1 a,noapulsetmr ld a,n~t a stat 1 a,ang stat Id nxt a stat,#0 _j mp end a stat ; ->O
.**********************************
a_stat6: ifbit pulse2,aflags ,jmp a stat6 O1 ;ld a,noapulsetmr ;ifne a,int cntr ;jmp a stat6_06 ;sbit stop2,aflags ;shit stuck,flagsl _jmp a stat6 06 a_stat6-Ol:rbit pulse2,aflags ;ld a,int cntr ;sc ;subc a,#50 ;x a,noapulsetmr sc ; dec. plsy cntr ld a,plsy cntr0 subc a,# 1 x a,plsy,cntr0 Id a,plsy_cntrl subc a#0 x a,plsy cntrl ld a,plsy_cntrl ; check if plsy_cntr=0 ifne a,#0 .jmp a stat6 02 Id a,plsy cntr0 ifne a,#0 ,jmp a stat6 02 shit stop2,aflags ld nxt a stat,#0 a_stat6 02:;ifbit firsty_pulse,aflags sbit en_calc2,aflags shit firsty_pulse,aflags ifbit direction2,aflags ; y update jmp a stat6 04 ld a,pls_yl ; check if pls_y>6500H
ifgt a,#0 ; 065 jmp a stat6_03 sbit stop2,,aflags ld n1t a stat,#0 jmp a stat6 06 a stat6 03ac ; y down ld a,pls_y0 subc a,#1 x a,pls_y0 Id a,pls-yl subc a,#0 v a,pls-yT
jmp a stat6 06 a_stat6-04:Id a,#Off ; 096 ifgt a,pls_yl jmp a stat6_05 sbit stop2,aflags ld nxt a scat,#0 jmp a stat6 06 a stat6 05:rc ; y up ld a,pls_y0 adc a,#1 1 a,pls-y0 ld a,pls~l adc a,#0 1 a,pls_yl a_stat6 06:ifbit stop2,aflags jmp a a stat6 ifbit enl_calc?;aflags jsr v2_calc jmp end a stat ; ->p a a s tat6:
rbit t3c0,t3cntrl sbit t3a,p1 sbit control3,pa ; turn off motor 2 sbit control4,pa ld a;nlt a stet a,ang-stet ifbit stopl,lflags jmp a a stat6 0 jmp end_a stet ; ->0 e_a_stat6 Orbit start,flagsl rbit stop,flagsl ifbit self_t command,buttons flags jmp -end a stet ; ->p ifbit start stop,buttons_flags jmp end a stet ; ->O
ifbit home_command,buttons_flags jmp end_I stet ; ->O
sbit end,flags 1 sbit type end,lcd_flags ifbit stuck,flagsl sbit type stuck,lcd_flags jmp end a stet ; ->0 .***************************************************
a stat7: ifbit pulse2,aflags _Imp a stat7_Ol jmp a a stat7 a_stat7 Ol :rbit pulse2,aflags ifbit direction2,aflags ; y update jmp a stat0 03 a_stat7 02ac ; y down ld a,pls~0 subc a,# 1 1 a,pls~0 ld a,pls-yl subc a,#0 x a,pls_yl jmp a a stat7 a stat7 03:rc ; y up Id a,pls_y0 adc a,#1 a,pls_y0 ld a,pls~l adc a,#0 1 a,pls~l a a_stat7:jmp end_a_stat ; ->O
***************************************************
.sect stop-subroutines,rom stop2motorsabit stopl,lflags ; turn off motor 1 rbit t2c0,t2cntrl shit t2a,p1 rbit controll,pa rbit control2,pa ld linear stet,#0 ld nlt 1 stet,#0 shit stop2,aflags ; turn off motor 2 rbit t3c0,t3cntrl sbit t3a,p1 shit control3,pa sbit control4,pa ld ang stet,#0 ld nYt a stet,#0 ret stop operation:rbit stop command,buttons flags jsr stop2motors sbit en calc,lflags sbit i-il t en,flags2 rbit enddata,flagsl rbit start,flagsl rbit end,flagsl shit stop,flagsl sbit type stop,lcd_flags rbit self_t_command,buttons_flags ld selft stet,#0 rbit start_stop,buttons flags ld autorun_stat,#0 rbit home_command~c,buttons_flags rbit home command,buttons_flags ld home stet,#0 ret .***************************************************
.sect s t_select,rom,inpage self_t_states:ld a,selft_stat add a,#low(jmp st_stat) _jid ; jmp pcu,[a]
,imp st stet: .addr s t0,s tl,s t2,s t3,s t4,s t5,s t6 s t0: jmp self test0 s tl: jmp self testl s t2: jmp self test2 s t3: jmp self test3 s t4: jmp self test4 s~t5: jmp self tests s t6: jmp self test6 end st stat:jmp main0 .************************************
.sect self_test,rom self_test0:ld temp,#low(wordselftest) jsr type stringl ifbit home limit,pbi jmp self test0 0 ; 1-micro switch open - not in home position.
rbit home command,buttons_flags ld home_stat,#0 jmp self testl 0 ; 0-micro switch closed - in home position.
self_test0 Oabit home command,buttons_flags ld home stat,#0 ld selft stat,#1 jmp end st stat self_testl :ifbit home_command,buttons flags jmp end st stat self_testl O:ld linear_stat,#1 ; move linear forwards SOmm.
Id rbytel,#08 ; 0,1,2=0= speedl ; 3=1= direction forwards ; 4=0=
linear motor.
ld rbyte2,#low(6850) ld rbyte3,#high(6850) ; SOmm*136pulse per mm = 6800.
ld selft stat,#2 self_testl-l:rbit limits c_en,limits_flags rbit stopl,lflags self testl,2:jmp end st stat self test2:ifeq linear_stat,#0 ; wait until linear motor complete mission.
jmp self test2 0 jmp end st stat self_test2 O:ld ang scat,#1 ; move angular up I50 pulses.
Id rbytel,#018 ; 0,1,2=0= speedl ; 3=1= direction up ; 4=1=
angular motor.
ld rbyte2,#150 Id rbyte3,#0 ld selft_stat.#3 rbit stop2;aflags shit en_calc2,aflags jmp self testl 2 self_test3:ifeq ang stat,#0 ; wait until angular motor complete mission.
jmp self test3 0 jmp end st stet self test3 Orbit en calc2,aflags Id ang-stet,#1 ; move angular down 400 pulses.
ld rbytel,#010 ; 0,1,2=0= speedl ; 3=0= direction down ; 4=1=
angular motor.
ld rbyte2,#low(300) ld rbyte3,#high(300) Id selft stet,#4 rbit stop2,aflags jmp self testl 2 self_test4:ifeq ang stet,#0 ; wait until angular motor complete mission.
jmp self test4 0 jmp end st stet self test4-O:Id ang stet,#1 ; move angular again up 150 pulses.
ld rbytel,#018 ; 0,1,2=0=speedl ; 3=1= direction up ; 4=1=
angular motor.
ld rbyte2,#150 Id rbyte3,#0 ld selft stet,#5 rbit stop2,aflags sbit en_calc2,aflags jmp self testl 2 self_test5:ifeq ang stet,#0 ; wait until angular motor complete mission.
jmp self tests 0 jmp end st stet self_test5 Orbit en_calc2,aflags ld linear stet,#1 ; move linear backwards 50mm.
ld rbytel,#0 ; 0,1,2=0= speedl ; 3=0= direction backwards 4=0= linear motor.
ld rbyte2,#low(6850) Id rbyte3,#high(6850) ; 50mm*136pulse per mm = 6800.
Id selft stet,#6 jmp self testl-1 self_test6:ifeq linear_stat,#0 ; wait until linear motor complete mission.
jmp self test6 0 jmp end st stet self_test6 O:ld selft_stat,#0 rbit self t command,buttons flags rbit stuck,flagsl Id temp,#low(wordready) jsr type~stringl jmp end st stat .***************************************************
.sect h_p select,rom,inpage homerp,states:ld a,home_stat add a,#low(jmp h stat) jid ; jmp pcu,ja]
jmp h stag .addr h~p0,h_pI
h_p0: jmp home~p0 h_p 1: jmp homelp 1 .**********************************************************************
*****
.sect home-positioning,rom home~p0: ifbit home limit,pbi ; 0-micro switch closed - in home position, jmp home_p0 2 ; 1-micro switch open - not in home position.
jmp home_pl 0 home~a0 2: jsr stop2motors ld lcd_flags,#0 rbit direction,lflags ; so the bottom wouldn't shut down the motor.
ld linear_stat,#1 ; move linear bach-wards 200mm.
Id rbytel,#0 ; 0,1,2=0= speedl ; 3=0= direction backwards 4=0= linear motor.
ld rbyte2,#low(27200) ld rbyte3,#high(27200) ; 200mm*136pulse per mm = 27200.
rbit stopl,lflags sbit fi~_t_en,flags2 rbit start,flagsl rbit stop,flagsl rbit end,flagsl rbit enddata,flagsl ld home stat,#1 ifbit self t command,buttonslflags ret ld temp,#low(wordhome) jsr type~stringl horne_pl : ifeq linear_stat,#0 ; wait until linear motor complete mission.
jmp home_p 1 0 ret home_pl O:ld home stat,#0 rbit home_command,buttons flags rbit epi,flagsl ifbit stuck;flagsl jmp home~l_1 ld plslx0,#0 Id pls xl,#0 Id pls=y0,#0 Id pls_yl,#080 homepl_l:ifbit self_t_command,buttons flags ret ifbit stuck,flagsl ret ld temp,#low(wordready) jsr type stringl ret ***************************************************
.sect limits_check,rom limits_check:ld a,pbi ; general limits check (limits = b5,b6,b7).
and a,#060 ; Oe0 - if the angular limit switch is on.
ifne a,#060 jmp limits_check0_0 rbit home,flagsl ; signal to the pc that we are not in home position.
rbit bottom,flagsl ; signal to the pc that we are not in buttom position.
ret limits_check0 Oa a,b ifbit home_limit,b jmp limits checkl 0 position.
shit home,flagsl ; signal to the pc that we are in home position.
rbit bottom,flagsl ; signal to the pc that we are not in buttom ifbit direction,lflags jmp limits_check0~1 sbit stopl,lflags ; turn off motor 1 rbit t2c0,t2cntrl sbit t2a,pl rbit controll,pa rbit control2,pa ld linear_stat,#0 ifbit stop2,aflags rbit start,flagsl Id temp,#low(wordready) jsr type~stringl limits check0 Id pls~ll;#0 Id pls x0,#0 ld pls~0,#0 Id pls~yl,#080 jmp limits check2_1 limits. checkl_O:rbit home,flagsl ; signal to the pc that we are not in home position.
ifbit bottom_Iimit,b jmp limits_check2 0 shit bottom,flagsl ~ ; signal to the pc that we are in buttom position.
ifbit direction,lflags jmp limits_checkl_1 jmp limits,checkl 2 limits checkl_l :jsr stop2motors rbit start,flagsl ld temp,#low(wordbottom) jsr type stringl limits checkl_2:1d pls_Yl,#066 ; to be calibrated.
Id pls x0,#088 jmp limits_check2 1 limits_check?_O:rbit bottom,flagsl ; signal to the pc that we are not in buttom position.
limits_checl:2 1:
;ifbit angular limit,b ret .***************************************************
buttons test:rbit buttons t en,buttons flags ld a,pli and a,#Oa0 1 a,b ifeq b,#Oa0 jmp b t0 O1 j mp b~t0 03 b1t0~01: ifeq ritut,#0 ; no key was pressed.
jmp b t0 02 ld a,ritut dec a x a,ritut b t0 02: ld start_stop_cntr,#0 Id home_position cntr,#0 jmp end b~test b_t0_03: ifeq ritut,#0 ; a key was pressed. ritut checks if it is a real press on jmp b_tl_00 ; a key, or just a vibration of the key.
b_t0 04: ld ritut,#5 ld start_stop cntr,#0 1d home~osition_cntr,#0 jmp b t0 02 b_tI 00: ifbit start_stop,b jmp b_t2_00 ; start-stop key was not pressed.
ifbit start stop,buttons flags ; start-stop key was pressed to stop operatic.
jmp b tl 02 ifbit home_command,buttons_flags jmp b tl OZ
ifbit self_t_command,buttons_flags jmp b tl 02 ld a,start stop cntr ; start-stop key was pressed to staxt operation.
me a s a,start stop cntr ifgt a,#150 jmp b tl_O1 jmp b t2 00 ------------- start/stop autorun key was pressed ------------------b_tl O1: ifbit start_stop,buttons flags jmp b tl 02 shit start_stop,buttons_flags ; start button was pressed to start operation.
ld autorun_stat,#0 j mp b t0 04 b_tl_02: sbit stop command,buttons flags; start button was pressed again to stop operation.
rbit start_stop,buttons~flags ld autorun_stat,#0 j mp b t0 04 b_t2_00: ifbit home~osition,b jmp end b test Id a,home~position cntr me a a,home-position cntr ifgt a,#150 jmp b t2 Ol jmp end b test ------------- home positonlself test key was pressed ------------------b_t2_O1: ifbit home limit,pbi ; 0-micro switch closed - in home position, jmp b t2 03 b t2 02: rbit home_command,buttons_flags ; not in home position - go to home position.
sbit self_t_command,buttons_flags Id selft stat.#0 shit fl~ t_en,flags2 ld data_cntr.#21 ld save-ptr,#0 ld send~tr,#0 rbit enddata,flagsl rbit start,flagsl rbit end,flagsl rbit stop,flagsl jmp b t0 04 b t2 03: Id a,pls_~0 ifgt a,#0 jmp b t2 04 ifeq pls 11,#0 jmp b t2 02 b_t2 04: shit home command,buttons_flags ; not in home position - go to home position.
ld home stat,#0 sbit fib t_en,flags2 Id data cntr,#21 ld save_ptr,#0 Id send_ptr,#0 rbit enddata,flagsl rbit start,flagsl rbit end,flagsl rbit stop,flags 1 jmp b t0 04 end b test:ret ***************************************************
.sect interups,rom,abs=Off;interrupts address push a Id a,s push a Id a,b push a ld a,l push a Id a,psw push a ld s,#0 ms end intr: rc rbit hc,psw pop a and a,#Oc0 ;save only c and he or a;psw x a,psw pop a x a,x pop a x a.b pop a x a,s pop a reti .****************************
.sect int_addres,rom,abs=Oleo .addrw reset ;vis without any interrupt .addrw reset ;port 1 or wake up interupts .addrw reset ;t3 b .addrw reset ;t3 a .addrw reset ;t2 b .addrw reset ;t2 a .addrw trns0 ;transmit .addrw rec0 ;receive .addrw reset ;reserved .addrw reset ;micro wire .addrw tmrlb ;imrl ;tlb .addrw tmrl a ;tmrl ;tl a .addrw tmr0 ;timer0 .addrw reset ;external interrupt-g0 .addrw reset ;reserved .addrw reset ;software intr interrupt .************************
.sect timer0,rom tmr0: rbit tOpnd,icntrl drsz lcd_cntr ; lcd counter to enable lcd update every O.lsec (2.~*4msec).
,j mp tmr0_O 1 sbit lcdupdate,tlags2 trnr0 O1: ld a,int cntr ; timer0 interrupts counter, used to help timing a2d,fix dec a ; transmit, and other actions according to timer0 cycles.
x a,int_cntr ifbit O,int cntr; odd - ; enable fix transmit.
jmp trnr0_O11 sbit a2den,flags2 ; even - ; enable a2d.
_i mp tmr0 02 tmr0_Ol l : sbit fi~_t_enl,flags2 shit buttons t en,buttons flags tmr0_02: ifbit stopl,lflags _j mp tmr0 04 ifbit en calc,lflags _jmp tmr0 03 j mp tmr0 04 tmr0 03: sc ; pt=pt2-ptl =time per pulse ld a,pt2lo subc a,ptllo 1 a,ptlo ld a,pt2hi subc a,ptlhi 1 a,pthi sbit enl~calc,lflags tmr0 04: ifbit stop2,aflags ,j mp tmr0 06 ifbit en calc2,aflags ,jmp tmr0 OS
_j mp tmr0 06 tmr0 O5: sc ; pt=pt2-ptl =time per pulse ld a,apt2lo subc a,aptllo s a,aptlo Id a,apt2hi subc a,aptlhi x a,apthi shit enl calc2,aflags tmr0_06:
end tmr0: ld a,cd dly ; delay before changing direction ifne a,#0 dec a a,cd_dly drsz uart_tmr jmp end~intr Id rec_stat,#0 _jmp end intr .***************************************************
.sect timerl,rom tmrla: rbit tlc0,cntrl ifbit tlpnda,psw jmp tmrlal j mp end tmr 1 a tmrlal : rbit tlpnda,psw Id a,ptllo x a,pt2lo ld a,ptl hi x a,pt2hi ld a,tlralo x a,ptllo Id a,tlrahi s a,ptlhi sbit pulse,lflags end tmrla:jmp end intr .*******************************************************
tmrlb: rbit tlpndb,icntrl ld a,aptllo x a,apt2lo ld a,aptlhi x a,apt2hi ld a,tlrblo x a,aptllo ld a,tlrbhi a,aptlhi shit pulse2,aflags end tmrlb:jmp end intr .*******************************************************
.sect uart transmit,rom,inpage trns0: Id a,tms_stat add a,#low(jmp t stat) jid ; jmp pcu,[a]
jmp t stat: .addr t s0,t sl t s0: jmp t stat0 t sl: jmp t statl end t stat:jmp end intr .***********************************************************
t stat0: rbit eti_enui ld trns_stat,#0 jmp end t stet t_statl: ld a,send_ptr ifgt a,#89 ; 0-89 => 90 bytes ,jmp t statl Ol ld a,send_ptr a,b ld s,#1 id a,[b+]
x a,tbuf Id s.#0 ld a,b a,send-ptr jmp end t stet t_statl_Ol:ifgt a,# 183 ; 90-179 => 90 bytes+1(buttons flags)+1(t check)+2('ED'[=END]) jmp end t statl Id a,send_ptr sc subc a,#90 1 a,b ld s,#2 Id a,[b+]
x a_tbuf Id s,#0 ld a_b add~a,#90 v a,send-ptr _jmp end t stet end_t_statl :ld send_ptr,#0 rb it eti, enui ld trns_stat,#0 .jmp end t stet .**************************************************
.sect uart receive,rom,inpage rec0: Id a,rbuf ; receive interrupt.
1 a,b ld a,check_sum add a,b x a,check sum Id a,rec_stat add a,#low(jmp r scat) jid ; jmp pcu,[a]
jmp r stet: .addr r s0,r sl,r s2,r s3 r~s0: jmp r stat0 r sl: jmp r statl r s2: jmp r stat2 r s3: jmp r stat3 end r stat:jmp end intr .***********************************
.sect receive states,rom r stat0: Id check sum,#0 Id a,b ifne a,#Of5 j mp a r~stat0 ld rec stet,#1 ld check sum,#0f5 a r_stat0:ld uart_tmr,#Off jmp end r stet r statl : Id a,b ifeq a,#'A' ; (041) ; Advance - moving command.
jmp r stat2 00 ifeq a,#'S' ; Stop command.
jmp r statl O1 ifeq a,#'H' ; Home position command.
jmp r statl 02 ifeq a,#'T' ; Self Test command.
jmp r statl 03 ifeq a,#'0' ; Operate auto run command.
jmp r statl 04 ifeq a,#'P' ; Ping (test communication) command.
jmp r statl_05 ld rec_stat,#0 jmp end r stet r_statl O1 obit stop command,buttons_flags ; 'S' - Stop.
ld tbytel,#0f5 jmp a r stat2 r_statl_02abit home command,buttons_flags ; 'H' - Home position.
ld home stet,#0 e_r_statl:ld tbytel,#Of5 sbit fit t_en,flags2 ld data cntr,#21 ld save_ptr,#0 ld send~tr,#0 rbit enddata,flagsl rbit start,flagsl rbit end,flags 1 rbit stop,flags 1 jmp a r stat2 r statl 03 obit self_t_command,buttons_flags ;'T' - SeIf Test.
1d selft stat.#0 jmp a r statl r_statl 04abit start_stop,buttons_flags ; 'O' - Operate auto run command.
ld autorun_stat.#0 jmp a r statl r_statl OS:Id tbytel,#Of5 ;'P' - Ping.
ld pb,#Of0 jmp a r stat2 r_stat2 OO:Id rec_stat,#2 Id rbyte num,#4 ; number of bytes to be received ld receive_ptr,#rbytel jmp end r stat r stat2: Id a,receive_ptr ; rbuf -> [receive_ptr]
a a,~
ld a,b ; receive_ptr + 1 -> receive_ptr x a,[x+]
ld a,~
a,receive_ptr drsz rbyte num jmp end_r stat sbit start,flagsl rbit stop,flagsl rbit end,flagsl sbit fi~_t_en,flags2 ifeq trns stat,# 1 jmp r stat2_Ol ld data cntr,#21 ; *************
Id save_ptr,#0 ld send~tr,#0 r_stat2 0l:ifbit motor,rbytel ; 0-motorl, 1-motor2.
jmp r stat2 03 Id a,rbyte3 ; motor 1 ifne a,#0 jmp r stat2_OZ
ld a,rbyte2 ifgt a,#0 ,Imp r stat2 OZ
sbit stop l ,lflags ; distance=0 ->Stop motor!
rbit start,flagsl shit end,flags 1 Id nxt_l stat,#0 Id linear stat,#6 jmp r stat2_05 r stat2_02:Id linear_stat.#I
sbit type start,lcd_flags; type'start' at line 2 of lcd.
rbit limits_c_en,limits_flags rbit enddata,flagsl rbit stopl,lflags jmp r stat2 05 r stat2 03:1d a,rbyte3 ; motor 2 ifne a,#0 jmp r stat2 04 Id a,rbyte2 ifgt a,#0 jmp r stat2_04 sbit stop2,aflags ; distance=0 ->Stop motor!!
rbit start,flagsl sbit end,flagsl ld nxt a stat,#0 Id ang stat,#6 jmp r stat2 05 r_stat2 04:1d ang stat,# 1 ; motor 2 sbit type start,lcd_flags; type'start' at line 2 of lcd.
rbit enddata,flagsl rbit stop2,aflags r stat2 05:Id a,check sum ; load byte to transmit x a,tbytel e_r stat2:ld a,tbytel ifeq trns stat,#0 x a,tbuf ld rec stat,#0 rbit stuck,flagsl jmp end r~stat r stat3: jmp end r stat .~******************~***********************************
a .sect datasend,rom data_send:ifbit ~x_t enl,flags2 jmp d s0 ret d_s0: rbit ~Y_t_enl,flags2 drsz data_cntr jmp d sl transmit s2 and s3 ld a,#I3 ; 13 is the sync. sign.
1 a,tbuf ; then send the data to the computer ld a,buttons flags a a,b ld a,t'check Id s,#2 x a.05a ld a,b a,OSb ld s,#1 ld a,059 ld s,#0 ~. a,0 ifbit enddata,0 ifbit enddata,flagsl rbit fiY_t en,flags2 ld t check,#0 ld trns stat,#1 Id data cntr,#21 ld save~tr,#0 ld send~tr,#0 sbit eti,enui jmp end d s d s 1: ifeq data_cntr,#
ld save~ptr,#0 ld a,#11 ifgt a,data cntr jmp d s2 ld b,#flagsl ; load data to stack.
ld a,[b-] ; flagsl push a ld a,[b-] ; pls~1 push a ld a,[b-J ; pls_y0 push a ld a,[b-] ; pls_xl push a ld a,[b-] ; pls_YO
push a ld a,[b-]; ha112 push a ld a,[b-]; halll push a ld a,[b-]; current2 push a ld a,[b-]; currentl push a Id a,save-ptr; save data from stack.
s a,b Id a,b a a.s Id s.#1 pop a x a,[b+]
pop a 1 a,[b+]
pop a 1 a,[b+]
pop a a,[b+]
pop a 1 a, [b+]
pop a 1 a,[b+]
pop a x a, [b+]
pop a 1 a,[b+]
pop a a,[b+]
Id a,t ; compute check check sum.
a,b Id a,[1+]=t_check, a =
; b currentl add a,b ; a =
currentl + b ta,b ;b=a Id a,[;~+]
add a,b 1 a,b ld a,[Z+]
add a,b z a,b Id a,[i+]
add a,b x a,b ld a,[1+]
add a,b a,b W
ld a,[~+]
add a,b x a,b ld a,[:~+]
add a,b a,b Id a,[~c+]
add a,b r a,b ld a,[Y+] ; a=flagsl add a,b ; a= flagsl + b ld s.#0 : t_check = a a a,t check ld a.~
x a,save_ptr _j mp end d s d_s2: ld b,#flagsl ; load data to stack.
ld a,[b-]
push a ld a,[b-]
push a ld a,[b-]
push a Id a,[b-]
push a Id a,[b-]
push a ld a,[b-]
push a ld a,[b-]
push a Id a,[b-]
push a ld a,[b-]
push a ld a,save~tr ; save data from stack.
a,b ld a,b 1 a,;~
ld s,#2 pop a z a,[b+]
pop a x ~[b+]
pop a a,[b+]
pop a z a,[b+]
pop a a,[b+]
pop a x a,[b+]
pop a a, [b+]
pop a x a,[b+]
pop a x a,[b+]
ld a,t_check ; compute check sum.
a,b ld a,[~+]; b=13, a= currentl add ; a= currentl a,b + b xa,b ;b=a ld a,[~+]
add a,b x a,b ld a,[Y+]
add a,b x a,b ld a,[~+]
add a,b a,b ld a,[~+]
add a,b x a,b ld a,[x+]
add a,b a a,b ld a,[~+]
add a,b .
xa,b ld a,[~+]
add a,b x a,b lda,[:~+]; a=flagsl add ; a = flags 1 a,b + b Id s,#0 ; t check = a 1 a,t check ld a,a x a,save_ptr end d s: ret .*******************************************************
.sect a2d_converter,rom a2d00: rbit a2den,flags2 ; the a2d prog. checks halll+2 and currentl+2 ld enad,#082 ; c=>adch8=b0, 2=>psr=1=mclk divide by 16.
sbit adbsy,enad a2d01: ifbit adbsy,enad jmp a2d01 ld a,adrsth x a,halll ld enad,#092 ; c=>adch9=bl, 2=>psr=1=mclk divide by 16.
shit adbsy,enad a2d02: ifbit adbsy,enad jmp a2d02 ld a,adrsth s a,ha112 ld enad,#Oa2 ; c=>adchl0=b2, 2=>psr=1=mclk divide by 16.
shit adbsy,enad a2d03: ifbit adbsy,enad jmp a2d03 ld a,adrsth x a,currentl ld enad,#Ob2 ; c=>adchl 1=b3, 2=>psr=1=mclk divide by 16.
shit adbsy,enad a2d04: ifbit adbsy,enad jmp a2d04 ld a,adrsth y a,current2 ret .*******************************************************
, .sect velosity_caculation,rom v calc: rbit enl calc,lflags ld a,t ref0 a a,0 ld a,t refl r a, l ld a,pthi ifgt a, l jmp tooslow ld a, l ifgt a,pthi jmp toofast ld a,ptlo ifgt a,0 jmp tooslow ld a,0 ifgt a,ptlo jmp toofast ret ; if they are equal the speed is ok tooslow: sc ; err= (pt - t_ref) _> (4,5) ld a,ptlo ; if t2ra + err*k >1000 then pwm=1000 (fastest) subc a.0 x a,4 ld a,pthi subc a.l a a.5 J
ld a,t2ralo s a,2 ld a,t2rahi x a.3 jsr mybyk ld a,0 a,2 ld a,l x a,3 ld a,4 s a,0 ld a,5 1 a, l jmp end_v_calc toofast: sc ; err= (t ref - pt) _> (4,5) ld a,0 ; if t2rb + err*k >1000 then pwm=0 (slowest) subc a,ptlo 1 a,4 ld a, l subc a,pthi s a,5 Id a,t2rblo s a,2 Id a_t2rbhi a,3 jsr mybyk ld a,4 a,2 ld a,5 a a,3 end v calc:ld b;#t2ralo ld s,#0 ld a,#1 ld tmr2hi,#2 ;loop2: ifgt a,tmr2hi jp loop2 ld a,[~+]
1 a,[b+]
Id a,[~+]
x a,[b+]
Id a,[z+]
1 a, [b+]
ld a,[Y]
x a,[b]
~ret .*******************************************************
v2 calc: rbit enl calc2,aflags ld a,at ref0 x a.0 Id a.at_refl x a, l ld a,apthi ifgt a, l ,jmp atooslow ld a, l ifgt a,apthi jmp atoofast ld a,aptlo ifgt a,0 _jmp atooslow ld a,0 ifgt a,aptlo .jmp atoofast ret ; if they are equal the speed is ok atooslow: sc ; err= (pt2 - at_ref) _> (~.,5) ld a,aptlo ; if t3ra + err*k >1000 then pwm=1000 (fastest) subc a,0 x a,4 ld a,apthi subc a.l x a,5 Id a,t3ralo x a,2 ld a,t3rahi s a,3 jsr mybyk ld a,0 1 a,2 ld a, l z a,3 ld a,4 x a,0 Id a.5 s a, l ,jmp end v2 talc atoofast: sc ; err= (at ref - pt2) _> (4,5) ld a,0 ; if t3rb + err*k >1000 then pwm=0 (slowest) subc a,aptlo 1 a,4 ld a,l subc a,apthi x a,5 ld a.t3rblo x a,2 Id a,t3rbhi a,3 _jsr mybyk ld a,4 1 a,2 ld a,5 a,3 end v2 calc:ld b,#t3ralo ld ~,#0 ld a,# 1 ld tmr3hi,#2 ;Ioop3: ifgt a,tmr3hi jp loop3 ld a,[Y+]
t a,[b+]
ld a,[Z+]
x a,[b+]
ld a,[Z+]
s a,[b+]
ld a,[x]
x a,[b]
ret .*******************************************************
.sect math functions,rom mybyk: ld cntr,#6 ; div. by 64 (=2~6) dvby2: rc ld a,5 rrc a x a,5 Id a,4 ~7 rrc a x a,4 drsz cntr _jmp dvby2 rc ; 4,5 <- err*k + t2 ld a,4 adc a,2 a,4 ld a.5 adc ~a,3 s a,5 ifeq 5,#0 _jmp lowedge ld a,5 ifgt a,#high(980) _jmp highedge Id a,#high(980) ifgt a,5 ,jmp end_mybyk ; not edge ld a,4 ifgt a,#low(980) .jmp highedge jmp end mybyk ; not edge highedge: ld 4,#low(980) ld 5,#high(980) Id 0,#20 ld 1,#0 ret lowedge: ld a,4 ifgt a,#20 _jmp end_mybyk ld 0,#low(980) ld 1,#high(980) Id 4.#20 ld 5,#0 ret end mybykac ld a,#low(1000) subc a,4 1 a,~
ld a,#high(1000) subc a,5 s a, l 7s Id a. l ifgt.a,#0 ret ld a,0 ifgt a,#20 ret ld 0,#20 Id 4,#low(980) Id 5,#high(980) ret '****** FDV168 - Fast 16 by 8 division subroutine *******************
490 instruction cycles maximum - 245usec.
dividend in [1,0] (dd) divisor in [3] (dr) quotient in [1,0] (quot) remainder in [2] (test field) fdv168: ld cntr,#16 ; load cntr with length of dividend field ld 2.#0 : clear test field.
fd168s:Id b,#0 fd1681:rc ld a,[b]
adc a,[b]; left shift dividend to x a,[b+]
ld a,[b]
adc a, ; left shift dividend [b] hi x a, [b+]
ld a,[b]
adc a,[b]; left shift test field x a,[b]
ld a,[b+]; test field to acc ifc ;
test if bit shiefted out of test field****
.jp fd168b sc subc a,[b]; test subtract divisor from test field ifnc ; test if borrow from subtraction .jp fdl68t fd168r:Id b,#2 ; subtraction result to test field x a,[b]
ld b.#0 ~
0,[b] ; set quotient bit sbit drsz cntr; dectement and test cntr for zero jp fd1681 ret ;
return from subroutine fdl drsz cntr; dectement and test cntr 68t: for zero _jp fd168s ret ~
; return from subroutine fd168b:subc a,[b]; subtract divisor from test field***
,jp fd168r ******* BINDEC - Binary to Decimal (packed BCD) **********************
bindec: Id cntr,#8 ; Bindec - Binary to Decimal (packed BCD) rc ; 856 cycles * 0.5 ~ 428 cycles = 213usec.
ld b,#1 ; binary in 0 => decinmal in 1,2 bd 1: ld [b+],#0 ifbne #3 jmp bdl bd2: ld b,#0 bd3: ld a,[b]
adc a, [b]
1 a,[b+]
ifbne #1 _jmp bd3 bd4: ld a,[b]
add a,#066 adc a,[b]
dcor a a,[b+]
ifbne #3 ,jmp bd4 drsz cntr _jmp bd2 ret .**********************************************
.sect lcd_update,rom updatelcd:ifbit lcdupdate,flags2 _jmp updatelcd0 ifeq lcd flags,#0 ret jmp updatelcd4 updatelcd0:rbit lcdupdate,flags2 ld lcd_cntr,#50 ld a,pls s0 x a,0 ld a,pls xl a, l ld a,#lpulsepermm ; linear pulses per mm x a,3 _jsr fdv 168 ; mm = pls_x/linear_pulses-per_mm _jsr bindec Id pd,#080 ; cursor home - address 0.
.jsr lcd com ld a,2 and a,#Of add a,#'0' so x a,pd jsr Icd_dat ld a, l swap a and a,#Of add a,#'0' z a,pd jsr lcd_dat ld a,l and a,#Of add a,#'0' t a,pd jsr lcd dat Id pd,#085 ; cursor address 5.
jsr lcd_com ifbit epi,flagsl jmp updatelcd5 ifbit 7,pls_yl jmp updatelcdl sc ; angel= - 08000-pls_y ld a,#0 subc a,pls_y0 a,0 ld a,#080 subc a,pls~l a, l ld pd,#'-' jmp updatelcd2 updatelcdl:ld a,pls-yl ; angel=+ pls_y-08000 and a,#07f a, l ld a,pls-y0 1 a,0 Id pd,#'+' updatelcd2:jsr lcd dat Id cntr,#3 updatelcd3 : rc ld a, l rrc a s a, l Id a.0 rrc a 1 a,0 drsz cntr jmp updateIcd3 ld 1.#0 _jsr bindec 1d a, l swap a and a,#Of add a,#'0' s a,pd _jsr lcd_dat Id a, l and, a,#Of add a,#'0' a,pd _jsr lcd_dat _jmp updatelcd4 updatelcd5:ld pd,#'e' jsr lcd_dat Id pd,#'p' jsr lcd_dat ld pd,#'i' .jsr 1cd dat updatelcd4: ifeq lcd~flags,#0 ret ifbit self_t_command,buttons flags ld lcd_flags,#0 ifbit start stop,buttons_flags ld lcd_flags,#0 ifeq lcd flags,#0 ret ifbit type start,lcd_flags ld temp,#low(wordstart); type 'start' at line 2 of lcd.
ifbit type end,lcd flags ld temp,#low(wordend) ifbit type Stuck,lcd_flags ld temp,#lowv(wordstuck) ifbit type stop,lcd flags ld temp,#low(twordstop) _jsr type stringl Id Icd_flags,#0 end updatelcd:ret .**********************************************
.sect lcd_orders,rom clean Icd:Id pd,#Ol a2 jsr lcd_com _jmp de116 ret .*****************************************
type string0:ld pd,#080 ; type string from the start of line 0.
jsr lcd com jmp type string type siringl :Id pd #Oc0 ; type string from the start of line 0.
jsr lcd com type string:ld a,temp inc a x a,temp jsr get char ifeq a,#' cr' ret x a,pd jsr lcd_dat jmp type string ******** subrutine to initialize lcd display init_lcd: ld a_# 10 init Icdl :jsr de116 dec a ifne a,#0 jp init Icdl init lcd2:ld pd,#O1 ;display clear jsr lcd_com jsr de116 Id pd,#06 ;increment cursor (cursor moves: left to right) jsr Icd com ld pd,#0c ;display on , cursor off jsr lcd com ld pd,#03f ;8 bits jmp Icd com ret ********** subrutine to transfer command to Icd display lcd_com: rbit rs,pa ;command end_com_dai:
sbit cs_Icd,pa rbit cs_lcd,pa .
Id cntr,# 10 loopl : drsz cntr jp loopl ret ********** subrutine to transfer data to lcd display lcd dat: sbit rs,pa :command jmp end com dat .******** delay ****************
de116: ld cntr,#2 de1160: ld temp,#250 ;1.6 msec delay dell6l : drsz temp jmp de1161 ld temp,#150 dell62: drsz temp _jmp dell62 drsz cntr _jmp de1160 ret .*****************************************
.sect string table,rom,inpage get char:laid ret .*****
ascii table *********************
wordmm: . db ' mm @' wordstart:.db'start cz' wordstop:. db 'stop @' wordpoweron:.db'power on@' wordhome:.db 'home @' wordstuck:.db'stuck @' wordend:.db'end @' wordbottom:.db'bottom @' wordready:.db'ready @' wordselftest:.db 'selftest@' wordautorun:.db'autorun @' wordinplace:. db 'in place@' endsect .END 0 ;end of program listing of intumed.asm Appendix 2 This is c8cdr. inc ************************************************************
*:k*****
This file include cop8cdr.inc, cop8.inc, cop8c3r.inc, 8cdr.chp, ports. inc(shortcuts).
;port definitions in cop8 with flash ped =090 ; port a data (output); pe is already taken by parity enable.
pec =091 ; port a configuration pet =092 ; port a input pf =094 ; port f data (output) pfc =095 ; port f configuration pfi=096 ; port f input pa =Oa0 ; port a data (output) pac =Oal ; port a configuration pat =Oa2 ; port a input pb =Oa4 ; port b data (output) pbc =Oa5 ; port b configuration pbi =Oa6 ; port b input pl =Od0 ; port 1 data (output) plc =Odl ; port 1 configuration pli=Od2 ; port 1 input pg=Od4 ; port g data (output) pgc =Od5 ; port g configuration pgi =Od6 ; port g input pc =Od8 ; port c data (output) pcc =Od9 ; port c configuration pct =Oda ; port c input pd =Odc ; port d data (output) This is cop8.inc ************************************************************
************~
;* Primary Chip Names with Designators .************************************************************
*********~**~
ANYCOP = 0 COP912C = 1 ; Basic Family COP820 = 2 COP840 = 3 COP880 = 4 COP820CJ = 5 COP840CJ = 6 COP8620 = 7 COP8640 = 8 COP8720 = 9 COP8780 = 10 COP943 = l I
COP888CF = 20 ; Feature Family COP888CG= 21 COP888CL = 22 COP888CS = 23 COP888EG = 24 COP888EK = 25 COPBACC = 26 COP888BC = 27 COP888EB = 28 COP888EW = 29 COP888FH = 30 COP888GD = 31 COP888GG = 32 COP888GW = 33 COP888HG = 34 COP888KG = 35 COP8SAA = 36 COPBSAB = 37 COP8SAC =38 COPBSGR = 39 COPBSGE = 40 COPBSEC = 41 COPBSER = 42 COP8AJC = 43 COP8AKC = 44 ------------ Flash based devices from here on COPBCBR = 60 COPBCCR = 61 COPBCDR = 62 COPBSBR = 63 COP8SCR = 64 COPBSDR = 65 COPy8 = 99 ---------------- End of COPB.INC
.*******************************************************
COPCHIP = COPBCDR ; Chip Definition This is cop8C3R.inc PLEASE: Consider update for CBR,CDR, and CCR.
Predeclare I/0 and control registers frequently used by COP8 programmer.
.macro setopt .mloc sec,wd,halt,flex .ifb ~1 ; if null sec 0 ; default value (not - secure) .else sec cz l -.
endif .ifb @2 ; if null wd 0 ; default value (Watchdog - enabled) .else wd eJr 2 -.
endif .if6 cr 3 ; if null halt 0 ; default value (HALT
- enabled) .else halt @3 -.
endif .ifb @4 ; if null flex 1 ; default value (Execute - from Flash) .else flex ~4 -. f endi .sect OPTION, CONF
CONFIG: . db ((sec shI 3 or wd) shl 1 or halt) shl 1 or flex . endm . ---------------- End of setecon Macro Definition _______________________________________________________________________ ; SFR Names and Register Bit Names Agree with the Feature Family User's Manual Redundant names match corresponding functions on Basic Family Documentation PORTED = 0x90:BYTE; Port E Data PORTEC = Ox91:BYTE; Port E Configuration PORTEP = Ox92:BYTE; Port E input pins (read only) PORTFD = Ox94:BYTE; Port F Data PORTFC = Ox95:BYTE; Port F Configuration PORTFP = Ox96:BYTE; Port F input pins (read only) PORTAD = 0xA0:BYTE; Port A Data PORTAC = OxAl :BYTE; Port A Configuration PORTAP = OxA2:BYTE; Port A input pins (read only) PORTBD = OxA4:BYTE; Port B Data PORTBC = OxAS:BYTE; Port B Configuration PORTBP = OxA6:BYTE; Port B input pins (read only) ISPADLO = OxAB:BYTE; ISP Address Register Low Byte ISPADHI - OxA9:BYTE; ISP Address Register High Byte ISPRD OsAA:BYTE ; ISP Read Data Register =
ISPWR OxAB:BYTE ; ISP Write Data Register =
TTNTA OxAD:BYTE ; High Speed Timers Interrupt = A
TINTB OxAE:BYTE ; High Speed Timers Interrupt = B
HSTCR OxAF:BYTE ; High Speed Timers Control = Register TMR3L0 = OxBO:BYTE; Timer 3 low byte TMR3HI = OxBI:BYTE; Timer 3 high byte T3RAL0 = OxB2:BYTE; Timer 3 RA register low byte T3RAHI = 0xB3:BYTE; Timer 3 RA register high byte T3RBL0 = OxB4:BYTE; Timer 3 RB register low byte T3RBHI = OxBS:BYTE; Timer 3 RB register high byte T3CNTRL ; Timer 3 control register = OxB6:BYTE
TBUF - OxBB:BYTE ; UART transmit buffer RBUF - 0xB9:BYTE ; UART receive buffer ENU - OxBA:BYTE ; UART control and status register ENUR - OxBB:BYTE; UART receive control and status reg.
ENUI - OxBC:BYTE ; UART interrupt and clock source reg.
BAUD - OxBD:BYTE; BAUD register PSR - OxBE:BYTE ; UART prescaler select register TMR2L0 = OxCO:BYTE ; Timer 2 low byte s8 TMR2HI = OxCI:BYTE ; Timer 2 high byte T2RAL0 = OxC2:BYTE ; Timer 2 RA register low byte T2RAHI = OxC3:BYTE ; Timer 2 RA register high byte T2RBL0 = OxC4:BYTE ; Timer 2 RB register low byte T2RBHI = OxCS:BYTE ; Timer 2 RB register high byte T2CNTRL = OxC6:BYTE ; Timer 2 control register Byte Byte WDSVR = OxC7:BYTE; Watch dog service register WKEDG = OxCB:BYTE; MIWU edge select register WKEN - OxC9:BYTE; MIWU enable register WKPND = OxCA:BYTE; MIWU pending register ENAD - OxCB:BYTE ; A/D Converter Control register ADRSTH = OxCC:BYTE; A/D Converter Result Register High ADRSTL - OxCD:BYTE ; A/D Converter Result Register Low ITMR - OxCF:BYTE ; Idle Timer Control Register PORTLD = OxDO:BYTE; Port L data PORTLC = OxDl:BYTE; Port L configuration PORTLP = OxD2:BYTE; Port L pin PORTGD = OxD4:BYTE; Port G data PORTGC = OxDS:BYTE; Port G configuration PORTGP = OxD6:BYTE; Port G pin PORTCD = OxD8:BYTE; Port C data PORTCC = OxD9:BYTE; Port C configuration PORTCP = OxDA:BYTE; Port C pin PORTD = OxDG:BYTE; Port D
PGMTIM = OxEl :BYTE; E2 and Flash Write Timing Register ISPKEY OxE2:BYTE ; ISP Key Register =
T1RBL0 = OxE6:BYTE; Timer 1 RB register low byte T1RBHI = OxE7:BYTE; Timer 1 RB register high byte ICNTRL = OxEB:BYTE; Interrupt control register SIOR - OxE9:BYTE ; SIO shift register SIO - OxE9:BYTE ; SIO shift register TMR1LO = OxEA:BYTE; Timer 1 low byte TMR1HI = OxEB:BYTE; Timer I high byte T1RALO = OYEC:BYTE ; Timer 1 RA register low byte T1RAHI = OZED:BYTE ; Timer 1 RA register high byte CNTRL = O~EE:BYTE ; control register PSW - O~EF:BYTE ; PSW register BYTECOUNTLO = OxFI:BYTE ; When JSRB Boot Rom used S - O1FF:BYTE ; Segment register, only COP888CG/CS!
_____________________________________________________.
Bit Constant Declarations.
----- Alternatection bit definitions fun on port G
INT - 0 ; Interrupt input INTR - 0 ; Interrupt input WDOUT = 1 ; Watchdog output T1B - 2 ; Timer T1B output T1A - 3 ; Timer T1A output SO - 4 ; Seriell output SK - 5 ; Seriell clock SI - 6 ; Seriell input CKO - 7 ; Halt,restart input ;
--- Alternate function bit definitions on port L
CKX - 1 ; eYt. clock I/O-pin/IJART
TDX - 2 ; transmit data/UART
RDX - 3 ; receive data/UART
T2A - 4 ; Timer T2A output T2B - 5 ; Tirner T2B output T3A - 6 ; Timer T3A output T3B - 7 ; Timer T3B output Alternate function bit definitions on port A
ACHO - 0 ; A/D-Channel 0 ACH1 - 1 ; A/D-Channel 1 ACH2 - 2 ; A/D-Channel 2 ACH3 - 3 ; A/D-Channel 3 ACH4 - 4 ; A/D-Channel 4 ACHS - 5 ; A/D-Channel 5 ACH6 - 6 ; A/D-Channel 6 ACH7 - 7 ; A/D-Channel 7 v Alternate function bit definitions on port B
ACH8 - 0 ; A/D-Channel 8 ACH9 - 1 ; A/D-Channel 9 ACHlO 2; A/D-Channel 10 -ACHI I 3; A/D-Channel 11 -ACH12 4; A/D-Channel 12 -ACH13 5; A/D-Channel 13 -MUXOUTN -5 ; A/D Mux Negative Output ACH14 6; AID-Channel 14 -MUXOUTP -5 ; AlD Mux Positive Output ACHIS 7; A/D-Channel 15 -ADIN - ; A/D Converter Input ----- Bit definitions CNTRL register TIC3 - 7 ; Timer 1 mode control TCI - T1C3 ; COP880/8401820 control signal name TIC2 - 6 ; Timer 1 mode control TC2 - TIC2 ; COP880/8401820 control signal name T1C1 - 5 ; Timer 1 mode control TC3 - T1C1 ; COP880/840/820 control signal name TICO - 4 ; Start/Stop timer in modes 1 and 2 Underfiow interrupt pending in mode 3 TRUN - Tl CO ; COP880/840/820 control signal name MSEL - 3 ; Enable Microwire IEDG - 2 ; Selects external intern. edge polarity SL1 - 1 ; Microwire clock divide select SL0 - 0 ; Microwire clock divide select ;-----Bit definitions PSW register HC - 7 ; Half Historical Redundant carry flag C - 6 ; Carry flag TIPNDA
= 5 ;
Timer TIA interrupt pending TPND - TIPNDA ; Historical Redundant T1ENA = 4 ; Timer TlA interrupt enable ENTI - T1ENA ; Historical Redundant EXPND = 3 ; External interrupt pending IPND - EXPND ; Historical Redundant BUSY - 2 ; Microwire busy shifting EXEN - 1 ; External interurpt enable ENI - EXEN ; Historical Redundant GIE - 0 ; Global intern. enable -----Bit definitions ICNTRL
register LPEN - 6 ; L-Port intern. enable TOPND = 5 ; Timer TO intern. pending TOEN - 4 ; Timer TO intern. enable WPND - 3 ; Microwire intern. pending WEN - 2 ; Microwire intern. enable TIPND B = 1 ; Timer TIB intern. pending flag TlENB = 0 ; Timer TIB intern. enable --- Bit definitions register T2C3 - 7 ; Timer T2 mode control TZC2 - 6 ; Timer T2 mode control T2C 1 5 ; Timer T2 mode control -T2C0 - ~. ; Timer T2A start/stop T2PNDA = ; Timer T2A intern pending 3 flag T2ENA = ; Timer T2A intern. enable T2PNDB = ; Timer T2B intern. pending 1 flag T2ENB = ; Timer T2B intern. enable ----- tionsT3CNTRL register Bit defini T3C3 - 7 ; Timer T3 mode control T3C2 - 6 ; Timer T3 mode control T3C1 - 5 ; Timer T3 mode control T3C0 - 4 ; Timer T3A start/stop T3PNDA = ; Timer T3A intern. pending 3 flag T3ENA = ; Timer T3A intern. enable T3PNDB = ; Timer T3B intern. pending 1 flag T3ENB = ; Timer T3B intern. enable Bit definitions HSTCR
register T9HS - 7 ; Timer T9 High Speed Enable TBHS - 6 ; Timer T8 High Speed Enable T7HS - 5 ; Timer T7 High Speed Enable T6HS - 4 ; Timer T6 High Speed Enable TSHS - 3 ; Timer T5 High Speed Enable T4HS - 2 ; Timer T4 High Speed Enable T3HS - 1 ; Timer T3 High Speed Enable T2HS - 0 ; Timer T2 High Speed Enable ; Bit definitions TINTA
register T9INTA= 7 ; Timer 9 Interrupt A
T8INTA= 6 ; Timer 8 Interrupt A
T7INTA= 5 ; Timer 7 Interrupt A
T6INTA= 4 ; Timer 6 Interrupt A
TS1NTA= 3 ; Timer 5 Interrupt A
T4INTA= 2 ; Timer 4 Interrupt A
T3INTA= 1 ; Timer 3 Interrupt A
Bit definitions TINTB
register T9INTB 7 ; Timer 9 Interrupt B
=
T8INTB 6 ; Timer 8 Interrupt B
=
T7INTB 5 ; Timer 7 Interrupt B
=
T6INTB 4 ; Timer 6 Interrupt B
=
TSINTB 3 ; Timer 5 Interrupt B
=
T4INTB 2 ; Timer 4 Interrupt B
=
T3INTB 1 ; Timer 3 Interrupt B
=
; Bit definitions ENAD register ADCH3 = 7 ; A/D Convertor Channel Select bit 3 ADCH2 = 6 ; A/D Convertor Channel Select bit 2 ADCHI = 5 ; A/D Convertor Channel Select bit 1 ADCHO = 4 ; A/D Convertor Channel Select bit 0 ADMOD = 3 ; A/D Convertor Mode Select bit ADMUX - 2 ; A/D Mux Out Control PSC - 1 ; A/D Convertor Prescale Select bit ADBSY= 0 ; A/D Convertor Busy Bit ----- Bit ENU register definitions PEN - 7 ; Parity enable PSEL1 - 6 ; Parity select PSELO = 5 ; Parity select XBIT9 = 5 ; 9th transmission bit in 9bit data mode CHL 1 - 4 ; Select character frame format CHLO - 3 ; Select character frame format ERR - 2 ; Error flag RBFL - 1 ; Received character TBMT - 0 ; Transmited character ;----- Bit deEnitions ENUR register DOE - 7 ; Data overrun error FE - 6 ; Framing error PE - 5 ; Parity error BD = ; Break Detect RBIT9 3 ; Contains the ninth bit (nine = bit frame!) ATTN - ? ; Attention mode XMTG - 1 ; indicate transmitting mode RCVG - 0 ; indicate framing error a ----- ition ENUI register Bit defin STP2 7 ; Select number of stop bits -BRK = 6 ; Holds TDX low to Generate a BREAK
ETDX - 5 ; Select transmit-pin 12 SSEL 4 ; Select UART-mode -XRCLK = 3 ; Select clock source for the receiver XTCLK = 2 ; Select clock source for the transmitter ERI - 1 ; Enable intern. from the receiver ETI - 0 ; enable intern. from the transmitter Bit Definitions for ITMR Register LSON - 7 ; Low Speed Oscillator Enable HSON - 6 ; High Speed Oscillator Enable DCEN - 5 ; Dual Clock Enable - Switches TO To Low Speed Clock CCKSEL - 4 ; Core Clock Select - Switches Instr Execution To Low Speed Clock ITSEL2 = 2 ; IDLE Timer Period Select bit 2 ITSEL1 = 1 ; IDLE Timer Period Select bit 1 ITSELO = 0 ; IDLE Timer Period Select bit 0 KEY = 0x98 ; Required Value for ISP Key - End of COP8C3R.INC
********
************************************************************
;This is 8cdr.chip CHIP 8CDR ; specifies max. ROM address 7FFF
;RAM=1K
this Ele.
;CHIP SPEC (chip table) for COP8CDR9xxxx parts PLEASE: Consider also update of files for CBR and CCR when modifying 0 value if undefined, address value otherwise mole - 0 romsize = 0x8000 ; ROM size ramhiOx6F ; segment 0 high address =
eelo 0 ; on-chip eerom range -eehi 0 -t3lo OxBO ; timer 3 registers -t3hi OxB6 -comp =0 ; comparator uartlo- OxB8 ; uart registers uarthi- OxBE
t2lo OxCO ; timer 2 registers -t2hi OxC6 -wdog - OxC7 ; watch dog service register miwulo- OxC8 ; miwu registers miwuhi- OxCA
a2dlo- OxCB ; ald registers a2dhi- OxCD
lportlo= OxDO ; 1 port registers lporthi= OxD2 gportlo= OxD4 ; g port registers gporthi= OxD6 iport0 ; i port -cportlo= OxD8 ; c port cporthi= OxDA
dportOxDC ; d port =
eecr 0 ; eerom control register -eromdr- 0 ; eerom data register eearlo- 0 ; eerom address registers eearhi - 0 ;icntrl - OxE8 ; icntrl register ; already defined microwire ; uWire SIO
= OxE9 tlalo - OxE6 ; tl auto ld tlrb tlahi - 0xE7 tlblo - OxEA ; tl reg tl bhi - OxED
;cntrl = OxEE ; cntrl reg ; already defined ;psw - OxEF ; psw reg ; already defined rnlo - OxFO ; RAM reg range rnhi - OxFF
segramlo = 0x0100; segments low to high segramhi = Ox077F
cntrl2 - 0 wdogctr =
modrel - 0 econ - Ox7FFF ; econ hex-file location cfgsize = 1 ; econ array cell address.
;family = 0 for basic family, family = 1 for feature family family - 1 Appendix. 3 '************* Constants definitions *******************
lpulsepermm=136 ; 16 * 22 / 2.54 = 138.58 = linear pulse per mm '************* Register Definitions *****************
f0 =Of0 ; not used uart_tmr =Ofl ; used as receive watch dog - when 0, return rec stat(receiving state) _ to 0.
rbyte =Of2 ; number of bytes to be received.
num tbyte_nurn= ; number of bytes to be transmitted.
O f3 temp =Of4 ; used for temporary calculations as variable or counter.
=Of5 ; not used cntr =Of6 ; used for temporary calculations as counter.
lcd_cnir =0fl ; used to refresh lcd every 0.1 sec (according to timer0 -25 *4msec) f8 =0f8 ; not used data cntr=0~ ; used to count 20 data packets.
fa =Ofa ; not used fb =Ofb ; riot used '**********
bits definitions *****************
>
rs=2 ; ; determines if the LCD gets command(0}
pa or data(1).
cs_lcd=3 ; ; send the information in the lcd data pa pins upon rise and fall( lcd.
/\~ of -cs controll=4; ;1 pa control2=5; ; / control 1+2 determine the direction pa of motor 1 cantrol3=6; ; \
pa control4=7; ; J control 3+4 determine the direction pa of motor 2 ;home_position=5;
pI
;start ;
stop=7 pl home limit=S;
pb bottom limit=6 ; pb angular limit=7;
pb .*****x~*****~ags ***************************************
direction=0; ; direction of motor 1 lflags first-pulse=1; ; if set then there was akeady 1 pulse, lflags en_calc=2; ; enables calculation of time per pulse.
lflags en 1 calc=3; ; enables calculation of velosity every.
lflags stopl=4 ; ; signals that motorl sould be stopped lflags pulse=5 ; ; signals that there was a pulse from lflagsmotor 1 direction2=0; aflags; direction of motor 2 firsty_pulse=1; ; if set then there was already aflags 1 pulse.
en_calc2=2; aflags; enables calculation of time per pulse.
enl_calc2=3; aflags; enables calculation of velosiiy every.
stop2=4 ; aflags; signals that motor2 sould be stopped pulse2=5; aflags; signals that there was a pulse from motor 2 start=0 ; flagsl; 1 when start command is received, 0 when stop command is issued.
home=1 ; flagsl; 1 when home micro switch (Normally Closed) is closed, o when open.
bottom=2; flagsl; 1 when bottoming micro switch (NO) is closed, o when open.
epi=3 ; flagsl; 1 when Epiglottis is sensed.
stop=4 ; flags; 1 when stop command is received, 0 1 when start command is issued.
end=5 ; flags; 1 when planned mission ends.
stuck=6 ; flags; 1 when a motor is stuck.
enddata=7; flags; additional bit for the PC to know when I the micro stops sending data.
fist en=0 ; flags2 ; generatl enable for saving and transmitting the blockes of data.
fix_t_enl=1 ; flags2 ; enable 1 block saving, and set every 8msec by timer0.
a2den=2 ; flags2 ; enables a/d Icdupdate=3 ; flags2 ; being set every O.lsec by timer 0 to refresh lcd.
type start=0 ; lcd_flags ; if set lcd could type "start" in line2.
type stop=1 ; lcd_flags ; if set lcd sould type "stop" in line2.
type end=2 ; Icd_flags ; if set lcd could type "end" in line2.
type stuck=3 ; lcd flags ; if set lcd could type "stuck" in line2.
new direction=3; rbytel ; the new direction for the motors as received from the pc.
motor=4 ; rbytel ; 0 - motorl, 1 - motor2.
buttons t en=0 ; buttons flags home command=1 ; buttons_flags home coirnnand_pc=2 ; buttons_flags self_t_command=3 ; buttons flags stop command=4 ; buttons_flags home_position=5 ; buttons_flags + pl start stop=7 ; buttons flags + pl limits_c_en=0 ; limits_flags to be shifted if it is the only bit in this byte.
.****** s=0 *******bytes definitions ***************************
Iflags =020 ; flags that belongs to linear motor (motorl).
aflags =021 ; flags that belongs to angular motor (motor2).
any stat ; angular motor work states.
=022 n1t_a_stat=023; save the next ang stat that come after a subroutine or an ang stat.
plsy cntr0=024; Isb ; angular distance that motor 2 could do in start command.
plsy cnirl=025; msb plc cntr0 ; lsb ; linear distance that motor 1 could =026 do in start command.
plc cntrl ; msb =027 linear stat=028 ; linear motor work states.
nit_1 stat=029 ; save the next linear_stat that come after a subroutine or an linear stat.
flags2 =02a ; save flags of lcd, a/d and fix t en.
cd_d1y =02b _ ; delay before changing direction to aloes the motor to reach a complete .
stop rec_stat =02c ; usart receiving work state.
trns stat=02d ; usart transmitting work state.
int~cntr =02e ; counter to help with timming. decreased by I every 4msec.
currentl =030 ; digital current from motor 1.
current2 =031 ; digital current from motor 2.
hall l =032 ; digital hall senssor from motor 1.
ha112 =033 ; digital hall senssor from motor 2.
pls x0 =034 lsb ; total linear distance in pulses.
;
pls xl =035 ; msb pls~0 =036 lsb ; total angular distance in pulses.
;
pls-yl =037 ; msb flagsl =038 ;
t_check =039 ; check sum of 1 packet of 20 blocks of currentl+...+flagsl checksum =03a ; check sum of received bytes in 1 command from the pc.
save_ptr =03b ; pointer to show where the next byte should be saved in the packet locksl,s2).
of 20 (s b send~tr =03 ; pointer to show from where the next c byte should be sent in the packet locksl,s2).
of 20 (s b zero_h =03 1 d zero h2 =03 a ptl to =040 ; lsb ; save the capture time of motor 1 last pulse.
timer 1 a pt 1 hi =04 ; msb I
pt2lo =042 ; lsb ; save the capture time of 1 pulse before motor 1 last puts e.
pt2hi =043 ; msb ptlo =044 ; lsb ; save the time between the last 2 pulses of motor 1.
calculated in timer0.
pthi =045 ; msb t ref0 =046 ; lsb ; the desired time between pulses of motor 1 as received from the pc.
t refl =047 ; msb aptllo =048 ; lsb ; save the capture time of motor 2 last pulse.
timer 1 b aptl hi =049 ; msb apt2lo =04a ; lsb ; save the capture time of 1 pulse before motor 2 last puts e.
apt2hi =04b ; msb aptlo =04c ; lsb ; save the time between the last 2 pulses of motor 2.
calculatedmer0.
in ti apthi =04d ; msb at_ref0 =04e ; lsb ; the desired time between pulses of motor 2 as received from the pc.
at refl =04f ; msb receive-pir-050 ; pointer where to store the byte that will be received next, rbytel=051 rbyte2=052 ; received bytes. .
rhyte3=053 ;
rbyte4=054 rbyte5=055 ;
trns~tr=056 ; pointer where the next byte to be transmitted is stored.
tbytel=057 ;
tbyte2=058 ; bytes to be transmitted.
tbyte3=05 9 ;
tbyte4=05 a ;
tbyte5=05b ;
tbyte6=05 c ;
tbyte7=05 d ;
packet cntr=05f ; counts the packets that are send every 160msec untill the micro returns to work state 0.
limits_flags =060 ; micro(limit) switches - normally closed.
buttons_fiags =061 ; buttons - normally closed.
ritut =062 ; ritut - counter to prevent buttons vibrations, only 3sec push is considered a prese.
start_stop cnir=063 ; counter of 3 sec.
home_position_cntr=064 ; counter of 3 sec.
selft_stat=065 ; work states of self test.
autorun_sta~066 ; work states of auto run.
Icd_t7ags=067 ; lcd flags - if set, something should be typed.
nolpulsetmr=068 ; timer to turn off motor if no pulses received - assuming the motor is stuck.
noapulsetmr=069 home stat=06a ; work states of home position.
Claims (142)
1. An automatically operative medical insertion device comprising:
an insertable element which is adapted to be inserted within a living organism in vivo;
a surface following element, physically associated with said insertable element and being arranged to follow a physical surface within said living organism in vivo;
a driving subsystem operative to at least partially automatically direct said insertable element along said physical surface; and a navigation subsystem operative to control said driving subsystem based at least partially on a perceived location of said surface following element along a reference pathway stored in said navigation subsystem.
an insertable element which is adapted to be inserted within a living organism in vivo;
a surface following element, physically associated with said insertable element and being arranged to follow a physical surface within said living organism in vivo;
a driving subsystem operative to at least partially automatically direct said insertable element along said physical surface; and a navigation subsystem operative to control said driving subsystem based at least partially on a perceived location of said surface following element along a reference pathway stored in said navigation subsystem.
2. An automatically operative medical insertion device according claim 1 and wherein said driving subsystem is operative to fully automatically direct said insertable element along said physical surface.
3. An automatically operative medical insertion device according to claim 1 and wherein said driving subsystem is operative to automatically and selectably direct said insertable element along said physical surface.
4. An automatically operative medical insertion device according to any of the preceding claims and wherein said navigation subsystem receives surface characteristic information relating to said physical surface from said surface following element and employs said surface characteristic information to perceive the location of said surface following element along said reference pathway.
5. An automatically operative medical insertion device according to claim 4 and wherein said surface characteristic information comprises surface contour information.
6. An automatically operative medical insertion device according to claim 4 and wherein said surface characteristic information comprises surface hardness information.
7. An automatically operative medical insertion device according to claim 5 and wherein said surface contour information is three-dimensional.
8. An automatically operative medical insertion device according to claim 5 and wherein said surface contour information is two-dimensional.
An automatically operative medical insertion device according to any of the preceding claims and wherein said insertable element is an endotracheal tube and wherein said physical surface comprises surfaces of the larynx and trachea.
10. An automatically operative medical insertion device according to any of claims 1 - 8 and wherein said insertable element is a gastroscope and wherein said physical surface comprises surfaces of the intestine.
11. An automatically operative medical insertion device according to any of claims 1 - 8 and wherein said insertable element is a catheter and wherein said physical surface comprises interior surfaces of the circulatory system.
12. An automatically operative medical insertion device according to any of the preceding claims and also comprising a reference pathway generator operative to image at least a portion of said living organism and to generate said reference pathway based at least partially on an image generated thereby.
13. An automatically operative medical insertion device according to claim 12 and wherein said reference pathway comprises a standard contour map of a portion of the human anatomy.
14. An automatically operative medical insertion device according to claim 13 and wherein said standard contour map is precisely adapted to a specific patient.
15. An automatically operative medical insertion device according to claim 13 or claim 14 and wherein said standard contour map is automatically precisely adapted to a specific patient.
16. An automatically operative medical insertion device according to any of claims 12 to 15 and wherein said reference pathway is operator adaptable to designate at least one impediment.
17. An automatically operative medical insertion device according to any of the preceding claims and wherein said insertable element comprises a housing in which is disposed said driving subsystem; a mouthpiece, a tube inserted through the mouthpiece and a flexible guide inserted through the tube, said surface following element being mounted at a front end of said guide.
18. An automatically operative medical insertion device according to claim 17 and wherein said mouthpiece comprises a curved pipe through which said tube is inserted.
19. An automatically operative medical insertion device according to claim 18 and wherein said driving subsystem is operative to move said guide in and out of said housing, through said curved pipe and through said tube.
20. An automatically operative medical insertion device according to claim 19 and wherein said driving subsystem is also operative to selectably bend a front end of said guide.
21. An automatically operative medical insertion device according to any of the preceding claims and wherein said driving subsystem is operative to move said insertable element in and out of said living organism.
22. An automatically operative medical insertion device according to any of the preceding claims and wherein said driving subsystem is also operative to selectably bend a front end of said insertable element.
23. An automatically operative medical insertion device according to any of the preceding claims and wherein said surface following element comprises a tactile sensing element.
24. An automatically operative medical insertion device according to any of the preceding claims and wherein said surface following element comprises a tip sensor including a tip integrally formed at one end of a short rod having a magnet on its other end, said rod extends through the center of a spring disk and is firmly connected thereto, said spring disk being mounted on one end of a cylinder whose other end is mounted on a front end of said insertable element.
25. An automatically operative medical insertion device according to claim 24 and wherein said tip sensor also comprises two Hall effect sensors which are mounted inside said cylinder on a support and in close proximity to said magnet, said Hall effect sensors being spaced in the plane of the curvature of the curved pipe, each Hall effect sensor having electrical terminals operative to provide electric current representing the distance of the magnet therefrom, said tip sensor being operative such that when a force is exerted on the tip along an axis of symmetry of said cylinder, said tip is pushed against said spring disk, causing said magnet to approach said Hall effect sensors and when a force is exerted on said tip sideways in the plane of said Hall effect sensors, said tip rotates around a location where said rod engages said spring disk, causing said magnet to rotate away from one of said Hall effect sensors and closer to the other of the Hall effect sensors.
26. An automatically operative medical insertion device according to claim 17 and wherein said driving subsystem is operative, following partial insertion of said insertable element into the oral cavity, to cause the guide to extend in the direction of the trachea and bend the guide clockwise until said surface following element engages a surface of the tongue, whereby this engagement applies a force to said surface following element.
27. An automatically operative medical insertion device according to claim 25 and wherein said navigation subsystem is operative to measure the changes in the electrical outputs produced by the Hall effect sensors indicating the direction in which the tip is bent.
28. An automatically operative medical insertion device according to claim 27 and wherein said navigation subsystem is operative to sense the position of said tip and the past history of tip positions and to determine the location of said tip in said living organism and relative to said reference pathway.
29. An automatically operative medical insertion device according to claim 27 and wherein said navigation subsystem is operative to navigate said tip according to said reference pathway.
30. An automatically operative medical insertion device according to claim 29 and wherein said navigation subsystem is operative to sense that said tip touches the end of the trough beneath the epiglottis.
31. An automatically operative medical insertion device according to claim 27 and wherein said navigation subsystem is operative to sense that said tip reaches the tip of the epiglottis.
32. An automatically operative medical insertion device according to claim 27 and wherein said navigation subsystem is operative to sense that the tip reached the first cartilage of the trachea.
33. An automatically operative medical insertion device according to claim 32 and wherein said navigation subsystem is operative to sense that the tip reached the second cartilage of the trachea.
34. An automatically operative medical insertion device according to claim 33 and wherein said navigation subsystem is operative to sense that the tip reached the third cartilage of the trachea.
35. An automatically operative medical insertion device according to any of the preceding claims and wherein said navigation subsystem is operative to load said reference pathway from a memory.
36. An automatically operative medical insertion device according to claim 17 and wherein said driving subsystem is operative to push said tube forward.
37. An automatically operative medical insertion device according to any of the preceding claims and wherein said driving subsystem comprises:
a first motor operative to selectably move said insertable element forward or backward;
a second motor operative to selectably bend said insertable element; and electronic circuitry operative to control said first motor, said second motor and said surface following element.
a first motor operative to selectably move said insertable element forward or backward;
a second motor operative to selectably bend said insertable element; and electronic circuitry operative to control said first motor, said second motor and said surface following element.
38. An automatically operative medical insertion device according to claim 37 and wherein said electronic circuitry comprises a microprocessor operative to execute a program, said program operative to control the said first and second motors and said surface following element and to insert and bend said insertable element inside said living organism along said reference pathway.
39. An automatically operative medical insertion device according to claim 37 or claim 38 and wherein said driving subsystem is operative to measure the electric current drawn by at least one of said first and second motors to evaluate the position of said surface following element.
40. An automatically operative medical insertion device according to any of the preceding claims and wherein said reference pathway is operative to be at least partially prepared before the insertion process is activated.
41. An automatically operative medical insertion device according to claim 40 and wherein said medical insertion device comprises a medical imaging system and wherein said medical imaging system is operative to at least partially prepare said reference pathway.
42. An automatically operative medical insertion device according to claim 41 and wherein said medical imaging subsystem comprises at least one of an ultrasound scanner, an X-ray imager, a CAT scan system and an MRI system.
43. An automatically operative medical insertion device according to claim 40 and wherein said medical imaging system is operative to prepare said reference pathway by marking at least one contour of at least one organ of said living organism.
44. An automatically operative medical insertion device according to claim 41 and wherein said medical imaging system is operative to prepare said reference pathway by creating an insertion instruction table comprising at least one insertion instruction.
45. An automatically operative medical insertion device according to claim 44 and wherein said insertion instruction comprises instruction to at least one of extend, retract and bend said insertable element.
46. An automatically operative medical insertion device according to claim 44 and wherein said navigation subsystem is operative to control said driving subsystem based at least partially on a perceived location of said surface following element and according to said insertion instruction table stored in said navigation subsystem.
47. An automatically operative medical insertion device according to any of the preceding claims and wherein said operative medical insertion device is operative to at least partially store a log of a process of insertion of said insertable element.
48. An automatically operative medical insertion device according to claim 47 and wherein said medical insertion device comprises a computer and wherein said medical insertion device is operative to transmit said log of a process of insertion of said insertable element.
49. An automatically operative medical insertion device according to claim 48 and wherein said computer is operative to aggregate said logs of a process of insertion of said insertable element.
50. An automatically operative medical insertion device according to claim 49 and wherein said computer is operative to prepare said reference pathway based at least partially on said aggregate.
51. An automatically operative medical insertion device according to claim 50 and wherein said computer transmits said reference pathway to said medical insertion device.
52. An automatically operative medical insertion device according to claim 1 and wherein said insertable element comprises a guiding element and a guided element.
53. An automatically operative medical insertion device according to claim 52 and wherein said driving subsystem is operative to direct said guiding element and said guided element at least partially together.
54. An automatically operative medical insertion device according to any of claims 17 - 51 and wherein said mouthpiece comprises a disposable mouthpiece.
55. An automatically operative medical insertion device according to claim 17 and wherein said driving subsystem is operative to at least partially automatically direct said guide in a combined motion comprising a longitudinal motion and lateral motion.
56. An automatically operative medical insertion device according to any of the preceding claims and wherein said insertable element is extendable.
57. An automatically operative medical insertion device according to claim 56 and wherein said insertable element comprises:
a mounting element which is arranged to be removably engaged with an intubator assembly; and an extendable tube operatively associated with said mounting element.
a mounting element which is arranged to be removably engaged with an intubator assembly; and an extendable tube operatively associated with said mounting element.
58. An automatically operative medical insertion device according to claim 57 and wherein said extendable tube is arranged to be pulled by a flexible guide operated by said intubator assembly.
59. An automatically operative medical insertion device according to claim 57 or claim 58 and wherein said extendable tube comprises a coil spring.
60. An automatically operative medical insertion device according to any of claims 57-59 and wherein said extendable tube also comprises a forward end member, on a distal end thereof.
61. An automatically operative medical insertion device according to claim 60 and wherein said forward end member includes a diagonally cut pointed forward facing tube end surface.
62. An automatically operative medical insertion device according to claim 60 or claim 61 and also comprising a forward end member mounted inflatable and radially outwardly expandable circumferential balloon.
63. An automatically operative medical insertion device according to claim 62 and wherein said forward end member mounted inflatable and radially outwardly expandable circumferential balloon receives inflation gas through a conduit formed in a wall of said forward end member and continuing through said tube to a one way valve.
64. ~An automatically operative medical insertion device according to any of claims 57 - 63 and also comprising a flexible guide having mounted at a distal end thereof a tip sensor.
65. ~An automatically operative medical insertion device according to claim 64 and wherein said flexible guide is formed with an inflatable and radially outwardly expandable guide mounted balloon.
66. ~An automatically operative medical insertion device according to claim 65 and wherein said inflatable and radially outwardly expandable guide mounted balloon receives inflation gas through a conduit formed in said flexible guide and extending therealong.
67. ~An automatically operative medical insertion device according to claim 66 and wherein said conduit is connected to a source of pressurized inflation gas.
68. ~An automatically operative medical insertion device according to claim 67 and wherein said source of pressurized inflation gas is located within said incubator assembly.
69. ~An automatically operative medical insertion device according to claim 63 and wherein said inflation gas comprises pressurized air.
70. ~An automatically operative medical insertion device according to claim 66 and wherein said inflation gas comprises pressurized air.
71. ~An automatically operative medical insertion method comprising:
inserting an insertable element within a living organism in vivo;
physically associating a surface following element with said insertable element and causing said surface following element to follow a physical surface within said living organism in vivo;
directing said insertable element along said physical surface using a driving subsystem; and controlling direction of said insertable element based at least partially on a perceived location of said surface following element along a reference pathway stored in a navigation subsystem.
inserting an insertable element within a living organism in vivo;
physically associating a surface following element with said insertable element and causing said surface following element to follow a physical surface within said living organism in vivo;
directing said insertable element along said physical surface using a driving subsystem; and controlling direction of said insertable element based at least partially on a perceived location of said surface following element along a reference pathway stored in a navigation subsystem.
72. An automatically operative medical insertion method according to claim 71 and wherein said directing comprises fully automatic directing.
73. An automatically operative medical insertion method according to claim 71 and wherein said directing comprises automatically and selectably directing.
74. An automatically operative medical insertion method according to any of claims 71 - 73 and wherein said controlling comprises receiving surface characteristic information relating to said physical surface from said surface following element and employing said surface characteristic information to perceive the location of said surface following element along said reference pathway.
75. An automatically operative medical insertion method according to claim 74 and wherein said surface characteristic information comprises surface contour information.
76. An automatically operative medical insertion method according to claim 74 and wherein said surface characteristic information comprises surface hardness information.
77. An automatically operative medical insertion method according to claim 75 and wherein said surface contour information is three-dimensional.
78. An automatically operative medical insertion method according to claim 75 and wherein said surface contour information is two-dimensional.
79. An automatically operative medical insertion method according to any of claims 71 to 78 and wherein said insertable element is an endotracheal tube and wherein said physical surface comprises surfaces of the larynx and trachea.
80. An automatically operative medical insertion method according to any of claims 71 to 78 and wherein said insertable element is a gastroscope and wherein said physical surface comprises surfaces of the intestine.
81. An automatically operative medical insertion method according to any of claims 71 to 78 and wherein said insertable element is a catheter and wherein said physical surface comprises interior surfaces of the circulatory system.
82. An automatically operative medical insertion method according to any of claims 71 to 81 and also comprising generating an image by imaging at least a portion of said living organism and generating said reference pathway based at least partially on said image.
83. An automatically operative medical insertion method according to any of claims 71 to 82 and wherein said reference pathway comprises a standard contour map of a portion of the human anatomy.
84. An automatically operative medical insertion method according to claim 83 and also comprising precisely adapting said standard contour map to a specific patient.
85. An automatically operative medical insertion method according to claim 84 and also comprising automatically precisely adapting said standard contour map to a specific patient.
86. An automatically operative medical insertion method according to any of claims 71 to 85 and also comprising adapting said reference pathway.
87. An automatically operative medical insertion method according to claim 86 and wherein said adapting comprises receiving inputs from an operator.
88. An automatically operative medical insertion method according to any of claim 87 and wherein said adapting comprises designating at least one impediment.
89. An automatically operative medical insertion method according to any of claims 71 to 88 and also comprising:
providing:
a flexible guide, said surface following element being mounted at a front end of said flexible guide;
a housing in which is disposed said driving subsystem;
a mouthpiece and a tube;
inserting said flexible guide through said tube;
inserting said tube through said mouthpiece; and driving said flexible guide employing said driving subsystem.
providing:
a flexible guide, said surface following element being mounted at a front end of said flexible guide;
a housing in which is disposed said driving subsystem;
a mouthpiece and a tube;
inserting said flexible guide through said tube;
inserting said tube through said mouthpiece; and driving said flexible guide employing said driving subsystem.
90. An automatically operative medical insertion method according to claim 89 and wherein said mouthpiece comprises a curved pipe through which said tube is inserted.
91. An automatically operative medical insertion method according to claim 90 and also comprising moving said guide in and out of said housing, through said curved pipe and through said tube employing said driving subsystem.
92. An automatically operative medical insertion method according to claim 91 and also comprising selectably bending a front end of said guide employing said driving subsystem.
93. An automatically operative medical insertion method according to any of claims 71 to 92 and also comprising moving said insertable element in and out of said living organism employing said driving subsystem.
94. An automatically operative medical insertion method according to any of claims 71 to 93 and also comprising selectably bending a front end of said insertable element.
95. An automatically operative medical insertion method according to any of claims 71 to 94 and wherein said surface following element comprises a tactile sensing element.
96. An automatically operative medical insertion method according to any of claims 71 to 95 and wherein said physically associating a surface following element with said insertable element comprises:
integrally forming a tip at one end of a short rod having a magnet on its other end;
extending said rod through the center of a spring disk;
firmly connecting said spring disk to said rod;
mounting said spring disk on one end of a cylinder;
mounting another end of said cylinder on a front end of said insertable element.
integrally forming a tip at one end of a short rod having a magnet on its other end;
extending said rod through the center of a spring disk;
firmly connecting said spring disk to said rod;
mounting said spring disk on one end of a cylinder;
mounting another end of said cylinder on a front end of said insertable element.
97. An automatically operative medical insertion method according to claim 96 and wherein said surface following element also comprises two Hall effect sensors, each Hall effect sensor having electrical terminals operative to provide electric current representing the distance of the magnet therefrom and also comprising:
mounting said Hall effect sensors inside said cylinder on a support and in close proximity to said magnet;
spacing said Hall effect sensors in the plane of the curvature of said curved pipe;
said tip sensor being operative such that when a force is exerted on said tip along an axis of symmetry of said cylinder, said tip is pushed against said spring disk, causing said magnet to approach said Hall effect sensors and when a force is exerted on said tip sideways in the plane of said Hall effect sensors, said tip rotates around a location where said rod engages said spring disk, causing said magnet to rotate away from one of said Hall effect sensors and closer to the other of the Hall effect sensors.
mounting said Hall effect sensors inside said cylinder on a support and in close proximity to said magnet;
spacing said Hall effect sensors in the plane of the curvature of said curved pipe;
said tip sensor being operative such that when a force is exerted on said tip along an axis of symmetry of said cylinder, said tip is pushed against said spring disk, causing said magnet to approach said Hall effect sensors and when a force is exerted on said tip sideways in the plane of said Hall effect sensors, said tip rotates around a location where said rod engages said spring disk, causing said magnet to rotate away from one of said Hall effect sensors and closer to the other of the Hall effect sensors.
98. ~An automatically operative medical insertion method according to claim 89 and also comprising:
partially inserting said insertable element into the oral cavity;
causing said insertable element to extend in the direction of the trachea;
bending said guide clockwise until said surface following element engages a surface of the tongue, whereby this engagement applies a force to said surface following element.
partially inserting said insertable element into the oral cavity;
causing said insertable element to extend in the direction of the trachea;
bending said guide clockwise until said surface following element engages a surface of the tongue, whereby this engagement applies a force to said surface following element.
99. ~An automatically operative medical insertion method according to claim 96 and also comprising measuring the changes in the electrical outputs produced by the Hall effect sensors indicating the direction in which the tip is bent by employing said navigation subsystem.
100. ~An automatically operative medical insertion method according to claim 99 and also comprising sensing the position of said tip and determining the location of said tip in said living organism and relative to said reference pathway based on the past history of tip positions.
101. ~An automatically operative medical insertion method according to claim 99 and also comprising navigating said tip according to said reference pathway employing said navigation subsystem.
102. ~An automatically operative medical insertion method according to claim 101 and also comprising sensing said tip touching the end of the trough beneath the epiglottis.
103. ~An automatically operative medical insertion method according to claim 99 and also comprising sensing said tip reaching the tip of the epiglottis.
104. An automatically operative medical insertion method according to claim 99 and also comprising sensing the tip reaching the first cartilage of the trachea.
105. An automatically operative medical insertion method according to claim 104 and also comprising sensing the tip reaching the second cartilage of the trachea.
106. An automatically operative medical insertion method according to claim 105 and also comprising sensing the tip reaching the third cartilage of the trachea.
107. An automatically operative medical insertion method according to any of claims 71 to 106 and also comprising loading said reference pathway from a memory to said navigation subsystem.
108. An automatically operative medical insertion method according to claim 89 and also comprising pushing said tube forward employing said driving subsystem.
109. An automatically operative medical insertion method according to any of claims 71 to 108 and also comprising:
operating a first motor to selectably move said insertable element forward or backward;
operating a second motor to selectably bend said insertable element; and controlling said first motor, said second motor and said surface following element by employing electronic circuitry.
operating a first motor to selectably move said insertable element forward or backward;
operating a second motor to selectably bend said insertable element; and controlling said first motor, said second motor and said surface following element by employing electronic circuitry.
110. An automatically operative medical insertion method according to claim 109 and wherein said electronic circuitry comprises a microprocessor and also comprising executing a program, said executing a program comprising:
controlling said first and second motors and said surface following element; and inserting and bending said insertable element inside said living organism along said reference pathway.
controlling said first and second motors and said surface following element; and inserting and bending said insertable element inside said living organism along said reference pathway.
111. ~An automatically operative medical insertion method according to claim 109 or claim 110 and also comprising:
measuring the electric current drawn by at least one of said first and second motors; and evaluating the position of said surface following element, by employing said driving subsystem.
measuring the electric current drawn by at least one of said first and second motors; and evaluating the position of said surface following element, by employing said driving subsystem.
112. ~An automatically operative medical insertion method according to any of claims 71 to 111 and also comprising preparing said reference pathway at least partially before the insertion process is activated.
113. ~An automatically operative medical insertion method according to claim 112 and also comprising:
providing a medical imaging system; and preparing said reference pathway at least partially by employing said medical imaging system.
providing a medical imaging system; and preparing said reference pathway at least partially by employing said medical imaging system.
114. ~An automatically operative medical insertion method according to claim 113 and wherein said medical imaging subsystem comprises at least one of an ultrasound scanner, an X-ray imager, a CAT scan system and an MRI system.
115. ~An automatically operative medical insertion method according to claim 112 and also comprising preparing said reference pathway by marking at least one contour of at least one organ of said living organism.
116. ~An automatically operative medical insertion method according to claims 71 to 115 and also comprising preparing said reference pathway by creating an insertion instruction table comprising at least one insertion instruction.
117. ~An automatically operative medical insertion method according to claim 116 and wherein said insertion instruction comprises instruction to at least one of extend, retract and bend said insertable element.
118. An automatically operative medical insertion method according to claim 116 and also comprising controlling said driving subsystem based at least partially on a perceived location of said surface following element and according to said insertion instruction table stored in said navigation subsystem.
119. An automatically operative medical insertion method according to any of claims 71 to 118 and also comprising storing at least partially a log of a process of insertion of said insertable element.
120. An automatically operative medical insertion method according to claim 119 and also comprising:
providing a computer; and transmitting said log of a process of insertion of said insertable element to said computer.
providing a computer; and transmitting said log of a process of insertion of said insertable element to said computer.
121. An automatically operative medical insertion method according to claim 120 and also comprising aggregating said logs of a process of insertion of said insertable element by employing said computer.
122. An automatically operative medical insertion method according to claim 121 and also comprising preparing said reference pathway based at least partially on the output of said aggregating.
123. An automatically operative medical insertion method according to claim 122 and also comprising transmitting said reference pathway from said computer to said medical insertion device.
124. An automatically operative medical insertion method according to any of claims 71 to 123 and wherein said insertable element comprises a guiding element and a guided element.
125. An automatically operative medical insertion method according to claim 124 and also comprising directing said guiding element and said guided element at least partially together.
126. An automatically operative medical insertion method according to claim 73 and wherein said directing comprises automatically and selectably directing said insertable element in a combined motion comprising a longitudinal motion and lateral motion.
127. An automatically operative medical insertion method according to any of claims 71 - 126 and wherein said inserting also comprises extending said insertable element.
128. An automatically operative medical insertion method according to claim 127 and also comprising:
removably engaging said insertion element with an intubator assembly;
and operatively associating an extendable tube with said insertion element.
removably engaging said insertion element with an intubator assembly;
and operatively associating an extendable tube with said insertion element.
129. An automatically operative medical insertion method according to claim 128 and wherein said extending comprises:
operating a flexible guide; and pulling said extendable tube by said flexible guide.
operating a flexible guide; and pulling said extendable tube by said flexible guide.
130. An automatically operative medical insertion method according to claim 128 or claim 129 and wherein said extending comprises at least one of expanding and contracting a coil spring.
131. An automatically operative medical insertion method according to any of claims 128 - 130 and also comprising forming a forward end member, on a distal end of said extendable tube.
132. An automatically operative medical insertion method according to claim 131 and also comprising forming a diagonally cut pointed forward facing cube end surface on said forward end member.
133. An automatically operative medical insertion method according to claim 131 or claim 132 and also comprising forming an inflatable and radially outwardly expandable circumferential balloon on said forward end member.
134. An automatically operative medical insertion method according to claim 133 and also comprising receiving inflation gas into said circumferential balloon through a conduit formed in a wall of said forward end member and continuing through said tube to a one way valve.
135. An automatically operative medical insertion method according to any of claims 129 - 134 and also comprising mounting a tip sensor at a distal end of said flexible guide.
136. An automatically operative medical insertion method according to claim 135 and also comprising forming an inflatable and radially outwardly expandable guide balloon on said flexible guide.
137. An automatically operative medical insertion method according to claim 136 and also comprising receiving inflation gas into said guide balloon through a conduit formed in said said flexible guide and extending therealong.
138. An automatically operative medical insertion method according to claim 137 and also comprising connecting said conduit to a source of pressurized inflation gas.
139. An automatically operative medical insertion method according to claim 138 and also comprising locating said source of pressurized inflation gas within said intubator assembly.
140. An automatically operative medical insertion method according to any of claims 136 - 139 and also comprising inflating said guide mounted balloon to tightly engage the interior of said forward end member to provide extension of said tube in response to forward driven movement of said flexible guide.
141. An automatically operative medical insertion method according to claim 134 and wherein said inflating comprises inflating said circumferential balloon with pressurized air.
142. An automatically operative medical insertion method according to claim 137 and wherein said inflating comprises inflating said guide balloon with pressurized air.
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/IL2001/001121 WO2002045768A2 (en) | 2000-12-06 | 2001-12-05 | Apparatus for self-guided intubation |
ILPCT/IL01/01121 | 2001-12-05 | ||
PCT/IL2002/000347 WO2003047673A1 (en) | 2001-12-05 | 2002-05-02 | Extendable tube |
Publications (1)
Publication Number | Publication Date |
---|---|
CA2469088A1 true CA2469088A1 (en) | 2003-06-12 |
Family
ID=11043121
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CA002469088A Abandoned CA2469088A1 (en) | 2001-12-05 | 2002-05-02 | Extendable tube |
Country Status (4)
Country | Link |
---|---|
EP (1) | EP1461104A4 (en) |
AU (1) | AU2002258131A1 (en) |
CA (1) | CA2469088A1 (en) |
WO (1) | WO2003047673A1 (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8323203B2 (en) | 2008-02-28 | 2012-12-04 | Boston Scientific Scimed, Inc. | Imaging catheter |
CN103041495B (en) * | 2011-10-12 | 2014-07-23 | 上海凯旦医疗科技有限公司 | Endovascular interventional catheter tactile probe |
PT106730A (en) * | 2013-01-10 | 2014-07-10 | Univ Do Porto | DIGITAL LARINGOSCOPE |
WO2016090435A1 (en) | 2014-12-12 | 2016-06-16 | Airway Medical Innovations Pty Ltd | Intubation device |
AU2019295406A1 (en) | 2018-06-25 | 2022-03-31 | Airway Medical Innovations Pty Ltd | Intubation device improvements |
Family Cites Families (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4827925A (en) * | 1986-10-20 | 1989-05-09 | Vilasi Joseph A | Cuffless adjustable endotracheal tube |
US5188111A (en) * | 1991-01-18 | 1993-02-23 | Catheter Research, Inc. | Device for seeking an area of interest within a body |
US5184603A (en) * | 1991-02-15 | 1993-02-09 | Stone J Gilbert | Automatic intubating laryngoscope |
US5282472A (en) * | 1993-05-11 | 1994-02-01 | Companion John A | System and process for the detection, evaluation and treatment of prostate and urinary problems |
US5571114A (en) * | 1994-07-13 | 1996-11-05 | Devanaboyina; Udaya-Sankar | Mechanism to advance or withdraw objects in lumens or cavities of mammals |
US5951461A (en) * | 1996-12-20 | 1999-09-14 | Nyo; Tin | Image-guided laryngoscope for tracheal intubation |
AUPP123698A0 (en) * | 1998-01-07 | 1998-01-29 | Ayre, Peter | Self propelling endoscope |
US6096004A (en) * | 1998-07-10 | 2000-08-01 | Mitsubishi Electric Information Technology Center America, Inc. (Ita) | Master/slave system for the manipulation of tubular medical tools |
US6398755B1 (en) * | 1998-10-06 | 2002-06-04 | Scimed Life Systems, Inc. | Driveable catheter system |
EP1174076A3 (en) * | 2000-07-18 | 2002-10-16 | BIOTRONIK Mess- und Therapiegeräte GmbH & Co Ingenieurbüro Berlin | Device for automatically performing diagnostic and/or therapeutic actions in body cavities |
-
2002
- 2002-05-02 WO PCT/IL2002/000347 patent/WO2003047673A1/en not_active Application Discontinuation
- 2002-05-02 EP EP02728003A patent/EP1461104A4/en not_active Withdrawn
- 2002-05-02 AU AU2002258131A patent/AU2002258131A1/en not_active Abandoned
- 2002-05-02 CA CA002469088A patent/CA2469088A1/en not_active Abandoned
Also Published As
Publication number | Publication date |
---|---|
WO2003047673A1 (en) | 2003-06-12 |
EP1461104A1 (en) | 2004-09-29 |
AU2002258131A1 (en) | 2003-06-17 |
EP1461104A4 (en) | 2005-01-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CA2430834C (en) | Apparatus for self-guided intubation | |
AU2002222450A1 (en) | Apparatus for self-guided intubation | |
EP2626000B1 (en) | Adapter for an endoscope, a processor for endoscope and an endoscope system | |
EP1917901A1 (en) | Device for analyzing endoscope insertion shape and system for analyzing endoscope insertion shape | |
ATE311810T1 (en) | TELEMETRIC SENSOR AND CHARGING DEVICE FOR MEDICAL SENSOR | |
EP0223307A3 (en) | Universal remote control unit with model indentification capability | |
KR20100112764A (en) | Apparatus and method for motion correcting and management system for motion correcting apparatus | |
JP2004522480A5 (en) | ||
US9829298B2 (en) | Optical readout device to provide visual information | |
CA2469088A1 (en) | Extendable tube | |
CN104394792A (en) | surgery assistant device | |
US4500749A (en) | Incremental digitizer for encoding geometrical forms | |
TW201719117A (en) | A measuring device and a measuring method for measuring three-dimensional coordinates of points on surface of an object | |
CN108883028A (en) | Optical fiber true shape senses feeding tube | |
JP4708963B2 (en) | Endoscope insertion part shape grasping system | |
JP6806167B2 (en) | Length measuring system, length measuring device and length measuring method | |
EP2979612A1 (en) | Insertion device | |
JP2009075013A (en) | Digital perimeter measuring instrument | |
CN103440050A (en) | Sounding pen and control method thereof | |
KR102081366B1 (en) | Oral mounted mouse | |
CN210742900U (en) | Pen tail structure of intelligent pen | |
JP2003070718A (en) | Flexible endoscope | |
CN211131071U (en) | Novel PICC arm encloses dipperstick | |
US20130060119A1 (en) | Device and method for determining fetal movement | |
CN108175367A (en) | A kind of endoscope position determines method and endoscope |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
FZDE | Dead |