Welcome to the Industrial Automation website!

NameDescriptionContent
XING-Automation
E-mail  
Password  
  
Forgot password?
  Register
当前位置:

SIEMENS C500 microcontroller architecture and instruction set

F: | Au:FAN | DA:2026-04-29 | 868 Br: | 🔊 点击朗读正文 ❚❚ ▶ | Share:

Most arithmetic instructions affect the flag bits in the program state word (PSW), and engineers must pay attention when writing multi precision or signed operations:

CY (carry flag): When adding, if bit 7 has a carry, set it to 1; When subtracting, if bit 7 needs to be borrowed, set it to 1. The MUL and DIV commands will reset CY to zero.

OV (overflow flag): Used for signed number operations. When two positive numbers add up to a negative number, or when two negative numbers add up to a positive number, set it to 1. In MUL, if the product is greater than 255, OV is set to 1; In DIV, if the divisor is 0, OV is set to 1.

AC (auxiliary carry flag): When adding, if there is a carry from bit 3 to bit 4, set it to 1; When subtracting, if bit 3 needs to borrow from bit 4, set it to 1. Used for BCD adjustment (DA A instruction).

3. Boolean processor: an independent unit for bit operations

The C500 integrates an independent Boolean processor internally, and its accumulator is the CY flag. The bit addressing space (including 128 bits of internal RAM and addressable bits of SFR) constitutes its memory. The Boolean instruction set includes:

Bit transfer: MOV C, bit, MOV bit, C

Position bit/reset: SETB bit, CLR bit, CPL bit

Bit logic operation: ANL C, bit, ORL C, bit and its inverse form ANL C,/bit, ORL C,/bit - the result is saved back to CY.

Conditional jump: JB, JNB, JBC

Using a Boolean processor, C500 can directly perform complex logical judgments and operations on a single I/O pin without the need for byte operations and shifts, greatly improving the efficiency of control code.

4. Application scenarios for controlling transfer instructions

Instruction Type Example Jump Range Typical Applications

Unconditional Long Transfer LJMP addr16 64 KB Full Space Large Program Module Jump

Unconditional absolute transfer of AJMP addr11 2 KB page to save code space, short jump within the same page

Short transfer SJMP rel -128 to+127 byte efficient local loop

Indirect jump JMP @ A+DPTR implementation of multi branch jump table (state machine) based on DPTR index jump

Conditional jump CJNE A, if the comparison of # data and rel is not equal, the jump will occur, which also affects the comparison and branching of byte values in CY implementation

Loop control DJNZ Rn, rel minus one non-zero jumps to achieve precise software delay or counting loops

5. Common Instruction Optimization Techniques

MOVC lookup table: MOVC A, @ A+PC is suitable for local tables with a length not exceeding 256 bytes; MOVC A, @ A+DPTR is suitable for large tables that can be located at any position up to 64 KB.

XCHD Swap Low Half Byte: XCHD A, @ Ri can achieve efficient half byte swapping of BCD codes, commonly used for binary to BCD conversion.

SWAP A: Swapping the high 4 bits and low 4 bits of the accumulator is equivalent to shifting the loop left 4 times, which is very useful for quickly organizing packet formats.

The protection sequence of PUSH/POP: In the interrupt service program, if DPTR needs to be protected, PUSH DPL should be pushed first and then PUSH DPH; When restoring, first POP DPH and then POP DPL. This is opposite to the stacking order of LCALL (PC low byte first in).


Software Development and Debugging Practice

1. C language support for multiple data pointers

When using the C51 compiler, it is usually necessary to manipulate DPSEL through embedded assembly or compiler provided extension keywords. A common practice is to write macros or functions:

c//Attention: Adjustments need to be made according to the specific compiler

#define DPSEL   ((unsigned char __sfr __at(0x92)) 

#define SELECT_DPTR(n) (DPSEL = (n))

//Example usage

SELECT_DPTR(3); //Switch to DPTR3

unsigned int myAddr = 0x1234;

DPTR = myAddr; //Here DPTR actually points to DPTR3

SELECT_DPTR(4); //Switch to DPTR4, keeping the previous DPTR3 value unchanged

Some advanced compilers' library functions may have been optimized for multiple data pointers, automatically recognizing and utilizing idle DPTRs to accelerate memory copy operations.

2. Key points of interrupt service program

Use RETI instead of RET to return. RET will keep the interrupt priority state locked, causing subsequent same level or lower level interrupts to be unresponsive.

If the interrupt hardware does not automatically clear the request flag, the software must clear it before RETI, otherwise it will immediately re-enter the interrupt and cause a dead loop.

Try to keep the interrupt service program short and avoid time-consuming multiplication, division, or long loops within the interrupt.

3. Simulation and debugging suggestions

By utilizing Enhanced Hooks simulation technology, mass production chips are directly used in conjunction with EH-IC for debugging, ensuring consistency between the simulation environment and the final product.

When stepping, pay attention to the value of the DPSEL register to confirm which data pointer is currently being used.

Observing the ALE signal with an oscilloscope can confirm whether external bus access is normal. Under normal circumstances, the ALE frequency should be 1/6 of the crystal oscillator frequency (standard mode).

  • BONFIGLIOLI W63 U P80 B5 Gearbox 2G20012741
  • Bonfiglioli BE80B4 Motor with A202 Gearbox
  • BONFIGLIOLI VECTRON KEYPAD 179675500 KP500
  • Bonfiglioli RA0 60/00 Gear Reducer i182
  • Bonfiglioli C212 F P90 VV Gearbox i=9.6
  • Bonfiglioli MP105 Servomotor Gear
  • Mannesmann Demag 4APB71-4-G08-PR Getriebemotor with Bonfiglioli MVF 63/f
  • Bonfiglioli Vectron ACT401-12 FA Inverter
  • Bonfiglioli BN 80A4 COD.830820106 Motor 0.55 kW IMB5
  • Bonfiglioli TR060 Gearbox
  • Silectron Bonfiglioli FT1000-0.75S RFI Filter
  • Trasmital Bonfiglioli 710C3B50F177G34W1A52VAG Drive
  • Bonfiglioli MAC800-D1 Motorreductor
  • Bonfiglioli VF 63 V HS Worm Gearbox
  • Bonfiglioli BN90LA4 Adjustable Gear Motor 1.5kW
  • Bonfiglioli ACT 400-018 FA Frequency Inverter
  • Bonfiglioli RAO50DNP90B5-I220 Gear Unit i=200
  • Bonfiglioli ACT 401-13FA Frequency Inverter SIACT513010001
  • Bonfiglioli ACU210-18 3 FA Active Inverter 4kW
  • Trasmital Bonfiglioli 709C3B50F177G34W1A52VAG Drive
  • Bonfiglioli BN27C4 Gear Motor 0.09 kW
  • Bonfiglioli BN71A4 Electric Motor
  • Bonfiglioli Vectron VCB400-370 Inverter
  • Bonfiglioli Vectron ACU401-18FA Inverter
  • Bonfiglioli LC120 2 40 STD Gearbox
  • Bonfiglioli BN63B6 Gear Motor 0.12 kW
  • Bonfiglioli T56BN/4 Asynchronous Motor
  • AEB Atlant D712-4B5 Motor with Bonfiglioli MVF 49F1 Gearbox
  • Bonfiglioli VF110 A P100B14 Worm Gear
  • Trasmital Bonfiglioli Raupengetriebe i 1:122 2174688 2T705C3122002 Travel Drive
  • Bonfiglioli ACT 401-21A Frequency Inverter
  • Bonfiglioli VF44 U14 Worm Reducer B03181367918
  • Bonfiglioli VF49 L1 P1 P63B5 Worm Gear i=45
  • Bonfiglioli S2U230S-03F Inverter 0.4kW
  • Ferag 5690512 Uiker TR90L4 Motorreductor with Bonfiglioli C212 F9.6
  • Bonfiglioli LC120250STD80A1CD14KE Gearbox
  • Bonfiglioli W63U38 P80 B14 V5 Gearbox
  • Bonfiglioli VF49A-28-P80-B14 Worm Gearbox
  • Bonfiglioli BN71B4 W63U64P75 Gearmotor
  • Alpha VDS 063-MF1-10-141-BE Planetary Gearbox
  • Bonfiglioli BN71B4 MVF49 F1 Gearmotor i=36
  • Bonfiglioli BN 63 B6 Gear Motor 0.12kW
  • Bonfiglioli SPL400 17F SynPlus Drive 3.7kW
  • Bonfiglioli ACU 401-25A Frequency Inverter
  • Esa 3M2209B5 M71Q Motor with Bonfiglioli MVF49 Gearbox
  • Ferag 5690512 UIKER TR90L4 Gear Motor with Bonfiglioli C212
  • Bonfiglioli A302 UH35 P90 Bevel Gearbox
  • Bonfiglioli GVX1000-1.5-S Inverter Drive 1.5kW
  • Bonfiglioli W63 U 15.0 P80 B14 B Worm Drive
  • Bonfiglioli KP500 Control Panel
  • Bonfiglioli C302PP71 Speed Reducer
  • Bonfiglioli BN71B4 Motor con MVF49 Reductor
  • Bonfiglioli BN71B4 Motor with MVF49 Gearbox i36
  • Bonfiglioli SYN10S 22001AF Inverter 0.2 kW
  • Motor Power Esa 3M2209B5/M71Q with Tachometer and Bonfiglioli MVF49 Gearbox
  • Bonfiglioli SYN10 S 220 01 AF Inverter
  • MEZ UD 1104 2.5 kW BONFIGLIOLI Trasmittal 300L19 Gear Motor 300L19.00HZP90AW0A
  • Bonfiglioli Vectron ACT W 401-39 D Inverter
  • Bonfiglioli BN27C4 Gear Motor 0.09 kW
  • Bonfiglioli A302 UH40 P90 Gear Reducer
  • Bonfiglioli ACT410-193FA Frequency Inverter 5.5kW
  • Bonfiglioli VFR49 P1 240 P63 B5 B3 Gearbox
  • Bonfiglioli BN 63A 6 Motor with VF30 Combination
  • Bonfiglioli VF44 FA1 P63B14 Reducer i=60
  • Bonfiglioli BN 80 B6 FD Electric Motor
  • Bonfiglioli MVF 49F1 Reducer with ICME T 71 B4 Motor
  • Bonfiglioli BN 27 C 4 Gearmotor 0.09kW
  • Bonfiglioli MP 080 Servomotor MPC2012S000F
  • Bonfiglioli S101 1 P P71 Gear Reducer i=4.7
  • Bonfiglioli 301L251.8-HC-P90 Gearbox
  • Bonfiglioli RFI Filter F1060800-SEFL-E9S
  • GE Aviation 9410M37P01 Motor Drive Core
  • Bonfiglioli VF44 FA1 P63B14 Gearbox 60 to 1
  • Bonfiglioli K63A4 Motor 8D09020032
  • Demag 4APB71-4-G08-PR Gear Motor 0.37 kW
  • Bonfiglioli BN90LA4 Gear Motor 1.5 kW
  • Bonfiglioli VF49A-28-P80-B14 Gearbox
  • Bonfiglioli MP053 Planetary Gearbox MPA2028S000D
  • Bonfiglioli C312 P P100 Gearbox
  • Bonfiglioli S1011PP71 Gearbox 4.7 to 1
  • Bonfiglioli VF 44 V 7 P63 B5 B3 with V 0.25 F D11
  • Bonfiglioli DW3000210 AX160 Motor Gearbox
  • Bonfiglioli ACT 401-13 FC Frequency Inverter 2.2kW
  • Bonfiglioli C222 P 7.1 P90 B3 Gearbox
  • Bonfiglioli BN90S4 Motor with C212 Gearbox
  • Bonfiglioli MP130.2.9.15.24.50.130.165.S1 Gearbox
  • Bonfiglioli VF110 V HS Worm Gearbox
  • Bonfiglioli BN7IA4 Electric Motor
  • Bonfiglioli ACU 401-23A Frequency Converter
  • Bonfiglioli BN63B4 Gearmotor
  • Bonfiglioli LC12210S490002 Gear Reducer
  • Bonfiglioli BN63A4 Geared Motor with VF49
  • Bonfiglioli WR86U120P80B5B3 Gear Reducer
  • Bonfiglioli MPB1006S000C Planetary Gearbox
  • Bonfiglioli GC000011 Frequency Inverter
  • Bonfiglioli VF44 FA1 P63B14 Gearbox 60 to 1
  • Bonfiglioli BN63B6 Gear Motor 0.12 kW
  • Trasmital Bonfiglioli 301 L2 Gear Reducer
  • Bonfiglioli BN71B4 Motor with MVF49 Gearbox
  • Bonfiglioli MVF62/A Worm Gear Motor 7 to 1
  • Bonfiglioli VF W30 63UFC2 Gear Reducer
  • Bonfiglioli S1011PP71 Gearbox 4.7 to 1
  • Bonfiglioli W63 U7 P90B14 V6 Gear Reducer
  • Bonfiglioli BN63B6 FD Geared Motor with VFR49F1P63B5 Reducer
  • Bonfiglioli T56BN/4 Three Phase Motor
  • Bonfiglioli MVF62/A Worm Gearbox 7 to 1
  • Bonfiglioli VF44 FA1 P63B14 Gearbox 60 to 1
  • ICME T71B4 Motor with Bonfiglioli MVF49F1
  • Bonfiglioli BN71B4 Motor with MVF49 Gearbox
  • Bonfiglioli C31 3P P63 PV V5 Gear Reducer
  • Bonfiglioli BN80B4 Electric Motor 8F31020004
  • Bonfiglioli VF/W30/63UFC2 Gear Reducer i=168
  • Bonfiglioli MPD1006S0006 In-Line Planetary Gearbox
  • Bonfiglioli LC 120 2 40 STD 80A1 CD Gearbox
  • Bonfiglioli Vectron ZBA400-010FC Brake Unit
  • Bonfiglioli VF44 U14 Worm Gearbox B03181367918
  • Bonfiglioli 8XNC63040004 Electric Motor IP55
  • Bonfiglioli W110U P100B5 Worm Gearbox
  • Bonfiglioli VF63/FC1 P80 Gearbox 203160152 i=15
  • Bonfiglioli VMN JB00017191 Gear Unit
  • Bonfiglioli AGL202-031FC Inverter 0.37 kW
  • Bonfiglioli BN71B2 Geared Motor with VF44
  • Bonfiglioli S1011PP71 Gearbox 4.7:1
  • Bonfiglioli VF W30 63UFC2 Gear Reducer
  • Bonfiglioli VF44FA146HSB3 Gear Reducer
  • Bonfiglioli MP105 Planetary Gearbox 18:1
  • Bonfiglioli VF49 L1 P1 P63B5 Worm Gearbox
  • Bonfiglioli 55aN-4 Electric Motor