Jump to content
OMRON Forums

KEJR

Members
  • Posts

    297
  • Joined

  • Last visited

Everything posted by KEJR

  1. I have some questions regarding the "release" of VGA connectivity and HMI software: - When will we find out what USB-VGA adapter to use, and will we need updated firmware/drivers to use it? - Is there a specific touchscreen driver that is known to work? How do we install it? - When will the .net component for C#/mono IDE be released? We would like to do native HMI on our machine and we need the first two things to work at a minimum. I can do Python-TK and/or GTK programming to get an HMI up and running but I need touchscreen and VGA capability to do this. Any help/tips would be appreciated. KEJR
  2. KEJR

    IDE viable?

    For what its worth, I'm using VS2008 in conjunction with the Power PMAC IDE: Version: 1.1.0.44 Date: 09/30/2009 So far I've used both without any trashing. I think this version of IDE is based on VS2009, so it might not be an apples-apples comparison. KEJR
  3. I am leaning toward using GTK and building the HMI screen directly from C code in a "C application" using the Delta Tau IDE. Is there library support for GTK in the development environment, or would we have to install the GTK libraries into the Power PMAC IDE cross compiler environment? Would we be better off doing this outside of the Power PMAC IDE?
  4. Hello, I've looked but could not see how to access the Sys.Time Variable from shared memory. Can this be done? I like how this timer is done from the Script universe and was wondering how to use it for timing in C programs. Thanks, ~Ken
  5. It *was* the lack of library initialization that caused the seg fault. This was in the program example but I had overlooked it. I put it in and now the DT "Command()" works from either the threads, or the original process "main()". I think at this point we are dangerous, and I look forward to seeing what else we can do with this system. Thank you, ~Ken
  6. I managed to get my app running on Friday. I have it running in FIFO periodic mode with a 1ms "wakeup" time. I'm not sure if this was the original issue or not, but the "Command()" function call seems to crash the program with the message "Segmentation Fault". I'm going to look at increasing the stack size for my threads so that I can call the DT functions (stack size is at the xenomai default now).[hr] I changed my stacksize up to 64k and still was getting a seg fault. I ran GDB on it and got the following message when it had the errror. Note that "line 56" contains "Command("#1 j/");". I also attached the code so you can see what I'm doing. The code works well as long as I comment out the calls to "Command()" function. *** GDB output *** Starting program: /var/ftp/usrflash/Project/C Language/Background Progr .out [Thread debugging using libthread_db enabled] [New Thread 0x30026770 (LWP 11228)] [New Thread 0x308304d0 (LWP 11232)] [Switching to Thread 0x308304d0 (LWP 11232)] Breakpoint 1, thread1code (args=0x0) at capp1.c:53 53 capp1.c: No such file or directory. in capp1.c (gdb) next 56 in capp1.c (gdb) next Program received signal SIGSEGV, Segmentation fault. 0x0fe4df1c in PPCmdProcessor () from /opt/ppmac/libppmac/libppmac.so *** End GDB output *** *** Begin code *** //-------------------------------------------------------------------------------- #include #include // Global Rt/Gp Shared memory pointers //------------------------------------------------------------- // The following is a projpp created file from the User defines //------------------------------------------------------------- #include "../../Include/pp_proj.h" static const int ThreadRetOK = 1; static const int ThreadRetFail = -1; long int thread1time, thread2time; void create_thread_attr_rt(pthread_attr_t * attr) { pthread_attr_init(attr); //Create attributes with defaults // pthread_attr_setstacksize(attr, PTHREAD_STACK_MIN*10); pthread_attr_setstacksize(attr, 65536); pthread_attr_setschedpolicy(attr, SCHED_FIFO); } void make_thread_periodic(int TaskNumber) { struct timespec start; struct timespec period; int retval; start.tv_sec = 0; start.tv_nsec = 0; period.tv_sec = 0; period.tv_nsec = 1000000; if(retval = pthread_make_periodic_np (pthread_self(), &start, &period)) { printf("make periodic Thread %d failed. ret: %d, ESRCH: %d, ETIMEDOUT: %d\n",TaskNumber, retval, ESRCH, ETIMEDOUT); } } long int get_time_ns(void) { struct timespec time; clock_gettime(CLOCK_REALTIME, &time); return time.tv_nsec; } void * thread1code(void * args) { long int StartMeasure, Elapsed; int i; make_thread_periodic(1); //printf("Got before command\n"); Command("#1 j/"); //printf("after command\n"); StartMeasure = get_time_ns(); for(i=0; i
  7. Thank you, Now that I know we are just executing that program name it will allow me to debug more effectively. The Send() seems to be a powerful tool as well. I'll also take the time today to process all the return values and use that with the printf/send statements to try and see what is going on. It is nice to have the software wish list. For now the Telnet session is more useful, however. ~Ken [quote='bradp' pid='252' dateline='1258675162'] 1. The warning is just from the C++ compiler option we enable to give maximum feedback. 2. Thanks, you found a hole in the task manager. Your program is crashing and we are not showing that. It is now in the wish list. As to why the program is crashing I do not know. Since we do not have a debugger yet you will need to use printf() to find it. Open a telnet session to the ppmac and go to root@10.34.9.223://var/ftp/usrflash/Project/C Language/Background Programs# Then type ./capp1.out And you get Segmentation fault root@10.34.9.223://var/ftp/usrflash/Project/C Language/Background Programs# So you will need to either use telnet and printf() to get some clues or the IDE unsolicited response window and the SEND command sprintf(szdata,"%d\n", pshm->P[4]); Send(SEND1_PORT,szdata); Just a reminder I am not here on Fridays. [/quote]
  8. Hello, I'm trying to get up and running with my first C app using two very simple threads. I got the code to compile, but I'm not sure how to go about starting execution. I tried using the task manager, but there was no indication that the task was running. I also had to put casts on the "Command" function call because I was getting a warning regarding deprecation from Constant Char * to char *. I'm not sure if this has anything to do with my problem, just thought I'd mention it. Any advice on creating a simple multithreaded program and executing it would be helpful. I am also unsure of what priority to assign the threads. #include #include // Global Rt/Gp Shared memory pointers //------------------------------------------------------------- // The following is a projpp created file from the User defines //------------------------------------------------------------- #include "../../Include/pp_proj.h" void * thread1code(void * args) { while(1) { if(GetGlobalVar(TrigJog) == 1) { Command((char *)"#1j/"); while(GetGlobalVar(TrigJog) == 1) { Command((char *)"#1j+"); sleep(1); Command((char *)"#1j-"); sleep(1); } Command((char *)"#1k"); } sleep(1); } } void * thread2code(void * args) { while(1) { if(GetGlobalVar(TrigJog) == 1) { Command((char *)"#2j/"); while(GetGlobalVar(TrigJog) == 1) { Command((char *)"#2j+"); sleep(1); Command((char *)"#2j-"); sleep(1); } Command((char *)"#2k"); } sleep(1); } } int main(void) { pthread_t thread1, thread2; pthread_attr_t attr1, attr2; struct sched_param sp1, sp2; sp1.sched_priority = 1; sp2.sched_priority= 99; pthread_attr_init(&attr1); pthread_attr_init(&attr2); pthread_attr_setschedpolicy(&attr1, SCHED_FIFO); pthread_attr_setschedpolicy(&attr2, SCHED_FIFO); pthread_attr_setschedparam(&attr1, &sp1); pthread_attr_setschedparam(&attr2, &sp2); pthread_create(&thread1, &attr1, thread1code, 0); pthread_create(&thread2, &attr2, thread2code, 0); pthread_join(thread1, NULL); pthread_join(thread2, NULL); return 0; }
  9. Thanks! I'll have to try this string method. It definitely seems safer. Are there any performance penalties of doing this, or is it insignificant? Keep in mind we might have 8-16 tasks making these calls every millisecond. This function call must be interfacing to a command interpreter I would assume?
  10. Hello, When using the IDE we would like to not use any manually assigned variables, but rather use the global variables in "symbolic" form via the "global definitions.pmh" file (and the automatically generated header file when using C programs). Are there any cases where we would *not* be able to use the symbolic names in the "global definitions.pmh" file? I.e. I would prefer to never have to type P100 ever again, even in a #define statment. (BTW, being able to query symbolic names in the watch windows and terminal is very nice...) Also, when using C there is no type checking on the function calls (since they accept any unsigned int), so it is easy to use the wrong function call (see following): "global definitions.pmh" file: global TrigJog; csglobal SomeVar; "C" PLC contents: while(GetGlobalVar(SomeVar) == 1); //Whoops, just got the wrong val!! SetCSVar(TrigJog, 1); //Just set wrong Q var.... One nice thing about this is that if you pass a global variable to a function it can be passed as an unsigned int and issue the appropriate API calls to get and set the values. I also like how the vars are called the same thing in all script and C programs with only one definition. One possible "Best Practice" solution would be to define your vars like this: ptr pSomeIOBit, pSomeOtherIO Global gTrigJog, gJogIsBusy, gCrimpStationClearPoint CSGlobal csSomeVar, csSomeOtherVar at least then you can glance at your function call and have a chance of noticing a mistake: //Set wrong var, but it is more //visible to programmer with //naming convention. SetPtrVar(csSomeVar); It still would be nice in the future to have some kind of type checking in the C code, even if it is a warning with a custom preprocessor. I know you guys have alot on your plate, just putting this out there for suggestion.
  11. I assume we will be able to develop our own native code that works with an X server as well (using gtk, qt, etc)? Visual studio and C# are great tools though, so I have no great problem using that as well. Has performance of C# GUI been tested under mono on the Power PMAC?
  12. That is great news. For the meantime I should be able to pull my source in "manually" and just update the *.c and *.h files accordingly. This method gets tedious beyond a few projects which is probably a year or two into the future. Thank you.
  13. We have a need to include a common set of code for all projects when we are building our own Capp. Think of it like a library with a common set of API components that is shared among different projects on a networked fileserver. I would like to keep everything within the DT IDE but I don't know the capability to reference header files and source/object files that are outside of the project folder. I don't know if it is recommended to edit the make file in the Capp folder directly since it might be automatically generated, or need to change with different versions of the IDE. Any advice/help on this would be appreciated.
  14. Hello, In some of the examples I have been reading there are references to setting and reading IO bits on the accessory IO cards, but the reads and writes are to entire bytes (IO 0-7, 8-15, etc). Since the C compiler needs to do a Read-Modify-Write to the shared memory there is risk of another thread corrupting the data midway in the write cycle. Does DT have any way of solving this, or should we write our own function calls that include the mutex lock/unlock calls to make it thread safe?
  15. Will there be a graphical GUI "builder" like in [generic] visual studio, or will you build the screen in code, presumably using different layout schemes?
  16. Is there anything existing, or being worked on in regards to a HMI of some sort? The demo PPMAC board I'm using does not have a VGA card on it, is such a thing going to be available soon? As far as software side, for our [meager] needs we will probably want a graphically built environment with event generating buttons(that have callbacks for things like reading/writing to shared memory), and some sort of message queue to send text and other "event driven" data from our realtime application to update display counters and such. What is the thinking now on the HMI philosophy? Is DT going to provide a GUI builder software tool as part of the IDE, or is the customer in the position of using a gui builder and compiling/downloading it themselves? For me personally I like a simple HMI without alot of graphics and animated widgets with a "cool" factor. I know others may have different opinions, just giving my $0.02 worth.
  17. The script PLC behaves the same as the CPLC in terms of jogging the motors, but you can start and stop the script PLC from the task manager or terminal even when it is in the while loop indefinitely. Here is the code. I wrote a subroutine to do the delay. open plc 1 jog/ 1; jog/ 2; while(p0==0) { jog 1 = 10000; jog 2 = 10000; call PLCDelay(3); //Delays using Sys.Time (seconds) jog 1 = 0; jog 2 = 0; call PLCDelay(3); //Delays using Sys.Time (seconds) } close
  18. I thought it was probably something like that. I think the confusing part is that the equivalent code in a script PLC does not have this behavior. The reason, I'm guessing, is that the stopping of the PLC can be handled in between interpreted commands. I think that the power of Capps is where we want to go. It sounds like the CPLCs (including the servo interrupt PLC) are mostly intended for things that can be "scanned", similar to ladder logic, or in this case it is most similar to structured text execution on a traditional PLC controller. This can be useful for combinatorial logic, latching, etc. Thanks, Ken
  19. Hello, I wrote a CPLC that simply jogged a motor back and forth with the command interface. (See code below). When using the IDE I cannot seem to stop the CPLC until the while loop has exited (i.e when I set P10==0). If I use the task manager to stop the CPLC while it is looping it reports it as being stopped, but in fact the motor keeps turning. How do I kill this CPLC short of killing power, and what is the use of the task manager if it doesn't report correct status? (Firmware 1.1.0.40 IDE 1.1.0.50) ******* Code start here *************** #include #include #include void user_plcc() { if(pshm->P[10] == 1) { Command("#2 j/"); while(pshm->P[10] == 1) { Command("#2j+"); sleep(1); Command("#2j-"); sleep(1); } } Command("#2k"); }
×
×
  • Create New...