This is because many CNC need specific characters to tell it that comms is about to start or finish.Operating System: Windows XP,Vista,7,8,8.1,10 File Size: 2.18MB System Requirements: Intel Pentium 4 or higher.
Para Dnc4U Code A PiecePara Dnc4U Software That WillBrief DescriptionI am trying to code a piece of software that will load a text file from a directory, then send that data out to a com port.The ProblemI get an error on the machine that points to the BAUD rate being incorrect, yet I am confident that the BAUD is set correctly.DetailsI am sending the data via a Windows XP machine, running my software.The PC is them directly connected via an RS232 cable to a Bosch CNC control (Model CC220).When I send my Data I get the following error;Overflow Read Field The error code it gives me is 2662.When I check the error codes, it tells me that Error 2662 is a Loss of read-in data. It suggests that I check my BAUD rate, and it also points to problems with the interface or with the data iput device (the PC).I can rule out all but the BAUD rate, as I get the error wether I use my Laptop or the PC I have installed specifically for connecting to the CNC. I can also rule out interface errors, because we can communicate fine with the PC, using a DOS command to copy the file straight to the com port.The Code. I would suggest checking the cable you are using to comminicate with, and see if the handsahke lines are connected. Well thats interesting, the settings you posted for the DOS program you use seem to match the settings you originally posted, so on the face of it, they look correct. Para Dnc4U Manual What CommsIt should say in the manual what comms parameters should be used.You mentioned that when you send a smaller file it works ok This would definitely lead me to believe handshake or buffer size issuses to be the cause of the problems. It would be interesting to know the size of a file that does work, compared to a file that does not.Try setting the.WriteBufferSize properry of the com port to a larger number than the default od 2048. Code: comPort.WriteBufferSize 4096 For example If the size of your files approach this value in size, then I would suspect the buffer is getting filled, which would require handshaking to be in operation to deal with it. It seems odd that in your DOS program, handshaking is disabled (the RTS and DTR lines are merely set to on). Perhaps it creates a larger buffer by default and hence you are getting away with it.As far as taking the cable apart, it may be better to leave it at this stage, but if you feel like doing so, open up the end that plugs into the PC at detail any connections that are made. If the cable is a generic pin-to-pin type, then it maybe necessary to dig out the manual and have a look in there. I am convinced it is something to do with too much data getting sent to the port at once. I tried dropping the BAUD a few different values to see what happened. When I dropped it to 96() it didnt error upon receiving the data. I am convinced it is something to do with too much data getting sent to the port at once.That is the point of having Handshaking, so the transmitter can wait if the receiver cannot keep up with the data being sent.As the connections you have have the RTS and CTS pins connected, I would suggest that handshaking should be used.Another thing that springs to mind is the end of line characters, as you are sending text files. The link I posted above seems to indicate that a CR and LF (H0d, H0a) should be sent to the CNC machine. This is the default for the.Writeline method I think, but its worth checking. In the text files that it usually sends, there are no end of line characters.By end of line characters, I mean carriage returns or linefeeds. If when you view the file in Notepad for example, you can see each CNC command or whatever on a separate line, then it is fairly safe to assume there are some of those. Perhaps the files you have are a different encoding, maybe UTF8 or something.Maybe you could consider changing the Try.Catch arrangement to give you a more explicit error when it fails. At least change it to this for a test, so you know exactly what the exception is. Code: Catch ex As ExceptionMessagebox.Show(ex.Message)I tried that and found out that I was trying to set the WriteBufferSize whilst the port was open, so I have closed it and re-opened before sending, and I can now set the buffer sizeSo I shall test it on the machine today to find out if it has worked.Also I have been testing another piece of software called DNC4UWith the following settings the program works perfectly at sending my files.Here is an example of the files I am sending to the CNC (open in notepad or whatever). One things that stands out from looking at the docs for the DNC program, is that it says certain CNC machines require some characters to be sent before and after file transmission:From the docs:You can send a series of characters to your CNC both before and after file transmission.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |