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 | 736 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).

  • Sumitomo HC1480-29.00 NSMD Inline Gear Reducer
  • Sumitomo MC-550 MCU UMC550000AEG01
  • Sumitomo CNVM1H-6125YA-B-87 Gear Reducer
  • Sumitomo SD4GS-ACB-02B-110-54 Solenoid Valve
  • Sumitomo HCS79310 Main Motor Assembly
  • Sumitomo JA762913AC Operator Interface Keypad
  • Sumitomo CNHJ-6125Y-8 In Line Reducer
  • Sumitomo X120D30303T-01 Driver
  • Sumitomo H1Y203-25-F7000 Shaft Mount Reducer
  • Sumitomo Type-35SE Fiber Fusion Splicer Kit
  • Sumitomo F2CS-T655-171 Cyclo Drive Gearbox
  • Sumitomo F80 Adsorber RX19ZT6124
  • Sumitomo MC-550 MCU UMC550000AKG01
  • Sumitomo Drive FCS-A65G-59 Speed Reducer
  • Sumitomo SRA81-56-BM50-140 Modular Reamer Holder
  • Sumitomo CNHM05-6100YA-59 Gear Motor
  • DEMAG Sumitomo Ergocontrol NC4 100 V7 Control Unit
  • Sumitomo HMV02-207 Cyclo Drive Induction Motor
  • SUN-EH Sumitomo Z4-22172-12 Ozone Power Unit
  • Sumitomo AF-500 AF502-2A2 Transistor Inverter
  • Sumitomo T-82C+ Core Alignment Fusion Splicer
  • Sumitomo P741F6002B Circuit Board
  • Sumitomo AS-3211 Injection Molding Motherboard
  • Yaskawa SGMGH-13Q5A-OM11 Servo Motor with Sumitomo F3CS-A25G-59 Gear
  • Sumitomo SH120-5 Final Drive Track Travel Motor
  • Sumitomo AS-3345 Circuit Board
  • Sumitomo AF300S-1A5-E Transistor Inverter 1.5kW
  • Sumitomo Type-Q101-CA SM MM Fiber Fusion Splicer
  • Sumitomo SH50 NIV Operator Panel
  • Sumitomo RNFM-009-17L-B-120-N4FCZ843 AC Gear Motor
  • Sumitomo ULC100011-01 LNR Act Driver
  • Sumitomo SD35E OI Operator Panel
  • Sumitomo SR44 SRKG44-32-18-030 Reamer Head
  • Sumitomo T.SBXH1.5-20PD LN Modulator
  • Sumitomo FB10B-4F Brake F Class DC180V
  • Isuzu 3LB1 Cylinder Head for Sumitomo Loaders
  • Sumitomo 6 Hand Hydraulic Valve
  • Sumitomo CNVM05-EO95-59 Gear Reducer Motor
  • Sumitomo Ogura MS982WW Brake Kit
  • Sumitomo SPH-2100 DEV10-002-3 Stamper Changer Head
  • Sumitomo S160 Final Drive Travel Motor
  • Sumitomo X81D1H0102T-01 SEM-I-1613 9N23 Control Unit
  • Sumitomo RNYM02-1330A-B-100 Induction Gear Motor
  • Sumitomo KHR49330 Display Panel E00077
  • Sumitomo SH65-U Mini Excavator Front Idler Wheel
  • Sumitomo Type-Q102-CA Plus Fiber Fusion Splicer
  • Sumitomo SH120-2 Final Drive Track Travel Motor
  • Sumitomo SH120 Final Drive Track Travel Motor
  • Radio Energy RE O444 R2B Tachogenerator with Sumitomo Gearbox
  • STN ATLAS SEIDEL SM 56-M Servo Motor with Sumitomo F2CS-A25G-89 Gear
  • Sumitomo SH130 Final Drive Travel Motor
  • Sumitomo CHHMS02-6135DCB-B-731 Gear Motor 1/4HP
  • Sumitomo AS-3211 REV.E Industrial Control Motherboard
  • Sumitomo Electric TYPE-35SE Fusion Splicer Kit
  • Sumitomo 20 Ton Idler Assembly and Spring
  • Sumitomo F2CS-A25-59-01 Precision Gear Box
  • Isuzu 3LD1 Cylinder Head for Sumitomo SH30 Excavator
  • Sumitomo LHYJS-4A125Y-Y2-60 Cyclo Bevel Gear Motor
  • Sumitomo AF-500 AF502-A40 Transistor Inverter
  • Sumitomo Electric TYPE-201+VS-D-SKM Fusion Splicer
  • Sumitomo CNVM02-EO75-29 Gear Reducer Motor
  • Case CX130 Sumitomo SH120-3 Slew Ring
  • Sumitomo F-70H Water-Cooled Compressor
  • Sumitomo JA765439AC Control Board
  • Sumitomo Eaton Dowmax ME-3100-PS Hydraulic Motor
  • Sumitomo LHYJS-4A100Y-Y1-60 Gear Motor
  • Sumitomo AF504-5A5 SMAC PAC Drive
  • Sumitomo CNHMS34110YB17 Gearmotor
  • Sumitomo F2CS-T555 Fine Cyclo Gearbox
  • Sumitomo QT62-100L-A Gear Pump
  • Sumitomo CHHJ-4135Y-35 Gear Reducer Ratio 35
  • Sumitomo CNHM05-6125-DBYA-B-289 Gear Motor
  • Sumitomo CNFMS012-4095DAGB-731/G Brake Motor
  • Sumitomo SH35J Rubber Track
  • Sumitomo ULC100000-01 LNR Actuator Driver
  • Sumitomo CNVJS-6105Y-29 Gear Reducer
  • Sumitomo QT62-125F-BP-Z Hydraulic Gear Pump
  • Sumitomo S160 Rubber Track
  • Sumitomo SHI Cyclo Drive FCS-A35G-59
  • Sumitomo F-50HW Helium Compressor Unit
  • Sumitomo SM-Cyclo CHH-6165Y-6 Gear Reducer
  • Sumitomo REX-C3300-CS4 JA762528CD Temperature Card
  • Sumitomo Type 39S DCM Fusion Splicer
  • Sumitomo CNFMS012-6095DAGB-731/G Cyclo Reducer
  • Sumitomo Cyclo CNVMS-6105G-87/G Speed Reducer
  • Multivac Sumitomo F2CS-A25-59-01 Planetary Gearbox
  • Sumitomo 1FA15-59 F-Cyclo Speed Reducer
  • Isuzu 4JJ1 Tier 4 Engine DPF DEF Muffler Unit
  • Sumitomo SA767194AD SXAN-1CL Assy Board
  • Sumitomo PA222799 RNYMS1-1420YC-EP-20 Hyponic Gearmotor
  • Triconex 3723X Analog Input Module with HART
  • Sumitomo SM-Cyclo RNFMS01-20L-80 Motor Gear
  • Sumitomo AF503-3A7 Transistor Inverter
  • CASE Sumitomo KHR30842 KHR30840 Cab Harness
  • Sumitomo FCS-A25G-29 PB051710 Gear Kit
  • Sumitomo KHR1787 SMCU-5 Controller
  • Sumitomo AF503-2A2 Inverter 3.9kVA
  • AMT 9502 Touch Screen Panel
  • Sumitomo CHHJS-6135Y-R2-6 Gearbox Adapter
  • Sumitomo PA136445 RNYMS02-1320YC-40 Gearmotor
  • Sumitomo ANFX-P130F-1GL3-33 Gearbox
  • Sumitomo SH55U-2 Rubber Track
  • Sumitomo US60125-GA AC Servo Driver SS6000
  • Sumitomo CNFXS6075LB21 Cyclo Drive Reducer Motor
  • Sumitomo QT62-125F-BP-Z Hydraulic Gear Pump
  • Sumitomo CNFX-6090G-11/G Gearbox
  • Sumitomo X81D1-0102 SEM-I-1614 Control Module
  • Sumitomo Eaton C300-S Counterbalance Valve
  • Sumitomo GR-RF20 Z4-12193-5 Ozone Generator
  • Sumitomo T.SBXH1.5PL-25PD LN Modulator
  • Sumitomo 8700109 AS-3340 rev D CPU Module
  • Sumitomo SHI Cyclo Drive F3CS-A25G-89 Reducer
  • Sumitomo KNR0827 Wiring Harness SH120-3 SH120A3
  • Sumitomo ULC100011-01 LNR Actuator Driver
  • LUBE GMN-10-200-CB2-7L Lubricator Grease Pump
  • Sumitomo SH65UJ Rubber Track
  • Sumitomo KHR69310 Excavator Monitor
  • Sumitomo FDT-2FS Fiber Identifier Power Meter
  • Sumitomo CNVMS-4085G-43 Ink Fountain Motor
  • Sumitomo GV9924023-38 Circuit Board
  • Sumitomo 407915-5510 4BG1TRA ECU Controller
  • Sumitomo Cyclo F71m/4 Induction Motor 0.37kW
  • Sumitomo ANFJ-K30-SV-9 Hydraulic Control Valve
  • Hitachi Sumitomo 4625051 Pilot Valve Joystick
  • Sumitomo Demag W4RAP 6 W7-04-30 Valve
  • Sumitomo RV F2CF-A35-119 Gearbox
  • Sumitomo SH120 Slew Ring JCB JS130
  • Sumitomo Truninger QT-42-20HS-A Gear Pump