![]() |
Token Code Index Glossary of general commands
Glossary of 'Avise 2.4' I/O commands: In the versions for the AT90S4433 some functions are missing due to lack of code memory. Enter WORDS to get a list of functions of your specific version. Differences between different hardware versions are outlined where necessary +W(x addr -- ) token code = A6 (not available for AT90S4433 with external EEPROM)
Adds the second stack entry "x" directly to the value of SRAM cell located at "addr" (must be within SRAM addresses <= 0xFF), i.e. specially intended for manipulation of 'Avise' global variables -W( x addr -- ) token code = A9 (not available for AT90S4433 with external EEPROM)
subtracts the second stack entry "x" directly from the value of SRAM cell located at "addr" (must be within SRAM addresses <= 0xFF), i.e. specially intended for manipulation of 'Avise' global variables AIN( bsel -- x ) token code = 8C(only for CPU models with built-in ADC)
Start one single measurement of the AT90LS4433, AT90S8535 or ATmega163 internal ADC converter, multiplexer input "bsel" selected. BCLR( addr b -- ) token code = 83
Clear bit (set to 0=L) at position "b" (0...15) of SRAM byte at address "addr". BSET( addr b -- ) token code = 82
Set bit (set to 1=H) at position "b" (0...15) of SRAM byte at address "addr". BTST( addr b -- TRUE|FALSE ) token code = 84
Test bit at position "b" (0...15) of SRAM byte at address "addr". TRUE is reported, if bit is set (=1, high), FALSE else COUNT( -- x ) token code = 91 (not available for AT90S4433)The negative pulses on the INT1 input (PortD,3 for AT90S8515 and AT90S8535) are permanently counted in a background process. COUNT reports the present value of this counter. Circular overflow behaviour. See also ENCODE ENCODE( -- x ) token code = 92 (not available for AT90S4433)Similar function as COUNT, but a counter is incremented or decremented depending on the present level of a second input PortD,4 (AT90S8515) respectively PortD,6 (AT90S8535). Circular overflow behaviour. This function is useful together with 2-phase rotary encoders. When used with mechanical encoders, these must be debounced with appropriate external hardware! IACK( -- TRUE|FALSE ) token code = E1Sends the I2C ACKNOWLEDGE command on the I2C interface. Success is reported as a boolean flag on the stack. User has to decide how to handle FALSE answer. IRECV( -- b ) token code = E2 (not available for AT90S4433)
Receives one byte through the I2C interface performing the "current read" method without ACK. Note that this is a receive primitive. According to the I2C protocol, further commands have to be executed previously to ensure correct read address; and further commands may have to be hooked after to close the interface correctly. ISEND( b -- ) token code = E3 (not available for AT90S4433)
Sends one byte via the I2C interface without ACK. Note that this is a send primitive. To perform a real write operation to the I2C interface, a sequence of further commands is necessary. Refer to the I2C protocol of the specific device to be connected. ISPEED( TRUE|FALSE -- ) token code = DE (not available for AT90S4433)
Adjust the I2C bus clock speed: TRUE does set it to 400 kHz speed (or maximum possible); FALSE does limit it to 100 kHz speed. ISTART( -- ) token code = DF (not available for AT90S4433)
Sends the I2C START command on the I2C interface. ISTOP( -- ) token code = E0 (not available for AT90S4433)
Sends the I2C STOP command on the I2C interface. PBRD( b -- TRUE|FALSE ) token code = 88
"Pin Bit ReaD". Reads one byte from the specified microcontroller I/O port (PINx register) tests the questionned bit and puts the result conditionned as a boolean flag on the data stack. PBHI( b -- ) token code = 86"Port Bit HIgh". Sets one bit at the specified microcontroller I/O port (PORTx register, DDRx register) to INPUT with PullUp resistor ("SOFT HIGH"). Comment on port bit coding see PBRD. PBLO( b -- ) token code = 87"Port Bit LOw". Sets one bit at the specified microcontroller I/O port (PORTx register, DDRx register) to OUTPUT LOW. Comment on port bit coding see PBRD. PWM8( bhi bmod-- ) token code = 95
Start AVR timer 1 or 2 in 8 bit PWM mode. PWM10(xhi bmod -- ) token code = 96 (not available for AT90S4433)
Start the AVR timer 1 in 10 bit PWM mode. R( addr -- x ) token code = 80
Reads one data word from the microcontroller SRAM memory space to the data stack. According to the AVR memory model, this can be a controller register, controller SRAM (address <=0xFF) or an I/O register. RPIN( addr -- b ) token code = 8BReads one byte from the specified microcontroller I/O port (PINx register) and puts the result on the data stack. In contrast to PBIN, this is a multiple line reading byte operation. The addressed port is specially coded in byte "addr": it describes the port name and may have the hex values 0x0B,0x0C,0x0D. (0x0A is allowed for kernel modifications with AT90S4414, AT90S8515 or AT90S8535). The PINx register readout is returned on the stack without further filtering. Note that not all port lines are physically available and some of the available ones may have special functions, which do not represent user I/O. W(x addr -- ) token code = 81
Write one data word from the data stack to the microcontroller SRAM memory space (address <= 0xFF). According to the AVR memory model, this can be a controller register, controller SRAM or an I/O register. WAVE( b -- ) token code = 93 (AT90S4433: performs always 50% duty cycle)
Start the AVR timer 1 as frequency generator with a low cycle period defined by WAVELO. Before starting WAVE, the low period MUST be set with WAVELO. When WAVE is already busy, every part can be changed independently. The low period, however, must not be greater or equal than the total period. Frequency range is about 15 Hz to 32 kHz. Frequency is about 62500 kHz/(b+1). 16 bit resolution of frequency control. Port OC1A (CPU depdendent) is set as output by 'Avise' firmware. WAVELO( b -- ) token code = 94 (not available for AT90S4433)Sets the duration of the low period of WAVE in units of about 16 microseconds. WDDR( b addr -- ) token code = 8AWrites one byte "b" into the data direction register of the specified microcontroller I/O port. In contrast to PBHI and PBLO, this is a multiple line write operation. The addressed port is specially coded in byte "addr": it describes the port name and may have the hex values B,C,D. (A is allowed for kernel modifications with AT90S8515, AT90S8535 or ATmega. E is allowed for ATmega161). Note that not all port lines are physically available, and some are locked against user access as there are: serial interface and I2C control lines. WPORT( b addr -- ) token code = 89Writes one byte "b" into the port register of the specified microcontroller I/O port. In contrast to PBHI and PBLO, this is a multiple line write operation. The addressed port is specially coded in byte "addr": it describes the port name and may have the hex values B,C,D. (A is allowed for kernel modifications with AT90S8515, AT90S8535 or ATmega. E is allowed for ATmega161). Note that not all port lines are physically available, and some are locked against user access as there are: serial interface and I2C control lines. XR( addr -- b ) token code = EF (not available for AT90S4433 without external EEPROM)Reads one byte from the external EEPROM (if available) to the data stack (into TOSL and TOSH is set =0). addr is limited by the capacity of the EEPROM. Note: when EEPROM types 24C64 or 24C128 or equivalent are used, logical addresses of user words (token codes) are transformed into physical EEPROM pages. For a 24C64 EEPROM, token code 0x20 is compiled to physical page address 0x800 and so on. For a 24C128 EEPROM, token code 0x20 is compiled to physical page address 0x1000 and so on. For a 24C256 EEPROM, token code 0x20 is compiled to physical page address 0x2000 and so on. XR always reads from physical addresses as given by the stack. XW( b addr -- ) token code = F0 (not available for AT90S4433 without external EEPROM)Writes one byte from the data stack (TOSL) to the external EEPROM(if available) to the data stack. addr is limited by the capacity of the EEPROM Note: when EEPROM types 24C64 or 24C128 or equivalent are used, logical addresses of user words (token codes) are transformed into physical EEPROM pages. For a 24C64 EEPROM, token code 0x20 is compiled to physical page address 0x800 and so on. For a 24C128 EEPROM, token code 0x20 is compiled to physical page address 0x1000 and so on. For a 24C256 EEPROM, token code 0x20 is compiled to physical page address 0x2000 and so on. XW always writes to physical addresses as given by the stack. Attention: Writing into program code or symbol table may cause error in the 'Avise' kernel operation. ZR( addr -- b ) token code = EDReads one byte from the CPU internal EEPROM to the data stack. ZW( b addr -- ) token code = EEWrites one byte from the data stack to the CPU internall EEPROM. Attention: Should only be used, if no user functions are compiled into this EEPROM.
Abbreviations and notation used in this glossaryDont be confused by these bureaucratic things. Look at the "programming crashcourse". Start programming by copy and modify. For each word entry there is a boldface headline, in which the most essential features are concentrated. E.g. an imaginary one:
TEST( x -- addr ; <namestring> ) token code = 4B
On top, there is the word name in big letters ( consumed stack entries -- produced stack entries ) orThe upper or youngest stack entry is positionned most right. Deeper stack entries, which are not influenced by this word, are not listed in the stack comment. If you have to do complicated operations, you are advised to solve them writing your own stack comments. In some cases the token does consume subsequent string tokens. This is shown by an annotation separated from the data stack image by a semicolon. For example, see the colon command. Following abbreviations are used in the stack commands:
The mnemonics in the stack comment give some hints relating the data type which is effectively handled (though in a technical sense ''Avise'' can only handle bytes on the stack). Longer data are represented by two or more stack entries.
|
![]() |