udamonic.com
  • Learn
    • What is a Scamp?
    • Getting Started
    • Learning Forth ... >
      • What is Forth?
      • Arithmetic
      • The Stack
      • Creating Words
      • Compilation Tricks
      • Decompilation
      • Comments
      • Characters and Strings
      • Accessing Memory
      • Constants, Variables and Values
      • Flow Control
      • Loops
      • Data Structures
      • Doubles, Triples and Quads
    • Extras... >
      • Interrupts
      • Timers
      • Multitasking
      • Starting up with turnkey
      • Formatting Text on Screen
      • Changing the Prompt
      • Delays and Tick Count
      • Processor Words
      • Temperature Sensor
      • Using the LED Array
    • Interfacing... >
      • Input/Output
      • Analog Input
      • Serial Communication
      • PWM
      • I2C Overview
      • I2C Commands
      • SPI
      • Peripheral Pin Select
      • Timer Interrupts
      • Input Capture
      • Digital Signal Modulator
    • FlashForth Dictionary Reference
    • Scamp Dictionary Reference
  • Create
    • Adding LEDs
    • LED arc-welder effect
    • Measuring Temperature
    • Time Keeping
    • Model Train Control
    • FizzBuzz
    • Adding Extra GPIO
    • Adding a Low Side Switch
    • Adding MRAM
    • Adding a 7 Segment Display
    • Adding a Touch LCD
    • Touch LCD GUI
    • Game of Pong
    • Adding an RTCC
    • Scamp Projects on Youtube
  • Resources
  • Store
  • About
  • Contact

​Running Your Word at Start Up
​

When FlashForth starts (or resets), it can be configured to run any word from the dictionary by mapping that word to the turnkey word. This is particularly useful if you have created an embedded application that you want to run automatically whenever your Udamonic computer is turned on.

​In this example, myWord is made to launch at start up:
' myWord is turnkey
The tick word ' searches the dictionary for the name of the word (specified by the string of characters immediately after ' ), and places the address of myWord on the stack. The word is then stores the address to the dictionary entry for turnkey.  
On restart, if turnkey is 0 (false), FlashForth starts normally. If turnkey is not zero, it is treated as a token (pointer) to a word to be run. The RESET button on your Udamonic computer will restart FlashForth without turnkey running. In this way you can use RESET to bypass turnkey, if you need to disable it or change it. Other sources of restart (such as power-on, brown-out reset, warm etc) will execute turnkey immediately.

Note: If the startup word pointed to by turnkey is removed, turnkey will still attempt to execute whatever it finds at that address in the dictionary. So, always remember to disable turnkey if you forget (remove) your startup word.

To disable turnkey, just set it to false (zero):
​false is turnkey
Note that when setting it to false, no tick ' is required. That's because you're setting turnkey to be zero, not the address of false in the dictionary.

Site powered by Weebly. Managed by Hostwinds
  • Learn
    • What is a Scamp?
    • Getting Started
    • Learning Forth ... >
      • What is Forth?
      • Arithmetic
      • The Stack
      • Creating Words
      • Compilation Tricks
      • Decompilation
      • Comments
      • Characters and Strings
      • Accessing Memory
      • Constants, Variables and Values
      • Flow Control
      • Loops
      • Data Structures
      • Doubles, Triples and Quads
    • Extras... >
      • Interrupts
      • Timers
      • Multitasking
      • Starting up with turnkey
      • Formatting Text on Screen
      • Changing the Prompt
      • Delays and Tick Count
      • Processor Words
      • Temperature Sensor
      • Using the LED Array
    • Interfacing... >
      • Input/Output
      • Analog Input
      • Serial Communication
      • PWM
      • I2C Overview
      • I2C Commands
      • SPI
      • Peripheral Pin Select
      • Timer Interrupts
      • Input Capture
      • Digital Signal Modulator
    • FlashForth Dictionary Reference
    • Scamp Dictionary Reference
  • Create
    • Adding LEDs
    • LED arc-welder effect
    • Measuring Temperature
    • Time Keeping
    • Model Train Control
    • FizzBuzz
    • Adding Extra GPIO
    • Adding a Low Side Switch
    • Adding MRAM
    • Adding a 7 Segment Display
    • Adding a Touch LCD
    • Touch LCD GUI
    • Game of Pong
    • Adding an RTCC
    • Scamp Projects on Youtube
  • Resources
  • Store
  • About
  • Contact