udamonic.com
  • Start
    • What is a Scamp?
    • Getting Started
    • Getting Started (Windows)
  • Learn
    • 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
    • FlashForth Dictionary Reference
    • Scamp Dictionary Reference
  • Extras
    • Interrupts
    • Timers
    • Multitasking
    • Delays and Tick Count
    • Processor Words
    • Starting up with turnkey
    • Changing the Prompt
    • Formatting Text on Screen
  • Interfacing
    • Using the LED Array
    • Temperature Sensor
    • Input/Output
    • Analog Input
    • Serial >
      • Serial Communication
      • Scamp2 UART Pins
    • I2C >
      • I2C Overview
      • I2C Commands
    • SPI
    • PWM
    • Peripheral Pin Select
    • Input Capture
    • Digital Signal Modulator
  • Create
    • Creating PCBs >
      • Designing PCBs
      • Fabricating PCBs
      • Soldering
    • Sensing >
      • Measuring Temperature
    • LEDs >
      • Adding LEDs
      • LED arc-welder effect
    • Displays >
      • Adding a 7 Segment Display
      • Adding a Touch LCD
      • Touch LCD GUI
      • Game of Pong
    • Adding Extra GPIO
    • Adding a Low Side Switch
    • FizzBuzz
    • Adding MRAM
    • Model Train Control
    • Adding a Real Time Clock
    • Scamp Projects on Youtube
  • Resources
  • Store
  • About
  • Contact

Scamp Words
​

The following words are part of the Scamp BSP and not part of the standard FlashForth dictionary. For words that are part of the standard FlashForth dictionary, see the FlashForth Dictionary Reference page or visit Mikael Nordman's FlashForth website.

  
about     ( -- )
          Display the about message with version numbers

ack       ( -- )
          Send an ACK on the I2C bus.

adc10     ( -- )
          Configure the ADC for 10-bit sampling.

adc12     ( -- )
          Configure the ADC for 12-bit sampling. 

adcclk    ( c -- )
          Set the conversion clock period.
          Period = ( c * 62.5 ns ) + 1

analog    ( pin -- )
          Configures a pin on the Scamp connector as an analog
          input.

baud      ( baud -- BRG )
          Take a double from the stack indicating the desired 
          baud rate and calculate the required BRG value for the
          UART. 

bg        ( color -- )
          Sets the text background color for the ANSI terminal.

blink     ( -- )
          Blinks the onboard LED once.

bold      ( -- )
          Sets the text font to bold for the ANSI terminal.

brg       ( BRG -- baud )
          Takes a BRG value from the stack and calculates the 
          actual baud rate used. The returned baud rate
          is a double. 

channel   ( channel -- )
          Selects an analog channel for sampling.

clear     ( pin -- )
          Sends an output pin on the Scamp connector low. 

cls       ( -- )
          Sends the ANSI clear screen command to the host.

cr.s      ( -- )
          The Scamp prompt word.

devID     ( -- revision identifier )
          Reads the silicon revision number and
          processor device identifier. 

duty      ( dutycycle channel -- )
          Sets the duty cycle of the specified PWM channel.
          Note that the duty cycle value should always be less
          than period value for a waveform to be generated.
          If the duty cycle is equal to or greater than the
​          period, the output will stay high.

extend    ( c -- n )
          
Sign extend a negative 8-bit value to 16-bits.

fg        ( color -- )
          Sets the text foreground color for the ANSI terminal.
 
free      ( -- )
          Show the size of free memory in the Flash and RAM.

get       ( pin -- boolean )
          Reads the state of an input pin on the Scamp connector.

goto      ( column row -- )
          Sends the ANSI command to move the cursor
          on the host terminal.


hide      ( -- )
          Sends an ANSI command to the host to hide the cursor.

i         ( -- loop-count )
          Places the current loop count on the stack. 

input     ( pin -- )
          Configures a pin on the Scamp connector as an input.

ledoff    ( -- )
          Turns the onboard LED off.

ledon     ( -- )
          Turns the onboard LED on.

leds      ( n -- )
          Writes the value of n to the LED array. 
          This is a Scamp2 word only.

modules   ( -- )
          Pings each 7-bit I2C address starting at $3, and
          displays a table showing found I2C devices.

nack      ( -- )
          Sends a NACK on the I2C bus.

out       ( boolean pin -- )
          Sets or clears an output pin on the Scamp connector
          according to the boolean.


output    ( pin -- )
          Configures a pin on the Scamp connector as an output.

period    ( period channel -- )
          Sets the duty cycle of the specified PWM channel.

pick      ( n -- u )
          Copies the n-th item on the stack to the top.

ping      ( address -- boolean )
          Returns true if there is a device present at the 
          specified address on the I2C bus, otherwise it returns
          false.
         
plain     ( -- )
          Sends an ANSI command to the host terminal to set
          font style to plain.

pulldown  ( pin -- )
          Activates a pulldown resistor for a pin
          on the Scamp connector.


pwm       ( pin channel -- )
          Assign a pin on the Scamp connector to a PWM channel.

random    ( -- u )
          Retrieves an unsigned 16-bit random number from
          the hardware RNG. This is a true random number,
          not a pseudo-random number.

read      ( address -- boolean )
          Transmit a READ command to an I2C device at address, 
          and leaves a boolean indicating whether an ACK 
          was received. 

receive   ( address -- c )
          Send a RECEIVE command to an I2C device at address, 
          and leaves the byte (c) received from the device. 

repstart  ( -- )
          Sends a REPEATED START on the I2C bus.

reverse   ( -- )
          Sends an ANSI command to the host terminal to set
          font style to reverse text.

rx1pin    ( pin -- )
          Configures a pin on the Scamp connector as UART1's
          receiver input.


rx2pin    ( pin -- )
          Configures a pin on the Scamp connector as UART2's 
​          receiver input.
 

sample    ( -- u )
          Samples the selected ADC channel and returns the value
          to the stack.

send      ( c -- boolean )
          Sends a byte on the I2C bus.

set       ( pin -- )
          Sends an output pin on the Scamp connector high. 

show      ( -- )
          Sends an ANSI command to the host to unhide the cursor.

start     ( -- )
          Sends a START on the I2C bus.

stop      ( -- )
          Sends a STOP on the I2C bus.

switch    ( pin -- )
          Configures a pin on the Scamp connector as an input 
          with pullup resistor turned on.

temp      ( -- n1 n2 )
          Reads the value of the temperature sensor and returns
          two values to the stack. The temperature reading 
          is n1.n2
          Note this is a Scamp2 word only.

tx1pin    ( pin -- )
          Configures a pin on the Scamp connector as UART1's 
          transmitter output.
 

tx2pin    ( pin -- )
          Configures a pin on the Scamp connector as UART2's 
          transmitter output.
 

u1baud    ( -- address )
          Places the address of UART1's baud rate generator 
          on the stack.

u2baud    ( -- address )
          Places the address of UART2's baud rate generator 

​          on the stack.

underline ( -- )
          Sends an ANSI command to the host to turn on
          the underline text style.


wink      ( -- )
          Sends an ANSI command to the host to turn on 
          the blinking text style.

write     ( address -- boolean)
          Transmit a WRITE command to an I2C device at address,
          and leaves a boolean indicating whether an ACK
          was received. 


Site powered by Weebly. Managed by Hostwinds
  • Start
    • What is a Scamp?
    • Getting Started
    • Getting Started (Windows)
  • Learn
    • 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
    • FlashForth Dictionary Reference
    • Scamp Dictionary Reference
  • Extras
    • Interrupts
    • Timers
    • Multitasking
    • Delays and Tick Count
    • Processor Words
    • Starting up with turnkey
    • Changing the Prompt
    • Formatting Text on Screen
  • Interfacing
    • Using the LED Array
    • Temperature Sensor
    • Input/Output
    • Analog Input
    • Serial >
      • Serial Communication
      • Scamp2 UART Pins
    • I2C >
      • I2C Overview
      • I2C Commands
    • SPI
    • PWM
    • Peripheral Pin Select
    • Input Capture
    • Digital Signal Modulator
  • Create
    • Creating PCBs >
      • Designing PCBs
      • Fabricating PCBs
      • Soldering
    • Sensing >
      • Measuring Temperature
    • LEDs >
      • Adding LEDs
      • LED arc-welder effect
    • Displays >
      • Adding a 7 Segment Display
      • Adding a Touch LCD
      • Touch LCD GUI
      • Game of Pong
    • Adding Extra GPIO
    • Adding a Low Side Switch
    • FizzBuzz
    • Adding MRAM
    • Model Train Control
    • Adding a Real Time Clock
    • Scamp Projects on Youtube
  • Resources
  • Store
  • About
  • Contact