An update on XMODEM, I have it working, though you have to use NO flow control, that is keep Xon/Xoff to none. You depend on the receiver sending 06hex ACK and 15hex NAK. Now the routines I have work, but I'm thinking I have some communications problem I am going to have to single-step through in SendPacket and SendFiles routines of the modules I imported into Jan's program. These routines are in the MainForm in a routine I call DripFeedCNCDataParts which is the 'meat' of my program. I send all data through this routine and I use it with the Xon/Xoff method of data transfer and works okay. Now I needed to add XMODEM so I wanted to use the same DripFeedCNCDataParts routine. But it needs to be called from ComPorts module and I successfully setup this with RaiseEvent following Jan's method with the AccessFormMarshal routine. So in XMODEM with CRC checking I send 128 bytes of data, which is actually 132 bytes, the first three bytes are the numbering of bytes with 01 01 FE and then 01 02 FD ... and the last byte is the Checksum byte which is calculated and thanks to Dick G. for the modules I imported.
What happens is kind of strange. What I think Fadal with it's CNC controller is doing in XMODEM is sending ACK (06hex) is that it also will send a NAK (15hex) and keep doing this at short intervals, such as 1/2 second or so. This is followed by 11hex (DC1) and then again 15hexs. This repeats until the next XMODEM 132 byte packet is sent.
Well I may not have the communication perfect and/or timing. And putting in appropriate delays is important, but you don't too much delay. Ideally you want to have 06hex followed by a new packet or if you don't get a 06hex then you would get just the 15hex (NAK). Then you would resend the same packet.
Okay, I am getting some success, as the packets are going through and the machine is working, going through the motions of milling, probing, etc. BUT, I make a program change based on the probing data. This program change is not known until the probing is done. This is where the RaiseEvent works and I can send one of two data files depending on the probing data. This happens immediately and is sent. BUT, when I do this, the packets all get sent at one time, and then followed are the responses (all of them) at once!
I will attach a file of this, so it makes sense. I am wondering if the fact that the SendPacket and SendFiles routines are in MainForm that I having this problem. Or maybe I have some delay in between running the different files that is causing this. I am going to keep working on this and report back what I find, I probably won't be back to the shop until Tuesday but I am going to single-step the SendPacket routine, because I still don't understand how it all works.
I have indicated in the image where the response is before I send the data with the RaiseEvent call. But using the RaiseEvent method does not give me a quick response but rather all the data is sent at the end. For a large amount of probing, I'm sure this would err.
I noticed that the SendPacket routine is Private, I am thinking that maybe it needs to be Public and or Shared? I won't be back to the shop until Tuesday. but
[attachment deleted by admin]