Guest Guest Posted July 14, 2005 Report Posted July 14, 2005 Dear gentlemen, In the first place, thanks to mr Jay Anthony for replying me in other forum and after I search through the net for a while then only I manage to get to this, www.mrplc.com.... Is another vEry interesting website... :) I just have a doubt. That is I would like to turn ON a 'bit lamp' only when 2 plc's address value is '1'. What is mean here is the 'bit lamp' can turn ON or OFF "automatically" when AND the two address value. The way I write is like below, eg: READCMEM($B200,[serialA:01525.00],1); READCMEM($B201,[serialA:01525.01],1); $B500=$B200 & $B201; In which the $B500 will be my bit lamp display address. Can this bit lamp be turn on/off automatically when there is a changes in any of my plc input address value? Or should I replace the $B500 with some other external bit or some other bit? Hope some of the experts over here can advise me or give some ideas to me as the new beginner. Thank You.. Quote
Sleepy Wombat Posted July 14, 2005 Report Posted July 14, 2005 I would of AND'd the two bits in the PLC and just read a singular lamp bit... but hey thats me...it seems more simple. Quote
PdL Posted July 14, 2005 Report Posted July 14, 2005 Exactly what I thought - rather lazy than tired Quote
Guest Guest Posted July 14, 2005 Report Posted July 14, 2005 Hi, gentlemen.. Thanks a lot for the reply. In actual, I do ever consider like this before. However, the schedule is very tight and my programmer requests see whether can do it using the macro or not. So.... what you all gentlemen thinking about? The previous one is the simplest that I can think of to write. Just that not really try before and wish not to debug and think of another way of re-write the macro until the last stage of testing. Hope gentlemen over here can give some opinion only... Thank you, thank you... Quote
Jay Anthony Posted July 14, 2005 Report Posted July 14, 2005 I have a solution for you, but it will be tonight before I can answer. Check back. OK, back again. The trick is to run an additional macro on an object that has a regular repeat. The NS has a System Heartbeat RUN signal ($SB0). Design a bit map lamp and have it addressed to $SB0 and then include your original code in the macro for this bit-lamp. See attached code. Bit_Lamp_And.zip Quote
ChrisKozanecki Posted July 14, 2005 Report Posted July 14, 2005 Why not use a Type 3 pushbutton? Type-3 turns on from of its write address along with combinations of its display addresses. Simply disable inputs from the control flag tab and its a multi-stage lamp. This method also works well for making a visual comparator circuit. Quote
Andrey Zhuk Posted July 14, 2005 Report Posted July 14, 2005 My variant: Using ON/OFF button with button Type "... changes according to the combination of display address 1 and 2" Quote
Jay Anthony Posted July 14, 2005 Report Posted July 14, 2005 Hang on Guys! The request was for a bit lamp to come on only when both bits were on the PLC - not a multi-state lamp. Quote
Nibroc Posted July 15, 2005 Report Posted July 15, 2005 (edited) Great tip Chris... ... However a pushbutton does work Jay, set the input control flag to Disable (ie no pushbutton function) set the off, off colour to colour 1 set the off, on colour to colour 1 set the on, off colour to colour 1 set the on, on colour to colour 2 and there you have it, a lamp which only switches on when two PLC bits are true!! no macros, no plc code!! easy... Pity NS screen doesn't allow expresions in all address fields though... NIBROC Edited July 15, 2005 by Nibroc Quote
Learner Posted July 15, 2005 Report Posted July 15, 2005 Hi, Hmmm..... I feel so hapPy that you all can still helping me out. I have to admit that I am using NS for not long. Is better say that I still not that mind 'resourceful' enough as you all, experts over here. (I worship you all) The type 3 button DOES solve my problem over here. But then, my programmer ask me what IF he needs to AND more than two bits? Then, I think I have caught in a problem again... Is there any ways some more? I got search through those buttons for more than 2 bits button and seems like can't...... really find. I will use this method for ANDing 2 bits. To Mr Jay Anthony, I got download the the file that you posted. However, I can't open the file as stating :Cannot read the data. It has been edited on the NS Designer, which is newer than that in the computer. I am currently using ver 6.1. So... sir, you got any idea about this? :) Thank You. Quote
Learner Posted July 15, 2005 Report Posted July 15, 2005 To sir Jay Anthony, What if you post the code on the forum unless if it is too long to be posted over here. Hope the code won't be too long for me the read... Thanks... Quote
ChrisKozanecki Posted July 15, 2005 Report Posted July 15, 2005 Unfortunately if you need to AND more than two bits, you will have to either use the macro that jay has provided, or you will need to AND them in the PLC. I have not found a way to have it automatically AND more than 2 bits. Quote
Jay Anthony Posted July 15, 2005 Report Posted July 15, 2005 Very ingenious, Chris! You too, Andrey! Thanks,Nibroc! I once had an old master programmer that said that there was no wrong way to program as long as it got the job done. It's just that there are sometimes better ways.... The method I am promoting has far reaching implications because it solves one universal need. How do you get the NS to do something all the time in a macro which is traditionally event driven. The answer is find something that happens with regularly caused events. Therefore any code placed in the Timing Macro will be executed on a regular interval. Also, the area outside the confines of the displayed screen is a good place to drop documenation and hidden elements. They still get downloaded to the screen and are executed if the element is active. I have converted the last program to Version 4, so that any one that has V1 hardware can use the example. TimingMacro.zip Quote
Guest Leaner Posted July 16, 2005 Report Posted July 16, 2005 Dear gentlemen, Still very much thank you for the helpS provided by you all experts and helpful gentlemen. :) Today, I try to do some downloading which I would like to test out myself. I think downloading have no problem. However, I encounter two things... First is, is it needed for every touch screen to display its $SB(bit) and $SW(word) in the plc's address? Then, how to determine the plc address? Secondly after I finish downloading, the touch screen it auto reset itself but then after it reset.. it just show 'connecting...' at the bottom right of the touch screen. Seems like it is 'trying' to connect but can't connect yet. Can anyone of you all give some opinions again or show me some websites or e-manual that I can study on? Also, how is the concept of doing the touch screen communication with the plc and what are the settings needed to do? Honestly, this is the first time I write touch screen and do the downloading.. Maybe you all don't have to explain to much but just show me some resouces and then I go and discover myself. Just afraid you guys may get boring with me... Thank You... Quote
ChrisKozanecki Posted July 16, 2005 Report Posted July 16, 2005 The reason why your touchscreen is only "connecting" is because the touchscreen expects a PLC to communicate with. I will try to answer your questions in order: The PLC and the Touchscreen must be set up the same for communication. I assume you are using an RS232 connection between the two from the built in port on your PLC? Based on this assumption, you need to set the PLC to NTLink 1:N then set the Touchscreen to NTLink 1:N. Make sure you set their nodes to different numbers. I am not on a computer that I can open CX-P or NS-Designer so i will doublecheck these answers probably monday. Quote
ChrisKozanecki Posted July 18, 2005 Report Posted July 18, 2005 (edited) Touchscreen: Comm A NT Link 1:N Unit No. 1 Comm Speed High PLC: HostLink Port NT Link 1:N Comm Speed 115200 NT/PC link Max 2 Basic Comm Settings for PLC/NS communication@MrPLC.com Edited July 18, 2005 by ChrisKozanecki Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.