MrPLC Member
  • Content count

  • Joined

  • Last visited

Everything posted by tingxing

  1. Generate wave forms using LCPU

    Hello,  I am trying to generate a wave form, such as sin, using mitsubishi's LCPU. The problem I met is that time precision of the wave form generated is only about 30ms. I checked my cpu scan time is about 2-3ms. my DA conversion specification is 1ms/channel. I am afraid CC-Link communication delay is the cause, but not sure. From the wave form, it seems some where time division is limited to about 30ms. I have expected at least for example 10ms can be obtained, i.e. if the period of my wave form is 100ms, I can output and get at least 10 data points. Would anyone give me some advice. Many thanks in advance. Ting Xing  
  2. Generate wave forms using LCPU

    Thank you very much for your reference link. I am not sure, but what I got is not so quick: 10 points per 30ms. what I got seemed to be limited to an interval of 30ms.  The attached file is what I took from oscilloscope, which I output interpolated value from table by using SCL instruction. Though the table has about 10 points to describe Sin curve, it should not have been so coarse as what is shown in the picture. The picture apparently shows the limit of 30ms.   I  have checked scan time, which is 2-3 ms, and D/A's specification is 1ms/channel, so the limit might be bottle-necked at somewhere else ... Ting Xing  
  3. Hello, I try to use MC protocol to write to D devices through the embedded TCP port . But I found only a maximum of 19 points can be successfully written. When more than 20 points write data is send, it is just overlooked by CPU - no response. this it my write data for 19 word devices (D*) - it is OK. 500000FF03FF000064000814010000D*002000001300010000177A00000000000 000000042000000000001000A0002000A0002000700010007000B this is my write data for 50 word devices (D*) - NG 500000FF03FF0000E0000814010000D*002000003200010000177A00000000000 000000042000000000001000A0002000A0002000700010007000B00010001000B0 00B0065006500C900C9006500D20191000A0029000B002B000C002D000D0030000 000000000000000000000000000000000000000000000 the communication is PC -> PLC using Microsoft Windows .Net TcpClient component. my cpu is : L26CPU-BT Could you give me any advice? Many thanks in advance! Xing
  4. IR register operation

    Hello, Can I add an offset value to IR register? for example, MOVR D0, IR0 and I have an offset value stored in D1, for example, &100, could I add the offset of D1 into IR0, to get IR0 pointing to D100? I know I can just do MOVR D100, IR0, but for purpose of versatility, I want an offset to be added in such a way. Thanks in advance. Xing
  5. PID control in Mitsubishi PLC

    Hello, I have ever implemented PID control in Omron's PLC using its PID instructions. (thanks to the help of Mr. PLC's posts) Now I want to know if it is equally functional under Mitsubishi's PLC cpu's? Is the code complicated? Because I might only need one or two PID control loops, the processing overhead for CPU is negligible, is it right? Many thanks in advance. Ting
  6. PID control in Mitsubishi PLC

    Really easy? That will be quite assuring. Thank you for the manual and comparision of A and Q series. In Omron world, we ever used Loop Controller, which might be over-engineering, I think. Ting
  7. Induction Motor with encoder

    Hello, I am not sure if this topic is too far from what the forum concerns, but any advice is greatly appreciated including reference to other reference. I want to know if any induction motor has internal encoder equipped. We are using servo motors, and additionally an encoder for position check. Because the position control resolution requirement is about 1 degree, I am thinking about abandoning servo motor, and to use induction instead. Servo motor has internal encoders for outputting pulse information. And I wonder, if there are induction motors with internal encoders. Thanks in advance. Ting
  8. IR register operation

    Hi, Michael, Thank you very much. I got your idea. you mean adding offset to IR0? and I understand what to do: MOVR D0 IR0 -> yes, we use D device, and we just assign its initial address of D0 ; MOV D100 DR0 -> D100 has our memory block's starting address, we maintain it as a member of a table for all the memory blocks +L D100 IR0 IR0 MOV #1, +0,IR0 MOV #2, +1,IR0 MOV #3, +3,IR0 this is just what I wanted. before I posted here for help, in fact I had tested these codes, but not successful, because I mistakenly used +D100 IR0 IR0, in fact the instruction of +L should have been used. This is due to my ignorance of IR registers. Thank you Michael, and you all, for the enlightening instructions. Xing
  9. IR register operation

    Hello, Michael, your solution surely addresses the problem, but it lacks a point I need very much: specifying address shift(offset) by using +1, +2, +3 ... I know that using DR0,IR0 and shifting DR0 one by one could iterate the memory block, just like MOV #1, DR0,IR0 -> assign #1 to ex. D2000 ++DR0 MOV #2, DR0, IR0 -> assign #2 to ex. D2001 ++DR0 MOV +3, DR0,IR0 -> assign #3 to ex. D2002 but this kind of writing is not good for maintenance, because it is hard to check the actual address offset just by reading the code, and the offset is in fact calculated at runtime. the following is expected: MOV #1 +0,IR0 MOV #2 +1,IR0 MOV #3 +2,IR0 this way, the address shift is clear, and definite by checking the code. any mistakenly deleted or added any line can be identified without difficulty, on the contrary, the previous method is hard and time consuming when any problem occurs. to use +0,IR0 poses no difficulty, if I just assign the starting address to IR0, MOVR D2000 IR0 but, to go back to my initial question, the problem is how to avoid using D2000 directly, but indirectly, for example, MOVR D0 IR0 -> yes, we use D device, and we just assign its initial address of D0 MOV D100 DR0 -> D100 has our memory block's starting address, we maintain it as a member of a table for all the memory blocks MOV #??? DR0,IR0 -> OK, we address the first unit of the memory block MOV #??? +1,DR0,IR0 -> this is what I want: offset the DR0,IR0 from here by using +1, +2, +3..... instead of ++DR0: because later I will forget where I am if the memory has tens or hundreds of items, which is normal, for example, in the case of control recipe application. MOV #??? +2,DR0,IR0 MOV #??? +3,DR0,IR0 ... MOV #??? +1024,DR0,IR0 Xing
  10. IR register operation

    Maybe I could make it clearer in this way. We define several blocks of memory, and specify the starting addresses in a table: MOV #100, D0 -> block 1, starting from D100 MOV #200, D1 -> block 2, starting from D200 MOV #500, D2 -> block 3, starting from D500 and there are related instructions to assign values to these memory blocks, which might use MOVR instructions and IR registers. But if there is time to make any change to the starting address, I expect to limit the modification ONLY to the table itself. for example: MOV #1000, D0 MOV #2000, D1 MOV #5000, D2 Xing
  11. IR register operation

    Thank you for the detailed advices (sorry for the delay) What I want to do is, to assign a sequence of values to a memory block. for example: MOV #1, +1,IR0 MOV #9, +2,IR0 the +1, +2 indicate the offset from IR0, and putting instructions in this way is of great readability. if the lines extends to +10, +11 ....., and every offset position has its own meaning. The problem is, IR0, i.e. the starting address will subject to change, for example, currently the following is just fine: MOVR D100, IR0 but later or in any other cases, I need MOVR D200, IR0 I do not want to modify the MOVR instruction, instead, I want to specify D100 or D200 (or their offsets') in a memory, for example MOV #100, D0 or MOV #200, D0 and if D0 is changed, the starting address will be changed. Since DR0,IR0 indicates an address, if the MOVR instruction could assign the address to IR register the problem would be solved: MOVR DR0,IR0 IR1 <- psudo code Xing
  12. Omron Bit Set Instruction (vs. Mitsubishi PLC)

    thank you Michael, now I understand CJ2 can do. and as you pointed out, CS1G wont work. And I tested BITS N BYTES' sample, it works! except that I changed the output to the SET instruction: the 128bit, after W0.0, i.e. W8.0 can be turned. thank you all for the instructions. as I stated above, the purpose is to translate a number (used as command code from PC) in to a bit command. In mitsubishi, the SET command conveniently translates the number into the B devices. I have long formed the bias that Omron's development tool(Cxprogrammer) is better than that of Mitsubishi(gxworks). This might be an exception? or I am actually wrong. Xing
  13. Hello, I am looking for Omron PLC's bit set instruction, which is similar to Mitsubishi's, like, in Mitsubishi PLC: Set B1000Z0 if Z0 is 10AA, then B10AA will be set. has Omron's instruction set contains such functionality? In my application, PLC will receive a number for example N(i.e. a sequence number), and I want to set the set the Nth bit in a memory block (W or so). Many thanks in advance. Xing
  14. Omron Bit Set Instruction (vs. Mitsubishi PLC)

    great! surely, it will be the Set command using Dxx offset. thank you for your example ladder! 1. really the No. 128bit will be set ? my current instruction manual (w474-e1-09_cs_cj_nsj.pdf, old?) says the offset should be constant 0-15 or word address in I/O memory. 2. is this command usable in CS1G? in my cxprogrammer, there is error report. though our production equipment uses CJ2M, I am currently using CS1G for testing.
  15. Omron Bit Set Instruction (vs. Mitsubishi PLC)

    Thank you all very much! Yes, I am using the current CJ2M cpu's. for SETB W0 D0 if D0 = 128, will W8.0 be set? I mean, will the set operation span out to more than the one word(16bit) ? Xing
  16. Thank you very much for your reply. I am sure overwritten did not happen -> instead of sending once, I sent for several times, every time less than 20 words, it is OK. And there is no error code from PLC -> it seems CPU just overlooks the data packets. I asked Mitsubishi, they said there wont be any error code, or any error flag kept in CPU, it just appears nothing happened. One Mitsubishi support technician confirmed to me that this has nothing related to CPU settings, and advised me to check "TCP Maximum Segment Size". I use Windows 7, and know nothing about where to check the "TCP Maximum Segment Size" setting. Since I did no modification to my Windows network settings, I guess the default setting will not be too small to satisfy my moderate tcp datagrams. Thank you, and happy new year. Xing
  17. Could anyone tell me how to do integral calculation in Omron PLC? I get power (in fact, current) data, and I want to calculate power vs time integration. Thanks in advance. Xing
  18. Hello, I wonder if in some cases servo motor can be replaced with induction motor + encoder. Because my primary concern is position accuracy, if the encoder is accurate enough, can stop position be adjusted anyway? I dont care much about speed. I expect to cut some cost by using this configuration. Thanks in advance. Ting
  19. TCP Communication Response Time

    I have asked Mitsubishi online, and they said their CPU's TCP implementation has push bit set to "1" ! I am now asking them if they got the data of repose time of communicating with windows PC, especially when reading 1 word from some device. Xing
  20. TCP Communication Response Time

    Hello, I try to setup TCP communication between a PC and Q CPU using MC protocol (3E Ascii). My problem is, I found the communication response time is rather long: about 250ms - completely not negligible. To be specific, the response delay is found to be the time between send over and when data available at the TCP stream. Is this related to some setting at the Q CPU side? Many thanks in advance. Ting
  21. TCP Communication Response Time

    Sure, I also tell from the data, there are only tens of millisecs. I have to check it further. I tried to downsize the receive buffer of my Tcpclient, and change the NoDelay setting and so on. I think there must be a solution available - 250 ms is just unbearable! Xing
  22. TCP Communication Response Time

    I tried to monitor it with wireshark, the following is the monitoring result for ZR device read (only 1 word): 10 7.855994000 TCP 96 imgames > blackjack [PSH, ACK] Seq=2 Ack=1 Win=65535 Len=42 11 7.874295000 TCP 80 blackjack > imgames [PSH, ACK] Seq=1 Ack=44 Win=5840 Len=26 *500000FF03FF000018000104010000ZR0027ED0001D00000FF03FF00000800000025 the Len=42 message is what I sent to PLC, and the next line is what I received. There is not too much delay in response ? Xing
  23. TCP Communication Response Time

    I think there is no problem with response code. If there is anything wrong, the returned error code will be received. Because my return code is 0000, everything is right. I did some earch, and discussion indicate "IgnorePushBitOnReceives" of windows system is a cause. But even if I have changed the IgnorePushBitOnReceives to 1, there is no improvement. Xing
  24. TCP Communication Response Time

    Thank you very much for your analysis Kaare. It is not I do want to open the code, but because it is not strictly modular and hard to extract. The segment related to TCP communication is merely a use of Tcpclient of .Net 3.5. I just 1. establish connection ( at the initialization stage of my C# program) when it is time to do communication: 2. send communcation test 3. wait for response ready, which is tcpclient::GetStream().DataAvailable I dont close the connection until my program exits. And I am not using MX component. I assemble MC protocol communication text from scratch: it is not very complicated. And because even though there was delay, I got proper response from PLC, I think there is not anything wrong with the usage of MC protocol. Xing
  25. TCP Communication Response Time

    I have tested, to set the timeout to 500, or even 0, the delay time is almost the same, 250ms. Because I am reading ZR, I tried to read a different kind of device: D", it turned out to be the same. Really queer. For a large block of data, there wont be more delay due to TCP speed. But this delay is really annoying, it restricts my access to PLC data only 4 times per second. Xing