584,808 active members*
5,169 visitors online*
Register for free
Login
Results 1 to 18 of 18
  1. #1
    Join Date
    Feb 2005
    Posts
    303

    Programmed RS-232 output

    I'm certain I've seen a program that would dump a variable to the RS232 port during the course of a program. Does anyone know of a way to do this?

    I'm trying to do this on any of the following:
    Fanuc 18, 16
    Meldas
    Fadal

    Thanks in advance.

  2. #2
    Join Date
    Mar 2005
    Posts
    988
    On a Fanuc (and some other controls) its called DPRNT. Works like this...

    In the program...


    POPEN; (opens the port)
    DPRNT[#510[24]]; (outputs #510 variable)
    DPRNT[#109[14]]; (outputs #109 variable)
    DPRNT[#7301[24]]; (outputs offset G54.1 P16 X)
    PCLOS; (closes the port)

    The number after the variable is how the decimal gets outputed. The first digit being before the decimal, the second digit being after the decimal. Some controls you can even output characters with it to identify the data.

    POPEN; (opens the port)
    DPRNT[A#510[24]]; (outputs #510 variable)
    DPRNT[B#109[14]]; (outputs #109 variable)
    DPRNT[P16X#7301[24]]; (outputs offset G54.1 P16 X)
    PCLOS; (closes the port)

    The next trick is that you need a PC thats ready to receive the data and not timeout. Or a DNC system that can receive the trigger and save the file without user control, or a printer that can capture the data as it comes out.

    Theres also another one called BPRNT. I don't ever use this one though since I don't have a need to output hex or binary data (like machine parameters and such). You can also string the outputs as well in the program. I prefer to write it seperately though, makes it easier to read in the program and output. :cheers:

  3. #3
    Join Date
    Feb 2005
    Posts
    303
    thanks, psychomill! That's exactly what I was looking for!

  4. #4
    Join Date
    Jan 2004
    Posts
    92
    I know this is an older post but I've been wondering if this can only be used to output variable information?? Is it possible to have a signal sent out in this fashion say, every time the counter M code is read? Does Popen & Dprint work on all fanuc controls or only those with variable options activated? I'm thinking of building a simple data collection system using information obtained threw the rs232 port. All I need is a signal every time the machine completes a cycle. From there I can calculate cycletime, pcs/hr and machine efficiency. My problem is we have different machines and controllers. I'd like to find something common out of the rs232 port to use. Do you feel this is possible or am I barking up the wrong tree. Any thoughts would be helpful.
    Gunner

  5. #5
    Join Date
    Apr 2005
    Posts
    629
    Gunner,

    You need user macro function to do this. I believe it also has to be the user macro "B" function which is not available on all control models (3M, 3T, and others I think).

    Chris

  6. #6
    Join Date
    Mar 2005
    Posts
    988
    I don't think you need Macro B for this.... but you definately need the "external output command" option.... or so I've heard

    I've never actually run a machine that couldn't do it for any reason... except for having a short in the cable....

    :cheers:
    It's just a part..... cutter still goes round and round....

  7. #7
    Join Date
    Sep 2005
    Posts
    767

    Machine monitoring

    gunner: We've been doing this with our DNC systems for years, and there are several ways to do it.

    If you have "User Macro B" in your Fanuc control, you can use the POPEN, DPRNT, and PCLOS statements like psychomill says. Not all Fanucs have this option, however, so we use two other methods as well. On any Fanuc control, if you go to EDIT mode and type: POPEN then press INSERT, the CNCs that have the option will display the word just like it's shown. If it puts spaces between each letter, like this:

    P O P E N

    then the CNC doesn't recognize the POPEN key word, and you don't have the option.

    By far, the easiest way to monitor cycles is to use the DPRNT statement if you have it. All you have to do is send a simple word, like "START" or "FINISH" like so:

    O9010 (CYCLE START MACRO)
    POPEN
    DPRNT[START]
    PCLOS
    M99

    O9010 (CYCLE FINISH MACRO)
    POPEN
    DPRNT[FINISH]
    PCLOS
    M99

    If you use certain O-numbers for these macros, you can also assign a custom G-code or a custom M-code to automatically call them. In some cases, you won't even need to modify your programs at all. For example, if all your programs have a certain G-code at the beginning (say, "G20" for Inch programming), you can just put the number "20" in a parameter to make "G20" always call macro 9010. In a similar fashion, you can have the control call the "Finish" macro with the M30. The parameter locations for these settings are different in each model Fanuc control, so you will have to look them up in the manual.

    On the DNC side, just keep the port open and listen for the word "START" or "FINISH" (followed by a Line-Feed) then record the event in a file with the Date and Time variables from the PCs internal clock. You can then go back later and analyze all these events and calculate how many cycles you have, average cycle time, average load time, etc. We even tie this into our automatic paging and e-mail software so someone can get a page or e-mail if the machine has been idle for more than (x) minutes.

    For machines that DON'T have User Macro B, we use two other methods for monitoring.

    1) We can "drip-feed" files to the CNC, in which case the DNC system automatically knows when the Cycle Start and Cycle End events happen. Every time we get an "Xon" from the CNC to start a new part cycle, we record the "Start" event, and every time we transmit the last block of the file, we record the "Finish" event. On CNCs that have large input buffers (like Haas), the Finish event may not be recorded accurately with this method, because the M30 is sent to the control long before the CNC executes it.

    2) We also use a small relay and connect it to the signal that powers the "in cycle" light bulb or LED on the operator's panel. This relay then turns on one of the unused handshake lines on the RS232 cable (say, pin #8, or DCD). The DNC software just watches this signal, and knows the CNC is in cycle if it's on, and out of cycle when it's off.

    I'm sure there are other methods out there, but these three have served us well over the years.

    If you want more info on our DNC stuff, go to www.sub-soft.com

  8. #8
    Join Date
    Aug 2003
    Posts
    27
    I use the serial port to control an indexer. I have a subprogram that does POPEN and PCLOSE. I built an interface to check one of the control signals (don't remember which) and runs one step of the indexer program. I did it years ago and it works flawlessly. I just have to remember to switch cables when I want to input/output programs.

    Mats

  9. #9
    Join Date
    Jan 2004
    Posts
    92
    Thanks for the responses! I tested the Popen as described by Dan and it seems like at least the first couple machines will work. If time permits tomorrow, I will hook up a computer and see what results I get. Dan, I'm assuming Drip feeding is when the machine draws the program directly from the computer bit by bit as needed. Is that correct? I've never run a program larger than the machine memory so I've never had to do this. I believe they call that true DNC. In any case, how is this accomplished. Do you have to set machine parameters to keep the lines of communications open between the PC and the machine? I may end up having to do this method on some of the older CNC's.

    Thanks,
    Gunner

  10. #10
    Join Date
    Sep 2005
    Posts
    767

    Drip-feeding

    Gunner: You're correct that "drip-feeding" is when the machine is cutting metal while the data is being fed into the control. To drip-feed, your CNC control must have the capability to read the data and run at the same time. Not all CNCs can do this, but many can.

    On Fanuc controls, look for a "TAPE" mode on the mode select switch. If there is one, you can probably run in drip-feed mode. Really old machines that had paper tape readers can probably drip-feed in TAPE mode too, but you'll have to connect some kind of BTR (Behind the Tape Reader) interface to do it.

    A few model Fanucs could not drip-feed at all, like the old Fanuc 3T and 3M, the 0M-A and 0T-A, and a few others. Some have a setting bit or a parameter that lets you drip-feed.

    I don't recommend drip-feeding unless your programs are just too large to fit in memory. Running from memory is always more reliable. If your program is just a bit too large, maybe you can compress it a bit by deleting unnecessary characters, like N-numbers, spaces, comments, etc.

    The DPRNT function requires that the CNC has a free serial port, so if you're drip-feeding data through that serial port, you may not be able to use DPRNT at all. The only controls that I know could do this are the Fanuc 10M 11M and 15M. They had multiple serial ports, and the INPUT DEVICE and the OUTPUT DEVICE settings could be different, permitting drip-feeding through one port and DPRNT out the other.

    The old Fanuc 6 could do this also, but you had to drip-feed with a BTR connection and use the serial port for DPRNT.

  11. #11
    Join Date
    Jan 2004
    Posts
    92
    I'm planning on doing some testing today on the software and rs232 output for the machines I looked at yesterday. If I still have some time, I'll get around to some more machines and do the POPEN test to see if they are capable. As far as the drip feed, we generally don't run programs larger than the machine memory so ideally I would rather use the rs232 output to collect my data. We are just at the infant stages of data collection so I want to get all the facts gathered before we make any commitments to a certain direction. Thanks again for sharing your knowledge on the subject Dan. I'm sure I'll be inquiring more as I get deeper into the project.

    Gunner
    Gunner

  12. #12
    Join Date
    Mar 2005
    Posts
    1498
    051122-0941 EST USA

    Gunner:

    We have a product, TIMELOG-16, that can collect timing information from any kind of machine. Machining machines, and assembly lines.

    Thru timing analysis we were able to take an automotive differential line from about 80 parts/hr to 128 parts/hr. This is net average thruput over an 8 hr shift. Peak instantaneous thruput over a 1 hr period was about 140 parts/hr. This was limited by one or two machines on the line that had a minimum part to part cycle time of 25.7 seconds. The line had about 20 operators and you can reasonably estimate that cost per hour of this line at about $3000. At 80 parts per hour this is $37.50/part and at 128 it is $23.43. At 128 /hr we are at 91% efficiency. Further improvements to the line could be made but at high capital cost. In other words the slow machines have to be made faster. A good book to read is The Goal.

    TIMELOG-16 is a device that measures the real-time of the leading and trailing edge of of 16 different binary inputs. Time is quantized to 1/100 sec ( 10 milliseconds ) and there is no maximum time limit except 100 years. Up to 16 to 32 of the TIMELOG-16 units can be time shared on on RS422 multidrop line with no loss in time accuracy so long as the 422 line is not saturated. This type of monitoring will never affect the CNC program cycle.

    The TIMELOG-16 System requires no programming or software changes in your CNC or other machines if there already are relay outputs that provide the time signals in which you are interested.

    On a HAAS machine you could monitor the Green and Red Beacons. The Green is off after RESET. Green is on continuously when the machine is running. Green flashes following M00, M30, and after each operation in single step. We could create a flash detector that provided a logic one when the lamp was on continuous and a logic zero otherwise to an output, and to a second output a logic one only when the lamp was flashing. This would eliminate a large number of on-off transitions.

    One can also monitor the door switch, and start button. A detector could be made to detect X% on the load meter.

    Most of these are moderately accessible in the machine.

    On a HAAS if you want to add program statements you can control several spare relays.

    What you can do on a particular machine is dependent on available or created signals.

    I like using DPRNT but it does have some problems. You can not handshake block RS232 transmission for very long in the case of HAAS. If you do it creates problems. Also you can not send too much data all at once or there are problems because the HAAS RS232 output buffer is too small. Further, because of look-ahead timing information maybe incorrect.

    See the discussion on TIMELOG-16 on our web site at www.beta-a2.com .

    .

  13. #13
    Join Date
    Jul 2005
    Posts
    54

    I cant write it

    Hi,
    My machine have Fanuc 21itb control . I write sample program working without fault, but on the computer how is save file and I dont found in the computer Please tell me what kind of program and how use,
    I dont know please help me


    %
    :7777
    #500=#3901
    #501=#3011
    #502=#3012
    #503=#4115
    POPEN

    DPRNT[#500]
    PCLOS

    M30

  14. #14
    Join Date
    Jul 2005
    Posts
    54

    I have solved

    I have Solved
    Problem is [54]

    Who bady know What is the meaning [54]

    Correct writing
    :7777
    #500=#3901
    #501=#3011
    #502=#3012
    #503=#4115
    POPEN

    DPRNT[#500[54]]
    PCLOS

    M30

  15. #15
    Join Date
    May 2018
    Posts
    74

    Re: Programmed RS-232 output

    Hi Psychomill,That is very interested. By connecting the pc to the machine via rs232 we can out put the data. I am new with this and have some questions:1. Where the output data saved into pc? what kind of file? (Notepad?)2. We can do the output so can we do the input? If I have a file with some input data those need to be set in #500, #501...How to do that?3. Let say, I have a wireless micrometer. Is there any way to connect it to the machine so that after the operator mic the feature and he press the button. The value on mic will be set in to #500, #501...?We have some OKUMA and FANUC control machines.Thanks
    Quote Originally Posted by psychomill View Post
    On a Fanuc (and some other controls) its called DPRNT. Works like this...In the program...POPEN; (opens the port)DPRNT[#510[24]]; (outputs #510 variable)DPRNT[#109[14]]; (outputs #109 variable)DPRNT[#7301[24]]; (outputs offset G54.1 P16 X)PCLOS; (closes the port)The number after the variable is how the decimal gets outputed. The first digit being before the decimal, the second digit being after the decimal. Some controls you can even output characters with it to identify the data.POPEN; (opens the port)DPRNT[A#510[24]]; (outputs #510 variable)DPRNT[B#109[14]]; (outputs #109 variable)DPRNT[P16X#7301[24]]; (outputs offset G54.1 P16 X)PCLOS; (closes the port)The next trick is that you need a PC thats ready to receive the data and not timeout. Or a DNC system that can receive the trigger and save the file without user control, or a printer that can capture the data as it comes out.Theres also another one called BPRNT. I don't ever use this one though since I don't have a need to output hex or binary data (like machine parameters and such). You can also string the outputs as well in the program. I prefer to write it seperately though, makes it easier to read in the program and output. :cheers:

  16. #16
    Join Date
    Sep 2007
    Posts
    66

    Re: Programmed RS-232 output

    hi

    can somebody explaine


    how can i send text from the fanuc to my computer via dprint
    fanuc side is known
    but the computer doesn't understand the first line, so I don't see anything on my computer

    does anyone have the dnc side settings of the story.


    it seems that some programs / companies make it seem more difficult than it is !!!!!

    greetings bertus

  17. #17
    Join Date
    Jul 2010
    Posts
    118

    Re: Programmed RS-232 output

    Hi, Bertus,

    sample:
    (SAMPLE,2005-11-03)
    (OI-C, OUTPUT=DATE-TIME,PARTS-COUNTER,SKIP-POSITION)
    (SET 20=0,100=#3/5/7=1,101#0/7=1,102=0,103=11)
    (9600N2)
    POPEN
    DPRNT[D#3011[80] T#3012[80]]
    DPRNT[N#3901[53]]
    DPRNT[X#5061[53] Y#5062[53] Z#5063[53]]
    DPRNT[DATE#3011[80] TIME#3012[80]]
    DPRNT[PARTS COUNTER#3901[50]]
    PCLOS
    #3006=1(PRINT TO PC COMPLETED)
    M30


    result on PC:

    D 20051103T 130611
    N 147.000
    X .000Y .000Z .000
    D 20051103T 132834
    N 147.000
    X .000Y .000Z .000
    DATE 20051103TIME 132834
    PARTSCOUNTER 147
    D 20051103T 132903
    N 148.000
    X .000Y .000Z .000
    DATE 20051103TIME 132903
    PARTSCOUNTER 148

    have fun

    Norbert

  18. #18
    Join Date
    Jul 2010
    Posts
    118

    Re: I have solved

    Hi,

    meaning of [54]
    5 = number of digits before the decimal point
    4 = number of digits after the decimal point

    cheers

Similar Threads

  1. please help me learn Camsoft, programmed stops
    By djshop in forum CamSoft Products
    Replies: 5
    Last Post: 03-10-2013, 11:36 PM
  2. Y axis moving without being programmed HMB-1
    By carbidecraters in forum HURCO
    Replies: 1
    Last Post: 06-22-2008, 06:51 PM
  3. can this be programmed manually?
    By 300sniper in forum G-Code Programing
    Replies: 25
    Last Post: 02-15-2008, 05:07 AM
  4. Macro variable example I programmed today.
    By theemudracer in forum G-Code Programing
    Replies: 1
    Last Post: 03-08-2007, 03:50 AM
  5. Need PIC programmed
    By randyf1965 in forum CNC Wood Router Project Log
    Replies: 0
    Last Post: 03-27-2005, 12:56 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •