229
Choose HSC, the range is from HSC0 to HSC18
Choose the HSC frequency doubling (2 or 4)
The value can be register or constant, in this example, when the
counting value reaches compare value, HSC0 is ON. here the compare
value is 200000 which is saved in D10.
The HSC is relative mode or absolute mode
The starting registers to store 100 segments interruption preset value
100 segments interruption mode is cycle or not
The cam function is executed when any set value of 100-segment high
speed counting interruption equals the counting value.
Method 2: make the program
Instruction:
LD SM0 //SM0 is normally ON coil
DMOV K10000HD0 //segment one preset value HD0 is 10000
DMOV K-10000 HD2 //segment 2 preset value HD2 is -10000
DMOV K200000 D10 //set HSC compare value
LD M0 //HSC activate condition M0
CNT_AB HSC0 D10 HD0 //HSC interruption instruction
LDP M1 //HSC reset condition M1
RST HSC0 //reset HSC and 100 segments interruption
FEND //the main program end
I2000 //segment one interruption flag
LD SM0 //SM0 is normally ON coil
tudonghoatoancau.com