Posted 3 Apr 2015 I am working on my first Omron PLC project and have couple of questions looking at the code. I have to add some functionality to the existing equipment. Basically add date/time setting to start up heating up of furnace so everything is ready for production at 7:00 am Monday:) The PLC is CJ1G CPU45SP, don't have the HMI model though right now. I have noticed that the HMI has dedicated objects for date/time, how would these values be written to the PLC? Do I need to put them into some specific locations? Are there any commands which can be used to subtract few hours from the time entered? For example they can enter that the production will start at 7:00am Monday morning and I know that I need 8 hours to get the temperature right, which means the start up will be at 11:00pm Sunday. Do I have to keep the track of this "manually" or are there instructions which would do it for me? I have also noticed that when I look at their HMI I see that given button will turn bit LR118.3 on, but when I look in the PLC ladder it seems that the actual bit activated will be 1118.03. Can anyone elaborate how those bits are referenced between HMI and PLC? What cable do I use to program this PLC? Seems like Omron type RS232 will work? Share this post Link to post Share on other sites
Posted 4 Apr 2015 Use CLOCK Calendar instructions CADD[370] or CSUB[371]. Programming cable for peripheral port is CS1W-CN226. Share this post Link to post Share on other sites
Posted 4 Apr 2015 There is a device for wrtitng time/date to the PLC - will have to try and find it. It takes thye HMI time and writes it to the PLC. Share this post Link to post Share on other sites
Posted 4 Apr 2015 I went through the manuals last night and saw these cadd and csub instructions. I guess another question is what is the easiest way to get the user chosen day/time to the plc for substraction? Right now I am thinking to have separate fields for minutes, hours, day, month and year (I don't care about seconds, will always assume 0) and shift, and, or them to put them into format accepted by csub instruction. Is there easier/quicker/better way to do it or am I on the right track? Share this post Link to post Share on other sites
Posted 5 Apr 2015 (edited) Not sure to understand what you need to do, since that with CADD and CSUB you dont need to extract in separates register, but if you have to do this anyway, I think that clock data are in A351, A352, A353 and A354. You have to extract data from theses register. If I recall correctly, seconds and minutes from A351, hour and day from A352, etc. Not sure from then but you will find it in the Manual. Here is a FB I found for this, a couple of years ago. It output all of it in separates outputs. Extract_Date_Time Ladder.zip Edited 5 Apr 2015 by pfort Share this post Link to post Share on other sites
Posted 6 Apr 2015 You have to decide WHO is in charge of controlling the YEAR/DATE/TIME! The HMI or the PLC. We prefer to utilize the PLC clock in our applications and use the CLOCK instructions. My 2 cents Share this post Link to post Share on other sites
Posted 7 Apr 2015 (edited) I had to implement the exact same thing a few years ago to control heating on our equipment with 3 "zones" starting at different times. I used the following operations to extract the hour and minutes from the PLC (Omron CP1H): MOVD(083) A351 #0012 D240MOVD(083) A352 #0210 D240D240 is a UINT_BCD and will contain the current time as HHMM after these operations. It is then fairly easy to compare a target time (300, for 3:00 AM) to the current time and activate heating as needed. To read the clock value of the PLC on the HMI, I used the following operations: XFRB(062) #2808 A351 D270This will send the date/time to DM as follow: D270: HHMM (hours and minutes) D271: MMDD (month and date) D272: 00YY (current year) MOVD(083) A354 #0020 D273To read the day of the week to D273 Edited 7 Apr 2015 by Junado Share this post Link to post Share on other sites