Sign in to follow this  
Followers 0
Ronny_resistor

ASCII and CJ1G

23 posts in this topic

I am new here, my Omron experience is about 100 long hours and so far this forums has helped out quite a bit. I figure I could spend several more days checking all the Q&A's but I need to get moving on this project. I want to take a text file and move it into a CJ processor. I have the basic Ethernet setup and working now and I need to move information from Windows XP into the processor. This ASCII information will be different each time so I cant just leave the information in the CPU memory. Entering the information with CX-programmer is not an option either. The CPU stored text information will eventually be moved to a Serial Printer and pulsed to print with a PLC pre-determined pulse. I am hoping someone has some sample code that shows the following: ASCII movement from a Text file to the CPU and the ASCII file being moved serially from the PLC serial card to the printer. I figure that Hyperterminal could be used to check the serial portion of the print text. I have the following Omron Hardware: Ethernet card is CJ1W-ET21-V1 and the serial card is a CJ1W-SCU21-V1 When I started this project the Omron salesrep told me that "no problem" and "we can do that" etc. I am still waiting for any info from the sales rep. When I told him that the processor does not have an Toff instruction he told yes it does. After some pressure he admitted that no they don't. So now i am wondering if he really understood what we are trying to accomplish here. Any pointers would be appreciated. Thank you

Share this post


Link to post
Share on other sites
Many AB people ask for a Toff, but with Omron, or any other PLC, it is easy to build your own. With the new processors, you can build a Toff if you have to with the function blocks.

Share this post


Link to post
Share on other sites
I have read somewhere that a memory chip for the CJ will apppear as a harddrive to the XP system. Therfore I am hoping to utelize that for bringing the files into the CJ (Should have a memory chip by the middle of next week. I have played with the CX protocol a bit will concentrate harder on that. As for the Toff timer I have been able to program one with a TIM instruction and the Keep instruction (immediate on delay off).

Share this post


Link to post
Share on other sites
Yes, using the FTP server function of the ETN21. See section 4 in Omron manual W421 for detail on how to use the FTP functionality. The Compact Flash card (memory card) installed in the CPU slot can be accessed as a normal windows folder. There are several ways to access the memory card via FTP using windows XP, see an example below on how to add a 'network place' connection ... this is set up using the 'add network place' wizard available in the network connections folder of an XP PC. Once you have your folder accessible, you can freely transfer files to/from the memory card using windows XP and no special software. The files can be anything you wish. However note that if you wish to transfer ascii into the CPU's memory the files will need to be formatted in a suitable format. I suggest you store your text data as a .iom binary file, which can be read from the compact flash card using the standard Omron function block _CARD210_ReadIOM. This function block will read raw binary into the PLC memory in a block, which can be ascii if required. The ascii files could be created with notepad but must be saved with a .IOM extension. You will then be free to use the SCU (serial comms unit) with CX-protocol (as suggested by scott) to send the data to your printer via serial. Another method to use with the SCU would be using the TXDu, however I too recommend creating protocol macros using CX-Protocol as the best method. (note also that there is a predefined Omron function block (_CPU006_TOF_BIN10) to provide Toff, however I prefer just to use simple ladder for this) Sounds like a fun project... Nibroc _CARD210_ReadIOM.pdf _CPU006_TOF_BIN.pdf Edited by Nibroc

Share this post


Link to post
Share on other sites
Nibroc ol chap, is it not just as easy to use the serial port on the CPU, this would reduce the hardware costs? Edited by scottmurphy

Share this post


Link to post
Share on other sites
Hi Scott - Hope all is well Scotty, Ol Chap, -- just using the equipment supplied to me. Yes, you could use the RS232 port on the CPU via TXD/RXD etc. However, depending on the complexity of any required protocol handshaking required to the printer, an SCU with protocol macros could be the way to go. I too would use the RS232 port on the CPU if it the port is available, and if the required ascii output protocol is simple. (noting that simple is a term relative to the particular programmer!) I also note that learning how to use protocol macros could be a task in itself! We may have just done the salesman out of a module ? Tim Edited by Nibroc

Share this post


Link to post
Share on other sites
I have to agree on this since i do not understand the so called 'fins' connection nor if it pertains to this application. When i started to work with the software I noted that somethings took a long time to figure out, but once experienced the tasks were easy to repeat. (no different in the AB world ie: Remote I/O setup tables, or AB's earlier day PLC interface called "Interchange" I still remember programming in AB before RSLogix, APS as I recall not really great software, hours to figure out lots of issues, but in the end you understood it completely...not). BR Rick

Share this post


Link to post
Share on other sites
Here is one method for an Off timer: ----] [---------]/[------------------TIM 0010 Delay time XXX 5.00______Real Contact ----] [--------------------set---------Keep 5.00 Real Contact________________| ------------------------------------------| ----] [------------------reset-----------+ T0010 The Real contact is the on/off input the 5.00 from keep is a delayed off contact. Basically 5.00 turns on immediately and delays off as per TIM0010 time delay setting. Rick

Share this post


Link to post
Share on other sites
There is some sample code available in the downloads section at mrplc for using the TXD/RXD ladder commands, these commands can send data streams in/out of the CPU's serial port. If you wish to use the SCU module you would use the similar TXDU and RXDU ladder commands. See here http://forums.mrplc.com/index.php?autocom=downloads&showfile=288 - I think this should give you a kick start. The CPU also has instructions for handling ascii / hex conversion etc. Do you have access to all of the CPU manuals - Operation Manual W339, Programming Manual W394, Instructions Reference Manual W340 ?? If not we will be able to point you to a suitable download link. There are also various manuals for the ETN and SCU units if required?? Nibroc

Share this post


Link to post
Share on other sites
The manuals that Nibroc mentioned can be found here, as well as all other Omron manuals. Omron247.com knowledgecenter You can also search for manual code e.g W339 etc.

Share this post


Link to post
Share on other sites
Yes, I did wonder why the CPU serial port wasn't being contemplated instead os the extra module. Thought maybe I'd missed something ...

Share this post


Link to post
Share on other sites
You are not missing anything. I have a NS screen that was communicating through the CPU serial port. Since it is being used the saleman suggested that we add two more serial ports.

Share this post


Link to post
Share on other sites
Ok I have the CPU com port communicating using the @TXD instruction i can see the text being written to Hyperlink. The bit A392.05 is toggling on transmission. Question Is there any checking going on here ? Ie I can see my characters on Hyperlink but how do I know that all the characters have been transmitted(A392.05 toggeling ?). On the recieving end: I noted that the instruction A392.06 is off. This is supposed to turn on so that my Recieve buffer can move it's information into my PLC registers. I created a simple text file saved this and then used hyperlink to send the text file it did not do anything. I played with Xkermit/modem sending and one of the send 's I believed sent the text file when i looked on my PLC connected computer i noted the text file was transferred into the registers. I am still not sure who did what. BR Rick

Share this post


Link to post
Share on other sites
Not sure on this one, do the transfer again, see what method does the actual transfer.

Share this post


Link to post
Share on other sites
Not using the peripheral port, I have an Ethernet card so there is no connection to the peripheral port.

Share this post


Link to post
Share on other sites
... Hi Ronny, The reception complete flag is raised (A392.06) when the user set end code condition is met. This can be either: 1. A predetermined number of bytes is received 2. CR,LF 3. any 16 bit value The end code condition is set in the port settings - see picture below. I recommend studying the instructions reference manual for detailed info on both TXD and RXD. (if you haven't already!) As you are transmitting raw ascii text to/from the PLC you do not have any particular way to determine if a transmission/reception was successful, complete or if all data bits were received accurately (ie no error checking is performed). I suspect that it is not necessary for any real error checking with your application ? (such as checksums, error codes etc) Nibroc Edited by Nibroc

Share this post


Link to post
Share on other sites
Thanks Nibroc for the confirmation. I know these responses take time (not easy to insert graphics etc.) I have now successfully figured out how to use the TXDU instruction, i have the hardware (dual port serial card) so i figured why not. One question when I was playing around with the TXDU instruction i found that the Control word is in two words. I made two move instructions and entered (D200) 0000H and (D201) 2085H the registers both showed decimal values (&0) and (&8325) why did the move instruction change the hex value to decimal ??? Is it possible to keep them in a Hex format ??? I tried all the different format's in the symbol area's but none changed the format to Hex (IE UINT, ULINT, Channel). In case someone is wondering why I am using the Dual serial card, this project may require two Serial printers to print the same wording, this is why I opted for the dual serial port card. Next: I have been trying to configure the processor's E memory. My W394 manual (page ~ 252) talks about formatting this 'E' memory I can see the memory but when I try to format it in 'settings' the box is grayed out. I am wondering why? My Ethernet manual talks about being able to make the Memory chip available OR the processors 'E' memory, all you need to do is format this. A344 = FFFF my processor is a CJG-H (CJ1G-CPU43H) It must have the latest firmware revision. My CX programmer is version 6.1 Why is grayed out ? I have ordered a 30 MByte memory chip ($ 156.00 ouch, my camera's 2 Gig is only $ 29.99). Hope someone can give some answers on these questions. Regards Ronny

Share this post


Link to post
Share on other sites
Hello Ronny, This is because your processor only has bank E0 (E0_0 - E0_32767) - some of the other processors have up to 13 banks (E0 - EC), so the value of your E memory setting cannot be altered. If you check the 'EM File setting enabled' checkbox, then transfer the settings to the PLC, this will format the E0 bank of memory as file memory. Be aware, that this E memory will no longer be available within your program! Hope this helps. Edited by anonymous

Share this post


Link to post
Share on other sites
View, Monitoring Data Type, Monitor in Hex (Alt+Shift+H) If you define all you decimal values as UINT's etc, and leave your Hex data types as channels, and select monitor in Hex, you should see the actual values. Hope this helps.

Share this post


Link to post
Share on other sites
OK so far so good. I have an Serial port that prints on a toggle. I have an E memory configured that I can write with Windows XP (this was not easy but I now have the FTP server working, I can write anything i want to the E-File). I am trying to read the E-file with the FREAD(700) instruction. I have basically installed an Test file that has been saved as an IOM extension. (TEST.IOM) This file has the following text: " THIS IS A TEST" I have set the control word of the Fread instruction as #0001 This should point to the EM memory in the processor. S1 has been programmed with D00500 = #000A and D00501 = #0000 [10 words to read] D00502 = #0000 and D00503 = #0000 [starting at the beginning of the file + 0 words] S2 has been programmed D00600 = #5C50 D00601 = #5249 D00602 = #4E54 D00603 = #4552 D00604 = #5C54 D00605 = #4553 D00606 = #5400 (that should spell: \PRINTER\TEST [Q. Is the '\' correct should it not be '/' ?] Destination D00800 [ First Destination word] Bit 34311 is on which indicates that the file does not exist. Do i need to include the \EM to make the following ? \EM\PRINTER\TEST I know the file is on the Ftp server since i can see it on my computer and in the memory card EM folder. On my computer the server is pointing as follows: "ftp://192.168.1.1/EM/PRINTER/" (file that is residing here is TEST.iom In the Omron Processor: Omron PLC--->EM File Area--->PRINTER----->(files that are residing here are TEST.IOM).

Share this post


Link to post
Share on other sites
Hi Ronny, No, the setting in the control word (#0001) will look after this. I don't have too much time at the moment to set up a trial, how did you create the .iom extension - it is possible that you have created a file xxxx.iom.txt ? - sometimes windows explorer can be troublesome if you wish to change the extension by simply renaming ...? Keep us posted with any questions or progress updates ... Nibroc Edited by Nibroc

Share this post


Link to post
Share on other sites
I want to thank every one who may have read this. Since i had a 512 Mbyte chip that sells for $ 14.95 and works just fine. I wish i could have saved myself some money any way now i have the most expensive 30 Mbyte in history and a realistic priced 512 Mbyte chip. I guess I should start selling these.

Share this post


Link to post
Share on other sites
---->FREAD<---- Finally figured out what is going wrong I used a sample file to (FWRIT) write an *.iom file and then viewed this in Wordpad. I found 48 Characters that somewhat look like [] but connected at the top and bottom. Later I read that IOM files have the first 48 bits reserved and cannot be used (not shure if this applies to TXT or CSV files). I suppose if you write a file from inside the processor and then later read this file back into the processor you would not see this reserved occurrence . Hope this somewhat helps anyone else

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0