Jump to content
OMRON Forums

programming


xiaomupeng2009

Recommended Posts

#define K16 0.000015259 ; Constant of 2^-16

#define K128 0.0078125 ; Constant of 1/128

#define K23 0.000000119; Constant of 2^-23

#define Ix08 L1

L1->Y:(R1-$27)

#define Ix09 L2

L2->Y:(R1-$14)

#define Ix30 L3

L3->Y:(R1-$17)

#define Ix31 L4

L4->X:(R1-$1E)

#define Ix32 L5

L5->X:(R1-$21)

#define Ix33 L6

L6->X:(R1-$11)

#define Ix35 L7

L7->Y:(R1-$1D)

#define Ix63 L8

L8->Y:(R1-$11)

#define Ix69 L9 ; Note that this is 24-bit value, not 16

L9->Y:(R1-2)

#define STATUS L10

L10->X:(R1+0)

#define IPOS F1 ; Integrated position error register

F1->L:(R1-$12) ; Automatically zeroed on motor open loop

#define PDVEL F2 ; Previous desired velocity register

F2->L:(R1-$29) ; Automatically zeroed on motor open loop

#define AVEL P0 ; Floating-point actual velocity

#define DVEL P1 ; Floating-point net desired velocity

#define FE P2 ; Floating-point following error

#define APOS P3 ; Floating-point actual position

#define DPOS P4 ; Floating-point net desired position

#define DACOUT P5 ; Floating-point commanded output

OPEN SERVO CLEAR

COPYREG P0 ; Copy Motor AVEL,DVEL,FE,APOS,DPOS to float P0..4

 

 

If (STATUS&$12000 = $12000 Or STATUS&$10000 = 0) ; Test Ix34 mode

IPOS = FLIMIT(ITOF(Ix33)*FE*K23+IPOS, ITOF(Ix63)*ITOF(Ix08)*2)

; Scale Ix63 to include Ix08

EndIf

DACOUT = FLIMIT(ITOF(Ix30)*K16 * ( FE + K128 *(ITOF(Ix32) * DVEL + ITOF(Ix35)

* (DVEL - PDVEL) - ITOF(Ix31) *AVEL) + IPOS), ITOF(Ix69))

PDVEL =DVEL ; Store for next cycle

RETURN(FTOI(DACOUT))

CLOSE

 

 

 

this is a program in the instruction,when I put it into the software to run,it show the error that " PLCC illegal command or format string",why?

this is not a plc program,why it show PLCC illegal? the address of the PID parameter in normal algorithm can use it in the user defined algorithm?wish for your detail instruction!thank you!

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

The "OPEN SERVO" feature uses the PLCC compiler so the messages are the same as in compiling a PLC (this is very much like a PLCC0). There is an error in your code.

 

The following should be one line of code not two.

This is: DACOUT = FLIMIT(ITOF(Ix30)*K16 * ( FE + K128 *(ITOF(Ix32) * DVEL + ITOF(Ix35)

* (DVEL - PDVEL) - ITOF(Ix31) *AVEL) + IPOS), ITOF(Ix69))

This should be: DACOUT = FLIMIT(ITOF(Ix30)*K16 * ( FE + K128 *(ITOF(Ix32) * DVEL + ITOF(Ix35)* (DVEL - PDVEL) - ITOF(Ix31) *AVEL) + IPOS), ITOF(Ix69))

 

This is not a typographical error but a result of "cut and paste" putting a character in the middle of the line.

 

Once you make this correction it should download without errors.

Link to comment
Share on other sites

The "OPEN SERVO" feature uses the PLCC compiler so the messages are the same as in compiling a PLC (this is very much like a PLCC0). There is an error in your code.

 

The following should be one line of code not two.

This is: DACOUT = FLIMIT(ITOF(Ix30)*K16 * ( FE + K128 *(ITOF(Ix32) * DVEL + ITOF(Ix35)

* (DVEL - PDVEL) - ITOF(Ix31) *AVEL) + IPOS), ITOF(Ix69))

This should be: DACOUT = FLIMIT(ITOF(Ix30)*K16 * ( FE + K128 *(ITOF(Ix32) * DVEL + ITOF(Ix35)* (DVEL - PDVEL) - ITOF(Ix31) *AVEL) + IPOS), ITOF(Ix69))

 

This is not a typographical error but a result of "cut and paste" putting a character in the middle of the line.

 

Once you make this correction it should download without errors.

 

YES !thank you!but i want to know that the PID parameters address that M variables visit and L variable visit is the same address? for example,X:$000X9F/1F is the address of IX33,but in here,the L6->X:(R1-$11).is I133.they are represents the same address of I133?

or they are some different?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...