Author Topic: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)  (Read 151812 times)

Offline Pete.

  • Hero Member
  • *****
  • Posts: 1075
  • Country: gb
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #500 on: October 21, 2018, 05:38:06 PM »
I've said it before but I have to admire your tenacity Andrew.

That wouldn't be giving me any more trouble by now if I was working on it  :hammer: :hammer: :hammer: :hammer:

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2434
  • Country: gb
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #501 on: October 22, 2018, 02:29:57 AM »
Aaah, I see! Very clever  :smart: 

Although one immediately wonders what would happen if bits 47.1 and 47.2 were both set to true! (a real RS flipflop would output 0...)

I can see why you want a printout of the whole thing, it must be a bear trying to trace it all one logic unit at a time... It will be interesting to see if the Mazak has something similar (I guess it will).
Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Occasionally: Zhengzhou, China. An even longer way from anywhere...

Offline David Jupp

  • Sr. Member
  • ****
  • Posts: 308
  • Country: gb
  • Teesside - UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #502 on: October 22, 2018, 03:38:22 AM »
But the one in Andrew's screen shot looks like an SR not an RS so Set will take priority over Re-set as this rung is evaluated.

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #503 on: October 22, 2018, 03:49:11 AM »
Ade, I need the whole shooting match to check what is happening with the M20 command.

Chap hasn't got back to me yet BUT I'VE DONE IT MYSELF  :ddb: :ddb:

Simple when you know how and ignore the distractions in the manual that refer to printing and seem to have no relevance what so ever !

.PDF attached of the whole of PB202
Andrew Mawson
East Sussex

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2434
  • Country: gb
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #504 on: October 22, 2018, 04:16:41 AM »
Crumbs - I'd not like to try to work that lot out without a manual and a stiff cup of coffee!

What are the segments that look a little like machine code? And what do they do?  :scratch:

I reckon, if you gave me a week & a text version of that file, and a few hints from the manual, I could come up with a nice lathe simulator for you  :lol:
Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Occasionally: Zhengzhou, China. An even longer way from anywhere...

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #505 on: October 22, 2018, 04:23:44 AM »
So it's only taken since the beginning of August to get STEP5 running, talking to the 820T controller, and getting a vague understanding of my way about inside the PLC program. Not quite three months so it could have been worse !

Next step is to cross reference the ladder programs inputs and outputs to the corresponding entries on the various other documents such as the circuit diagram and wiring lists. That should hopefully start to reveal where the M codes are handled. I think that there is a documentation feature in STEP5 that will allow me to put 'labels' on the local copy of the PLC program which will make things far easier to understand.

. . . but I must confess to a warm glow this morning having got this far  :palm:
Andrew Mawson
East Sussex

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #506 on: October 22, 2018, 04:27:27 AM »
Crumbs - I'd not like to try to work that lot out without a manual and a stiff cup of coffee!

What are the segments that look a little like machine code? And what do they do?  :scratch:

I reckon, if you gave me a week & a text version of that file, and a few hints from the manual, I could come up with a nice lathe simulator for you  :lol:


I believe those sections are STEP5 commands that must be doing clever things yet to be revealed - I do have the list of commands if you fancy a bit of homework  :lol:

Something must also hook into the vast ASM file that gets loaded  but all this excitement is still over the horizon  :clap:
Andrew Mawson
East Sussex

Offline mc

  • Full Member
  • ***
  • Posts: 108
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #507 on: October 22, 2018, 05:45:48 AM »
Have you not got it all traced yet?
It's only 33 pages, and the first doesn't even contain any segments...  :D

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #508 on: October 22, 2018, 06:58:17 AM »
Thanks for the encouragement Mory  :clap:

I have, though, started the cross referencing - just a few labels at first to see how and where they appear. When inserted they are displayed on the screen in a tasteful yellow when you click on an input or output, but not in printed versions. I'm sure that it must be possible to get them on the print out, but I've yet to find how other than editing the .PDF (which I don't want to do as within STEP5 the label pop up in all sorts of different screens).

. . . so much to learn . . .so much fun . . .so many Aspirins  :lol:
« Last Edit: October 22, 2018, 08:43:37 AM by awemawson »
Andrew Mawson
East Sussex

Offline PekkaNF

  • Hero Member
  • *****
  • Posts: 2523
  • Country: fi
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #509 on: October 22, 2018, 09:02:51 AM »
That does not look too bad...Only it is ladder and I am more used to FUP. Some statement lists the but I did not spot any assembler.

If I remember right in S5 lingo S-R has reser overriding and R-S has set overriding. Modicon and Telemeganique had it it opposite - or A-B! Anyway, I had to check every time I changed my "language".

S5 has interesting timers, to convert S5 to Modicon had to make some extra logic to accommondate some of the timers used in S5, but not suported in Modicon.

First you need to check the offending outputs on harware, crossreference where outputs are set (only once in the program or someone has ****** up) and there you find the segmet it is set. Backtrack from there.

Commenting few segments and most inputs/outputs is a half a battle, figuring out the flags (typically exceptions like E-stop, Low hydraulic pressure, alarms, permits or states like "run" or "pause" or "jog" takes a little more tennacity.

But you are the man!

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #510 on: October 22, 2018, 09:24:55 AM »
Thanks Pekka, not come across FUB but I do know LOTS about FUD or Fear Uncertainty and Doubt  :clap:

I can display the PLC program as CSF, LAD or STL

CSF - Control System Flowchart

LAD - Ladder

STL - Statement List

But I suppose not all constructions are possible to display in some formats hence interspersed statement lists. Here is an example of SEG-2 in all three formats

Incidentally that I4.4 is eSTOP, I7.7 is 24 volts OK, Q 7.0 is a spare output, but I have as yet no idea what F 24.3 is except that it's an internal flag bit, or what Q78.1 is, again it's an internally used output from the range it sits in.

Perhaps I should explain I's are inputs F's are flags (temporary one bit memory) and Q's are outputs.  So Q 1.2 is output word 1 bit 2 for instance which would be 'select low gear on this lathe.


( all this is me trying to familiarise myself with what I'm working with - sorry if I'm boring you all  :scratch: )
Andrew Mawson
East Sussex

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #511 on: October 22, 2018, 09:54:13 AM »
So continuing on the theme of self education, and boring the pants off you, segment 1 translates as follows:

Segment 1
:STL
:L KH 0202        Load Hexadecimal 0202 into Accumulator 1-L
:T FW 121           Transfer contents of Accumulator 1-L into Flag Word 121 bits 8-15 to byte n, bits 0-7 to byte n+1
:L KH 0020        Load Hexadecimal 0020 into Accumulator 1-L
:T FW 119           Transfer contents of Accumulator 1-L into Flag Word 119 bits 8-15 to byte n, bits 0-7 to byte n+1
:***

Which can only be represented as a statement list, as flowchart or ladder are not appropriate
Andrew Mawson
East Sussex

Offline tom osselton

  • Hero Member
  • *****
  • Posts: 1255
  • Country: ca
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #512 on: October 22, 2018, 04:22:11 PM »
Not that boring but does make one scratch their head!
I’m waiting for the lightbulbs to turn on!

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #513 on: October 22, 2018, 04:40:01 PM »
You and me both Tom  :thumbup:

I've just spent the evening gleaning all the 'I bits' (ie inputs) from the circuit diagrams  that I have and typing them into a cross reference file that STEP5  uses to translate absolute labels (such as I 8.1) into symbols.

Next task is to do the same for all the outputs (Q bits) from the  circuit diagrams, then try and pick up the internal 'standard' flag words from the 'Guide to writing PLC programs from Siemens.

Hopefully when those tasks are completed the 33 pages of program will be more user friendly bed time reading  :lol:

. . . of course all this effort is no guarantee that the 'M20' issue that I'm seeking will be revealed, or indeed that the issue is even IN the PLC  :bugeye:
Andrew Mawson
East Sussex

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2434
  • Country: gb
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #514 on: October 22, 2018, 05:55:07 PM »

bits 8-15 to byte n, bits 0-7 to byte n+1


Ugh, I hate little-endian systems with a passion, they just don't feel right.

BTW, you might already have this manual, I can't remember off-hand, but in case it's useful, it appears to contain a Step5 programming manual:  https://cache.industry.siemens.com/dl/files/940/1085940/att_1156/v1/pa928ben.pdf
Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Occasionally: Zhengzhou, China. An even longer way from anywhere...

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #515 on: October 22, 2018, 06:10:07 PM »
Thanks for the link Ade, no I don't have that particular manual. It's for the S5-135U  Stand Alone PLC that the PLC embedded in the 820T controller emulates.

Assuming here, but I suppose that Siemens decided rather than have a physically separate PLC they could time slice the CPU in the controller to do the same job logically. The PLC even reports itself as a 135 when I connect to it.

I've yet to get fully to grips with it, but as I understand it the PLC copies it's field of input and output data to the CNC controller and vice versa once every pass of the program and that is how they communicate, setting the flag bits.

. . . It's a whole new world in there ! Bring back COBOL or ALGOL I say or even FORTRAN but I was happy with Z80 assembler  :clap:
Andrew Mawson
East Sussex

Offline PK

  • Sr. Member
  • ****
  • Posts: 369
  • Country: au
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #516 on: October 24, 2018, 04:21:17 AM »
So I've spent a little time studiously ignoring Andrews 'How's it going' messages whilst staring at that probe trying to figure out how to get into it.... It resisted hand opening, and there seemed no way to grip it with tools without digging into the anodised finish. I'm certain that special wrench #27 exists and does the job perfectly. But I aint got one! I don't even have a 25mm collet to grip the shank..... So it sat on the healing bench for a few days whilst we stared at it..  In the end some disassembly allowed me to bolt on a strip of metal that I could get a spanner onto, and a bit of scrap bored to 25, slit, and held in a vice did the job.
And we're in!..
We can now trace signal from the transmitter through to the receiver and make sure it's waking up...
We've flashed some IR at the transmitter and seen signal come out of it's photodiode, so it looks like that bits OK now....

Offline RotarySMP

  • Sr. Member
  • ****
  • Posts: 463
  • Country: at
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #517 on: October 24, 2018, 07:22:18 AM »
Hello Andrew,

Thanks for posting in this manor, as your documentation of your systematic approach to trouble shooting is a good lesson in how to solve this kind of problem.

Is there a point where you cut your losses, dump the original controller/PLC and retrofit to LinuxCNC? I'd appreciate hearing your thoughts on that.

On my MAHO 400E I didn't go very far down the path of fixing the existing Phillip's 432 installation, as the functionality of a 2.5D controller with 16kb ram didn't seem worth it, when compared to the significant improvement in capablity with LinuxCNC (full 3D, unlimited program length and look ahead). On a lathe I guess that equation balances out differently.

Mark
Best regards, Meilleures salutations, Mit freundlichen Grüßen, Cu salutari
Mark
https://www.youtube.com/c/RotarySMP

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #518 on: October 24, 2018, 07:28:44 AM »
PK good progress, thank you  :thumbup:

But I'm a little confused - are you saying that the OMM is now responding both ways, or the probe module ?
Andrew Mawson
East Sussex

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #519 on: October 24, 2018, 07:32:41 AM »
Mark,

99.9% of the PLC is working fine and is rather good, so absolutely no way it'll be changed.

I've spent a couple of days pouring over all the documentation that I have, and suitably cross referencing the innards of the PLC program - I'm up to just short of 300 references in the list so far  :bugeye:

However I am closing in on the M20 issue, having identified the bits of the program that are activated by M20 - it's an uphill struggle but progress IS being made.
Andrew Mawson
East Sussex

Offline RotarySMP

  • Sr. Member
  • ****
  • Posts: 463
  • Country: at
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #520 on: October 24, 2018, 08:07:00 AM »
Thanks Andrew, since you have done a lot of this work, have there been cases where you went the other way and retrofitted?
Mark
Best regards, Meilleures salutations, Mit freundlichen Grüßen, Cu salutari
Mark
https://www.youtube.com/c/RotarySMP

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #521 on: October 24, 2018, 08:44:02 AM »
VERY many years ago I did a Denford ORAC lathe and a Denford TRIAC mill. I bought both with totally destroyed controllers and fitted PC's running TurboCNC, as Mach hadn't got off the ground in those days. They worked very well and had the advantage that I knew the control programs inside out as I wrote them. Too small though so they financed the purchase of a Bridgeport Interact.

Prior to that I had semi-done a Bridgeport /  Moog (*) Hydropoint-1000 NC machine - it had hydraulic servo positioning, and pneumatic instruction reading by blowing air though punched paper tape 24 bytes at a time. I made a 'behind the tape reader' interface for it reading and writing driven serially off a PC parallel port using compressed air and tiny valves !! (and it worked!)

(* The MOOG in question was the brother of the Moog Synthesiser one which is where he got his pneumatic read concept. He went on to make hydraulic control valves for NASA for the 'man on the moon' program. In fact there is one of his hydraulic proportional control valves in the control loop of my Eurospark  H425 die sinker EDM machine)
Andrew Mawson
East Sussex

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #522 on: October 24, 2018, 11:45:05 AM »
Just to show you that I've not been entirely idle I'm attaching the main PLC program block 'PB202' with the Inputs, Outputs, Flags, Timers etc that I have so far managed to identify labelled.

Sadly the way the STEP5 'Documentation' function works, it lists the named items under the particular segment, rather than substituting the names in the actual segment of the ladder, but hey-ho it's better than nothing.

I think I've identified everything that is in the bits of documentation that I have, so from now on it's going to be a case of trying to work out the function of items then naming them myself.

An example is in Segment 61 where there is an S / R latch that is SET by the dynamic M code M20 (that is giving me the issues) Now I KNOW that Flag bit 31.4 is set for an M20 from documentation that I have, so it's been given an appropriate name. But the actual R/S latch, being implemented by Beaver when they built the machine, is NOT in any of the Siemens documents, but it still needs naming to understand the rest of the ladders, so I've christened it M20ACTV (or M20 active the label is limited to 8 characters) - so references to F 149.4 (bit 4 in flag byte 149) will later in the ladder have a name that MIGHT prompt more understanding !!

. . . lots more to do though
Andrew Mawson
East Sussex

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #523 on: October 26, 2018, 05:35:41 AM »
No activity yesterday other than printing out my latest cross reference list, as a reunion with friends in Littlehampton was the order of the day - early departure and late return.

However four hours of thinking time on the journey got me to a diagnostic method that I applied this morning. Now that I have the entire PLC program on paper, and can inspect inputs, outputs and flags using the inbuilt facility in real time I can trace what is happening.

So the problem is, that issuing an M20 ('Enable Spindle Drive') command that is the preparation for M19 'Spindle Orientation' the M20 is entered but then locks the control by not asserting the 'Read In Enable' line, so the control is freezing and not reading the next command. However the bits are set in the flag words that the spindle is indeed enabled by the M20.

Now having the PLC ladder in front of me like a circuit diagram, I can go through the logic that asserts 'Read In Enable', which is segment 77 that is a simple dependency on both F 136.6 and F 138.5 being False (or 0). This showed me that F 138.5 was the problem being at a '1'

The previous 'Segment 76' produces the flag bit F 138.5 from a twelve input structure requiring all it's inputs to be '0' (apart from one where the logic is inverted for 'Turret Card Fault') and the failing input was traced to the third input element being F 149.4 (M20 Active) in series with I 5.1 (Spindle Clamp Pressure Switch)

Well guess what - although the spindle clamps OK with an M31 and unclamps OK with an M32 the input on I 5.1 is the inverse of what I would have expected, with a '1' for unclamped and a '0' for clamped.

How could this possibly happen  :scratch: Well think back to the end of July, when I got all enthusiastic replacing the solenoid and pressure switch sockets as the old ones had perished - I couldn't possibly have wired it wrongly could I - oh yes I could  :palm:

So a quick wire move from the NC to the NO terminal, and guess what - the M20 command now completes as it should and the following M19 command is read in  :ddb:

However I'm not out of the woods yet, as the M19 keeps the 'Run' light on and doesn't orientate the spindle but just sits there glowing  :bang:
OK never mind, this IS actually major progress as now I can hopefully trace out what is happening just as you might with the equivalent physical relay circuit and a multi-meter.

Not every item in the PLC ladder is yet named, and probably never will be, but this method will let me concentrate on the area with the issue rather than having a scatter gun approach

« Last Edit: October 26, 2018, 06:35:13 AM by awemawson »
Andrew Mawson
East Sussex

Offline russ57

  • Sr. Member
  • ****
  • Posts: 278
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #524 on: October 26, 2018, 06:25:43 AM »
You must be chuffed Andrew...
 I reckon that is indeed significant progress.
-beating step 5 into grudging cooperation if not actual submission
- a window into the logic, if not a door.
-substantial progress in your spindle issue
-fixed one of hopefully only two defects (even if it was one you introduced )



Russ