Thread: Touch Screen Monitor Program

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    6

    Touch Screen Monitor Program

    I have a touch screen monitor (HMI) that I am tinkering with. It programs a series of tempurature controllers I have. I got it to talk to one controller but it doesn't pass on the info to 1 other controller I have attached for practice. Here is the code I have.

    Code:
    int range = 5;
    
    while(State != 3)
    {
    	switch(State)
    	{
    		case 0:
    			if((Abs(PV1-ActiveSP) < range)&&(Abs(PV2-ActiveSP1) < range)) // wait until PV is with range
    			{
    				State = 1;
    				FinishTime = GetNow() + ActiveSoak;
    			}
    			break;
    
    		case 1:
    			if(GetNow() >= FinishTime)	
    			{
    				RunningStep++;
    				State = 2;
    			}
    			break;
    		case 2:
    			if((SPs[RunningStep] == 0)&&(SPs1[RunningStep] == 0)&&
    			(Ramps[RunningStep] == 0)&&(Ramps1[RunningStep] == 0)&&
    			(Soaks[RunningStep] == 0)&&(Soaks1[RunningStep] == 0))
    			{
    				State = 3;
    				CTL = 0;
    				ActiveSP = 0;
    			}
    			else
    			{
    				State = 0;
    				ActiveSP = SPs[RunningStep];
    				ActiveRamp = Ramps[RunningStep];
    				ActiveSoak = Soaks[RunningStep];
    				ActiveSP1 = SPs1[RunningStep];
    				ActiveRR1 = Ramps1[RunningStep];
    				ActiveSoak1 = Soaks1[RunningStep];
    			}
    			break;
    	}
    }
    The HMI has a TAG section and all of my TAG's are associated correctly.

    This may be odd since it's not a OS specific problem.

    Any help is appreciated. Just a warning, I will have many more questions I am sure. Plus if you can help with this I can direct you to the program software that is free with this HMI and you can view my Database completely.

    Thanks,

    EW
    Last edited by EWTexas; 09-15-2006 at 03:31 PM.

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Please use code tags. I'm sure this is not the first time ever you post on a forum.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    6
    Actually, this is the first time I have posted to a message board.

    Hard to believe, but true. I haven't even established a cute litte quip to sign my message with like all the bright individuals I see here.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Not much can be determined from that code. Can you post some more information?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    On another note, wouldnt you be better posting this on the windows programming board?
    It sounds like somthing a windows procedure might handle.

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    This may be odd since it's not a OS specific problem.
    It doesn't seem like Windows code.

    [edit] Besides:
    On another note, wouldnt you be better posting this on the windows programming board?
    If the OP took your suggestion, [s]he'd get in trouble for cross-posting. If it belongs on the Windows forum, a moderator will move it. [/edit]
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  7. #7
    Registered User
    Join Date
    Aug 2006
    Posts
    100
    What HMI Package? What are you trying to write? What OPC (or DDE) server? Do you have your topics properly addressed to the correct device? Correct port? What protocol? Profibus? Modbus? ModbusTCP?

    Your sample program has nothing to do at all with communications to a field device on an industrial control system.

  8. #8
    Registered User
    Join Date
    Sep 2006
    Posts
    6
    Good day! I appreciate all the responses so far and realize I have not given enough data.

    The HMI database is Crimson 2.0 from redlion. The programming is in C++ for Modbus communications from the Red Lion HMI to a series of Ramp to Set Point Controllers. I have the addresses for the controllers for the program to talk to. The program will build a recipe to pass to the controllers to heat to a certain temperature, check to make sure all the thermocouples are reading the same temperature, then move on to the next step going to 1125 degrees, then cooling down over a period.

    The program Database can be downloaded for free at http://www.redlion.net/Support/Softw...n2.0/Setup.exe
    and I have my database file that can be uploaded to any interested parties.

    Thanks again for your responses.

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    But where is YOUR code you wrote to actually talk to the devices?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  10. #10
    Registered User
    Join Date
    Sep 2006
    Posts
    6
    I believe the answer is that the code is inside the HMI device. Within the Crimson 2 program. The Crimson 2 program has 7 interface sections one of which is the programming section. One is interface design, one is communications setup, one is data logger, one is web server, and the last one is security. All of the programming code is done in the programming section.

  11. #11
    Registered User
    Join Date
    Sep 2006
    Posts
    6
    Here are other code variables entered

    This is "begin"

    Code:
    State = RunningStep = 0;
    ActiveSP = SPs[RunningStep];
    ActiveSP1 = SPs1[RunningStep];
    ActiveRamp = Ramps[RunningStep];
    ActiveRR1 = Ramps1[RunningStep];
    ActiveSoak = Soaks[RunningStep];
    ActiveSoak1 = Soaks1[RunningStep];
    
    MainProgram();

    The code entered in my first post was called "main"

    and I wrote this to "clear" data entered

    Code:
    
    int i;
    
    for(i = 0; i < 16; i ++)
    {
    	SPs[i] = 0;
    	Ramps[i] = 0;
    	Soaks[i] = 0;
    }


    thanks!

  12. #12
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    All that seems to be doing is altering a few variables.

    I'm beginning to think this has nothing to do with C++ at all, and it's just some simple scripting language which vaguely resembles C++.

    Nor am I interested in downloading 30MB of application just to find out.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  13. #13
    Registered User
    Join Date
    Sep 2006
    Posts
    6
    It would appear that I posted this problem to the wrong group of programmers. I do apologize for wasting time. I was told by the HMI company that the programming language was C++ and I took that at their word.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 04:56 PM
  2. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  3. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  4. Converting from Screen to World Coordinates
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 05-11-2004, 12:51 PM
  5. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM