45181 Parallax Inc, 45181 Datasheet - Page 67

SX TECH TOOL KIT NO POWER

45181

Manufacturer Part Number
45181
Description
SX TECH TOOL KIT NO POWER
Manufacturer
Parallax Inc
Series
SXr
Type
Microcontrollerr
Datasheet

Specifications of 45181

Contents
SX Book, SX Key, SX Tech Board, Samples, Resonators, Cable and Manual
Product
Microcontroller Basic Stamps
Operating Supply Voltage
5 V
For Use With/related Products
SX MCUs
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
7.4.12 Macros with Formal Parameters by Count
The following is a sample for a macro with one formal parameter:
This macro is useful to replace the BANK instruction in programs that shall be running on SX48/52
devices as well as on “smaller” chips. The BANK instruction only affects FSR bits 4, 5 and 6 but on
SX48/42 devices, it is also necessary to set or clear bit 7 in order to switch between the upper and lower
banks. So instead of using the BANK instruction to switch between banks, use the _bank macro.
When this macro is used in a program to be run on an SX48/52, it is necessary that the symbol SX48_52
is defined prior to the first invocation of the _bank macro.
The next example is a replacement for the MODE instruction:
The MODE instruction has a four bit operand only which is sufficient for SX20/28 devices as they only
use four bits of the M register, however, the SX48/52 devices have the added ability of reading and
writing some of the port registers, and therefore use five bits in the M register. The MOV M, w
instruction modifies all bits of the M register, so this instruction must be used on the SX48/52 to make
sure that the M register is written with the correct value. So , instead of using the MODE or MOV M,
#<lit> instructions use _mode.
; Sets the mode register appropriately for all types of SX controllers
;
_mode macro 1
endm
; Sets the bank appropriately for all types of SX controllers
;
_bank macro 1
endm
IFDEF SX48_52
ELSE
ENDIF
bank \1
IFDEF SX48_52
ENDIF
mov w, #\1
mov m, w
mov m, #\1
IF \1 & %10000000
ELSE
ENDIF
setb fsr.7
clrb fsr.7
; SX48BD and SX52BD bank instruction
; modifies FSR bits 4,5 and 6. FSR.7 needs to be set
; by software.
; loads the M register correctly for the SX48BD and
; SX52BD
; loads the M register correctly for the SX20AC
; and SX28AC
SX-Key/Blitz Development System Manual 2.0 Parallax, Inc. Page 67
7 The SASM Assembler

Related parts for 45181