JouniK

MrPLC Member
  • Content count

    57
  • Joined

  • Last visited

Posts posted by JouniK


  1. This is not exactly Beckhoff tutorial, but for ST you could start with this:
    http://www.plcacademy.com/structured-text-tutorial/

    And there's some youtube videos:
    https://www.youtube.com/watch?v=l_nFE9wx8OM
    https://www.youtube.com/watch?v=lleGuQOFNgo
    + plenty more.

    and Beckhoff infosys online:
    https://infosys.beckhoff.com/index_en.htm


  2. To count the cycles, first get the task number: TaskIndexID( index => TaskNr ); (* Get this tasks number *) Then get the cycletime from SystemTaskInfoArr: SystemTaskInfoArr[TaskNr].cycleTime (* cycle time in 100ns *) Then get the cycle count from SystemTaskInfoArr: SystemTaskInfoArr[TaskNr].cycleCount and you can use those to calculate passed time PassedTime:= SystemTaskInfoArr[TaskNr].cycleTime * SystemTaskInfoArr[TaskNr].cycleCount; If cycle time gets exceeded, you can check the cycleTimeExceeded and see the last cycle time lastExecTime from SystemTaskInfoArr and adjust the calculated time with that, but maybe you have some other more pressing issues, if the cycle time gets exceeded than couple of extra ticks in your timer. SystemTaskInfoArr is not visible during offline, but you can see it online in your global variables.

  3. Well there are lots of Flash/eeprom programmers in online stores, so one way would be to get one and backup the eeprom like that and then write it on the new one. Other way would be to desolder the chip and desolder the one on the new PLC and then solder the old chip to the new PLC. There are bits for soldering irons for soldering and desoldering PLCC packaged chips.

  4. Here's one version. In that code of yours, the function reads the data with the "data" pointer one byte at a time and does the CRC check until it hits 0x00 byte, which would be the end of the string. Also i do not know C#, but what i fould out is that there is no unsigned char in C#, rather you're supposed to use byte, so my version uses byte. Also there is no rotate in C# according to what i found, but the >> is a shift, so that comment in the code is not true. Also instead of using the pointer way of doing it, the data is passed to this function as a parameter (in this example, it's a byte array from 0 to 2, giving 3 bytes). You can change that however you need. You maybe should also rename the variables better than A and B, i just did that, so you could better compare the C# code and the ST code. Hopefully you have some way of verifying the result. I just quickly checked that it does what the comments say, but there could be bug(s). Here's your code with my added comments: unsigned char CalcCRC8(unsigned char *Data) { unsigned char LoopCntr; unsigned char A; unsigned char B; unsigned char CRC8 = 0; B = 0; // B is the index for pointing to new byte while (*(Data + B)){ // while pointer points to data that isn't 0x00, which would mark the end of the "string" A = *(Data + B); // copy the data to A for (LoopCntr = 0; LoopCntr < 8; LoopCntr++, A >>= 1){ // 8 bit loop if ((A ^ CRC8) & 0x01){ // test bit 0 of (Data XOR CRC8) CRC8 ^= 0x18; // toggle bits 3 and 4 of CRC8 CRC8 >>= 1; // rotate right CRC8, 1 time CRC8 |= 0x80; // set bit 7 of CRC8 } else { CRC8 >>= 1; // rotate right CRC8, 1 time } } B++; // Byte handled, increment index for next byte } return CRC8; // return CRC8 } Here's the code for twincat: FUNCTION CRC8 : BYTE VAR_INPUT Data : ARRAY[0..2] OF BYTE; END_VAR VAR B : BYTE; (* data index *) LoopCntr: BYTE; (* Bit loop counter *) A: BYTE; (* Temporary data byte *) END_VAR CRC8:= 0; (* reset CRC *) B:= 0; (* Reset index *) WHILE ( B < 3 ) DO (* while not end of data *) A:= data[B]; (* Read data to A *) LoopCntr:= 0; (* Reset loop counter *) WHILE ( LoopCntr < 8 ) DO (* 8 bit loop *) IF (((A XOR CRC8) AND 16#01) > 0) THEN (* test bit 0 OF (Data XOR CRC8) *) CRC8:= CRC8 XOR 16#18; (* toggle bits 3 AND 4 OF CRC8 *) CRC8:= SHR(CRC8, 1); (* shift RIGHT CRC8, 1 TIME *) CRC8:= CRC8 OR 16#80; (* set bit 7 OF CRC8 *) ELSE CRC8:= SHR(CRC8, 1); (* shift right CRC8, 1 time *) END_IF; LoopCntr:= LoopCntr + 1; (* Increase loop counter for next bit *) A:= SHR(A,1); (* Shift data 1 bit right *) END_WHILE; B:= B + 1; (* Increment index for next byte *) END_WHILE;
    1 person likes this

  5. That's pretty much how it works. If it's a beckhoff module, you can just select it from the list, no need for any files, but other manufacturers stuff need the file, naturally. One thing is that, it's better to scan the PLC hardware and then add the modules(unless you happen to have all the modules with power, you can scan them all, which is the best option), because it's hard to know the exact configuration of the PLC. Unfortunately beckhoff doesn't give the basic configurations for the PLCs (i've asked, when i needed to start a project, but didn't have the PLC hardware at hand, atleast they didn't because they didn't have that PLC available to them at that moment), so you might have to just add something and add the correct PLC configuration later.

  6. Neither syswin or cx program SKxx and SPxx logics. Bluebyu It's not LSS we are talking about, it's minilss, it's for SK and SP logics. You do not need to install minilss, it runs fine without intalling. Just unpack it and type minilss. The other thing i've told people in these forums before is that i've personally run it with a pentium mmx (130 or 160 Mhz can't remember) and it worked, but it didn't work with a P2 400Mhz. I didn't try it with a slowdown software (which you might want to try. There's a free software called slowdown, check it out) Btw this forum doesn't work right on mozilla, This thing i'm writing into is ontop of the smiley-ad.

  7. My 2nd NT20M, which has s-ram, has a chip from SEC Km681000BLP-7L, which is a 128KB chip. Chips from other manufacturers work too and it can be smaller, don't know if it can be bigger. I don't know the speed requirement, but i think you can find that info from the NT20M manual.

  8. EEPROM is Electronically Erasable Programmable Read Only Memory and the NT unit can program it. Obviously you need to switch the memory type selection switch back to eeprom. I have no idea why there's a problem where you can't get to the transmit mode when eeprom is selected. I guess you just have to play with the switches.

  9. If i remember correctly, you really don't need to install it. just run it where you've unpacked it. Then you have to slow down your computer, because it won't run on today's fast computers(cause it's badly written). To slow down the machine, use a tool like slowdown. I tried running it on a 400Mhz PII and it wouldn't run. I haven't tested it with slow down tool though. It runs fine with atleast with a 150 Mhz Pentium mmx and below (from my personal experience).

  10. These settings have worked for my C28K and lk201 hostlink unit, though i have only tried it with syswin 3.2( if that makes any difference). I haven't changed them: SW1: machine no: 0 parity: even data format: ascii power on: program (in other words all from SW0 are set to 0) SW2: baud rate 9600 SW3: default (dip 1 =1, the rest are 0)

  11. ok, thanks. ---EDIT Well, it is the fuse. I did notice it, when i looked at the insides of this, but at that time i had no meter to test it and it looked just fine. I just measured it and it's busted. Another thing, unless someone has switched the insides of the HG-63, these two CPU units are identical. The HE-42 has a sticker, which says it's a HE-42, but the HG-63 doesn't. They have the same chips, same oscillator speed and both "motherboards" even say C200HE-CPU32, and since there aren't any flash or eprom chips, the code must be within the processor. That would suggest that by only swapping the processor, the HE can be turned into HG and vice versa.

  12. All i know about the damage is that someone had put a note on te CPU, which said the poweroutput(roughly translated) of the serial port is broken. I'm not really sure what that means. I can't test it yet, since i have no PSU for it. I'll check it once i get the PSU.

  13. Yeah i'm quite sure there are differences with the instructions, but i was thinking more wether there are differences between the hardware of the cpu, the "motherboard" of the cpu unit, so maybe i could just swap the processor chips and the HE would become HG and i'd get the better cpu with the working serial port.

  14. I have these cpu units and the serial port of the hg is apparently somehow damaged and since they look very mush alike i was thinking, that maybe the only difference is the actual processor of those cpus? What do you think? Both the "motherboards" look exactly the same and have the same text on them.

  15. I have 2 and a half C28K PLCs and 1 3g2c7-lk201. It's a dang big box and pretty complicated. It has a processor and about 15 logic chips and an eprom for the processor. If you want, i can take pictures of the insides. I once thought about trying to make one myself, but it's too big of a job for me. I have no info about the connection between the lk201 and the PLC

  16. I've been thinking of PC software HMIs and how to make one using Openoffice.org. Why openoffice? Because it runs on linux (and windows). Well anyway. I haven't figured out a way to acquire/send the data from/to the PLCs (in my case omron) in a way that openoffice calc could be used. I was searching the net and found a project called Lintouch. It's an open source software HMI and it runs on linux and windows(only 2000/XP sadly). Anyway, it seems they don't have that many plugins for communicating with PLCs and other HW, so i was wondering, if there are people capable of PC programming and willing to make such plugins? I don't know, maybe someone else is interested too. I'm not a PC programmer, so i'm not much of a help.

  17. That's because they are connected with rs232 to the PLC, but this version has only this c200h direct connection. These do have rs232 too, but only for use with the programming tool(what's the big idea?). I was thinking that maybe the newer PLCs like CJ and others might have the c200h direct connection, but i guess not. The connector is the same as the peripheral connector in CPM and CQM, but i guess they use some different protocol or something funny.

  18. It figures. This really pisses me off. D*mn omron can't do anything right. There's no point in having a million different protocols and connections other than ripping money. If only i could find the specs for the connection.