45111 Parallax Inc, 45111 Datasheet - Page 67

MANUAL FOR SX-KEY/BLITZ VER. 2.0

45111

Manufacturer Part Number
45111
Description
MANUAL FOR SX-KEY/BLITZ VER. 2.0
Manufacturer
Parallax Inc
Datasheet

Specifications of 45111

Accessory Type
Manual
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
Parallax microcontroller
For Use With
70002PAR - GUIDE PROG THE SX MICRO -DAUBACH
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-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 45111