Jump to content
OMRON Forums

daves

Members
  • Posts

    261
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by daves

  1. That doesn't work. And the correct way doesn't work on the latest 1.7.0.53/1.6.1.1 either.

     

    I found this works but it is not great:

     

    #include "../../PMACSC~1/GLOBAL~1/COMMON~2.PMH"
    

     

    Maybe this can help you figure out what is wrong in the build command.

  2. I have a simple case which illustrates the issue. This is how I handle reading and writing (read-modify-write) bits in c-code to be as fast as possible:

     

    bgcplc.c

    #define Get_Bit1 ((((unsigned char *) pushm)[27] >> 1) & 1)
    #define Set_Bit1 ((unsigned char *) pushm)[27] |= 1 << 1
    #define Rst_Bit1 ((unsigned char *) pushm)[27] &= ~(1 << 1)
    
    void user_plcc()
    {
    // Random delays to stir things up
    struct timespec mSecSleeper = { 0 };
    mSecSleeper.tv_nsec = randx(100);
    
    // Set, wait, check, log error, reset, wait, check, log error
    Set_Bit1;
    nanosleep(&mSecSleeper, NULL);
    if (Get_Bit1 != 1) pshm->P[3]++;
    Rst_Bit1;
    nanosleep(&mSecSleeper, NULL);
    if (Get_Bit1 != 0) pshm->P[3]++;
    
    // Log running
    pshm->P[1]++;
    }
    

     

    rticplc.c

    void realtimeinterrupt_plcc()
    {
    // Random delays to stir things up
    struct timespec mSecSleeper = { 0 };
    mSecSleeper.tv_nsec = randx(100);
    
    // Set, wait, check, log error, reset, wait, check, log error
    Set_Bit2;
    nanosleep(&mSecSleeper, NULL);
    if (Get_Bit2 != 1) pshm->P[2]++;
    Rst_Bit2;
    nanosleep(&mSecSleeper, NULL);
    if (Get_Bit2 != 0) pshm->P[2]++;
    
    // Log running
    pshm->P[0]++;
    }
    

     

    I see P2 going up (i.e. RTI loses as explained above). I understand mutexes. Where would I create one?

  3. What can change a PLC's coordinate system?

     

    I have a 'command processor' PLC running and reacting to commands (from PMAC or a connected PC).

     

    There are many commands handled but I just experienced a problem where the DISABLE command did not kill the motors (dangerous) because PLC10 was using CS0 even though it had been set to CS1 earlier:

     

    open plc 10
    switch (pmCmnd)
    {
    	case 0:
    		break;
    
    	case DISABLECMND:
    		ddisable;
    		break;
    	case COORD1CMND:
    		Plc[10].Ldata.Coord = 1;
    		break;
    }
    pmCmnd = 0;
    
    close
    

     

     

    The COORD1CMND is issued at the start of the session and non of my code explicitly alters the CS after that. When I discovered the motors were still closed loop issuing COORD1CMND again and then DISABLECMND worked as expected.

     

    I can get around this by always setting the CS before each command (we only have one anyway) or should I do &*ddisable? in script?

     

    Cheers

    Dave

  4. Thanks for the full and detailed reply Richard. I hadn't quite grasped it is just an IDE one-shot setup and not part of the 'runtime'.

     

    I don't think it is that useful to me then as I have one project for multiple rig configurations. The serial number is read from the file system on power up and the MACRO configured accordingly (different for each rig). I will have to keep CMD"".

     

    It will be useful if we go back to having a MACROPLCC.

  5. I have one CPU card which mounts a USB stick no problem. The one in my DT "4-axis demo" rack just will not mount the same stick.

     

    How can I fix this?

     

    Helpful info:

     

    Working system has

     

    root@195.0.0.4:/media# ls

    audisk cdrom disk disk-1 disk-3 disk-5 disk-7

    audisk-1 cdrom0 disk-0 disk-2 disk-4 disk-6 shared

     

    Non-working media folder is empty

     

    I looked at the RS232 output and both gave detection logging on plug/unplug the only difference was working system said "sdb: sdb1", non-working said "sde: sde1"

  6. I read with great interest post

     

    http://forums.deltatau.com/showthread.php?tid=1680&pid=6907#pid6907

     

    as we were almost doing this but found it too difficult using UMACs to download MACROPLCCs. I have been waiting for MACRO integration...

     

    1) It says you need firmware 1.6.1.6. Is this available? I have IDE1.7.0.53 FW1.6.1.1

     

    2) Is the Add Macro Project feature documented, I can't see it in the IDE manual, but it is in my IDE

     

    3) Should I be moving all my existing CMD code? like the following or are there limitations?

     

    cmd "MS0,I108=%d", $000018;
    

     

    4) I can only do this if it supports logic and expressions. Does it?:

     

    local lAFL;
    lUAF = $FF;
    if (GlobalVar = 1)
    {
    	cmd "MacroSlave0, I17 = %d", lUAF;
    }
    

     

    5) I find I have to do some setup variables (like node enable, transfers), followed by MSSAVE and then MS$$$ to take effect, and some vars don't

    survive a $$$ so need to be set up after (MI198=$408807; MI199=$7"; to set up control words). Does this fit into this mechanism?

     

    6) What is the Timer() call it looks useful? I get:

     

    Error : ( Preprocessing Error) SubProgram not found : on string ("call Timer(0.001) ")

     

    Hovering in IDE says "New firmware command".

     

    Thanks

  7. There is something funny about how User Buffer (and I assume other project properties) is stored.

     

    The message which appears when you change it is testament to this (please also note the spelling error):

     

    To update the buffer settings that you recently changed, you should do the following:

     

    1. Downlaod the project by using the Download All Programs option

    2. Go to the Terminal Window

    3. Type Save in the terminal window to save all modified parameters

    4. Type Reboot in the terminal window to reboot the power PMAC.

    Please be adivised that by rebooting the power PMAC, you are

    shutting down power PMAC and restarting it.

     

    I just wasted a day investigating a hard watchdog after upgrading to 1.6.1.1 firmware and 1.7.0.53 IDE.

     

    My project sets a User Buffer of 10 and this was up and running fine. I did the upgrades (not very speedy due to complete uninstall and reinstall required - a patch upgrade solution would be more pleasant). Then we got a hard watchdog during a test. Of course I doubted the upgrade and retried. Then tried downgrading which still failed. So I doubted code changes and checked, hardware changes and checked, thermal shutdown as it was a hot day, etc

     

    I finally deduced the watchdog was due to accessing USM outside the default 1MB size which my project had reverted to without telling me (still showing 10 in the project properties). This despite many combinations of $$$, $$$***, etc. Only changing it to 5, say, and back to 10 fixed it.

     

    1) Why is the size not simply downloaded each time?

     

    2) Why is it not checked to match project settings by the download process?

     

    3) How does the firmware upgrade lose the setting?

     

    4) Why does the firmware upgrade not warn me I have lost critical settings?

  8. My project is coming from pre FW1.6.1.1 IDE1.7.x.x. The IDE manual says to add pp_custom_save.cfg to my configuration folder I select Download Config Files.

     

    This generates the tpl file but not the cfg file. A new project has the cfg file. Do I have a properly structured project?

     

    I also have pp_save.cfg in the tree (has always been there) but not it's tpl file, this has always been the case and meant using the tpl was a disjointed affair outside the IDE (and the cfg in the PC project is not the PPMAC one until you upload, correct?). This file is not described in the PDF.

     

    I am a little confused about the purpose of and difference between the custom file and the original file. Could you clarify? (I understand their function, just not how they are intended to be used)

     

    Thanks

    Dave

  9. I get the following FATAL error upgrading from 1.6.0.30 should I worry?

     

    Stopping ethercat subsystem - preinst

    Shutting down EtherCAT master 1.5-pre

    FATAL: Module r8169 not found.

    Warning: Failed to restore r8169.

    done

    Making disk writable - preinst

    latest xenomai

  10. There is a lot in my Rticplc. When I save my project now I get:

     

    save
    Changing echoMode to zero during Save operation
    0
    Command: echo Response 2 chars in 2.4653 msec
    Command: echo0 Response 0 chars in 2.2398 msec
    Command: save Response 0 chars in 10000.5104 msec
    Command: save Timed out with response
    
    Restoring echoMode to original 0 value
    Save to pp_diff.cfg Complete
    
    Save CompleteCommand: echo0 Response 43 chars in 1758.2805 msec

     

    If I disable RtiCplc vefore saving it is OK:

     

    UserAlgo.RtiCplc=0
    Command: UserAlgo.RtiCplc=0 Response 0 chars in 2.772 msec
    save
    Changing echoMode to zero during Save operation
    0
    Command: echo Response 2 chars in 1.4894 msec
    Command: echo0 Response 0 chars in 1.4203 msec
    Save to pp_diff.cfg Complete
    
    Save CompleteCommand: save Response 43 chars in 9988.5877 msec
    Save to pp_diff.cfg Complete
    
    Save Complete
    Restoring echoMode to original 0 value
    Command: echo0 Response 0 chars in 1.3514 msec
    

     

    1) Should I worry about this?

    2) Is the save actually happening in the first instance?

    3) Are there some configuration files I can have pre-save and post-save commands (similar to download ones)? Can you add this?

  11. What causes the following error condition to occur?

     

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

     

    @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @

     

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

     

    IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!

     

    Someone could be eavesdropping on you right now (man-in-the-middle attack)!

     

    It is also possible that the RSA host key has just been changed.

     

    The fingerprint for the RSA key sent by the remote host is

    2e:6d:62:60:83:48:9d:89:a8:f5:d7:9c:9a:35:04:c8.

     

    Please contact your system administrator.

     

    Add correct host key in /cygdrive/c/Users/daves.ABD/.ssh/known_hosts to get rid of this message.

     

    Offending key in /cygdrive/c/Users/daves.ABD/.ssh/known_hosts:3

     

    Password authentication is disabled to avoid man-in-the-middle attacks.

     

    Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.

     

    Permission denied (publickey,password).

     

    rsync: connection unexpectedly closed (0 bytes received so far) [sender]

    rsync error: error in rsync protocol data stream (code 12) at /home/lapo/packaging/rsync-3.0.4-1/src/rsync-3.0.4/io.c(632) [sender=3.0.4]

     

    It happened on a DT 4-axis demo rack we have in the office.

     

    I fixed the condition by removing the offending line in the known_hosts file. I don't think a lot of our company who will be performing upgrades by hand (due to other issues) would be comfortable dealing with this if it arose.

  12. If I have a variable called Bam5 and accidentally type bam5=5 in the terminal it sets m5 to 5! This could be nasty if m5 started a crushing move, say.

     

    I know there should be other safety limits. I know it is hard for the terminal to know if you are concatenating valid commands but I think some thought is required here, maybe ; delimiters?

     

    I see from another post a new IDE is coming, maybe this is addressed. I also hope it is Visual Studio Shell 2013. Is it? We were promised the 2010 shell 3 years ago...

  13. Thanks Fahmad I hope this addresses point 3. The critical problem in my post is on systems not running any getsends. The problem is the sending end choking, not the receiver.

     

    It is very easy to demonstrate, please try this:

     

    global DoSend = 0;
    
    open plc 1
    local iLoop;
    p1,1000 = 0;	
    p0 = Sys.Time;
    iLoop = 0;
    while (iLoop < 100)
    {
    	if (DoSend)
    	{
    		send 1, "one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen";
    	}
    	callsub sub.DoCmd10(1 + iLoop * 10);
    	iLoop++;
    }
    p0 = Sys.Time - p0;
    disable plc 1;
    return;
    
    sub: DoCmd10(Num)
    local iLoop;
    Ldata.CmdStatus = 1;
    iLoop = Num;
    while (iLoop < Num + 10)
    {
    	cmd "p%d=%d", iLoop, iLoop;
    	iLoop++;
    }
    return;
    
    close
    

     

    put P0,P100,P200,..,P900,P1000 in a watch

    Download

     

    Hide the Unsolicited tab

    enable plc 1

    You see the P100 etc fill. It takes 1.14s (P0) on my system.

     

    DoSend=1

    enable plc 1

    You see the P100 etc fill in an unstable manner. It takes 101.05s.

     

    Show the unsolicited view

    enable plc 1

    You see the P100 etc fill. It takes 1.15s.

  14. I got caught out (by not checking the user guide ;) setting CaptCtrl on a Gate3 card.

     

    I have a product which is Gate1 on some configurations and, now, Gate3 on others. I had code setting CaptCtrl=3 index high, flag high and foolishly left this in for the new configuration.

     

    Of course, this is now index low, flag low.

     

    Why?!

     

    Please can I have a cheat sheet of Gate1/Gate3 parameters with the same name which have altered values? Are there any dangerous ones I should look out for?

  15. I got caught out setting CaptCtrl by forgetting to set the WpKey on a Gate3 card (My fault, I'm new to Gate3 and the manual does in fairness mention it).

     

    What I don't like is the way the code still executes silently but not applying the values leaving in a potentially dangerous condition.

     

    In my case a very large piece of machinery carried out its home manoeuvres in the wrong location as it thought some motors had finished their home move due to the incorrect trigger. Luckily this was fine but it is not hard to imagine a situation where something would be very bad.

     

    Do you think it would be safe to bail out of a program attempting to set a protected parameter (possibly killing motors) setting a soft WD of "WpError" say?

     

    I don't actually see the benefit outside the terminal; if you write code accessing the parameters you know what you are doing, and if you know about the key you put that line in enabling any mistakes you've made in the parameter anyway. Nothing is protected

  16. I was trying to use nice pointers directly:

     

    ptr R1CaptCtrl->u.io:$908068.6.4; // Gate3[2].Chan[0].CaptCtrl
    

     

    Is the following as expected? It doesn't explain this situation in the documentation that I can see, it only says you need to use the Gate structure in C code:

     

    This doesn't work:

    open plc 1
    Sys.WpKey = $AAAAAAAA;
    R1CaptCtrl = 2;
    Sys.WpKey = $0;
    disable plc 1;
    close
    

     

    This DOES work:

    Gate3[2].WpKey = $AAAAAAAA;
    R1CaptCtrl = 3;
    

  17. I think I have evidence to the contrary on this. I would like a definitive answer on the suitability of using the send commands for debug.

     

    1) If I start the IDE and unsolicited view, it fills with old messages that were emitted some time before. This implies they are not ignored but buffered somewhere and where there is a buffer there is the possibility of problems. Is it the same buffer as ASCII commands?

     

    2) I have a start up PLC with LOTS of the code of similar to this:

     

    sub: CentreAxes_MainAcc24E2A(void)
    send 1 "DefineHardware.CentreAxes_MainAcc24E2A: Started";
    
    send 1 "DefineHardware.CentreAxes_MainAcc24E2A: Define pointers";
    
    // Centre come from axis cards
    Ldata.CmdStatus = 1;
    cmd "R1AmpFault->u.io:$618020.23.1";
    ... MORE...
    callsub sub.SendCmds(1);
    return;
    
    sub: SendCmds(Error)
    // Force commands from buffer
    sendallcmds; 
    // Wait for command to execute     
    while (Ldata.CmdStatus > 0) {} 
    // Error in execution?
    if (Ldata.CmdStatus < 0)
    {
    	errorDefineHW = Error;
    	// Handle the error
    	send 3 "------ DefineHardwarePointers:  error %d", Ldata.CmdStatus;
    }
    return;
    

     

    If I don't have the IDE unsolicited running my HMI times out (on 10s), if it is running it takes a second or so (I have not done accurate measurements). If I comment out all the sends, it runs in about a second. This indicates an impact on performance (a choke).

     

    3) When using the IDE unsolicited I often see corruption of the messages. In particular the first half of one message, then a second message concatenated, then the next line. Or the messages from one PLC up to a point then no more even though the plc has finished.

     

    4) Without the IDE unsolicited running I have observed ASCII commands issued from a background C program (GetResponse command) occasionally go missing. This is potentially dangerous. I haven't done a full study but I haven't seen it with the IDE running.

     

    This is a potentially really useful feature and I was making heavy use of it. Now, however, I have had to comment out all send commands to get a reliable system. Please can you address all these points.

     

    Thanks

    Dave

  18. I need to change a motor's pEnc in the rticplc.

     

    This caused a HW watchdog so I guess is incorrect (C address rather than pmac address) (the numbers are actually variables but I have simplified here):

     

    //pshm->Motor[7].pEnc = &pshm->EncTable[7];
    //pshm->Motor[7].pEnc2 = &pshm->EncTable[7];
    

     

    This didn't watchdog but I haven't checked is actually functioning:

     

    char buffer[512];
    sprintf(buffer, "Motor[%d].pEnc = EncTable[%d].a", 7, 7);
    Command(buffer);
    sprintf(buffer, "Motor[%d].pEnc2 = EncTable[%d].a", 7, 7);
    Command(buffer);
    

     

    I want to know

     

    1) Is this the correct method?

    2) Is it robust?

    3) Does it use ASCII comms (i.e. will the action be delayed)?

    4) Is there an alternative?

     

    Thanks

  19. The PPMAC SRM, ACC-24E3 HRM and IDE Help all give Gate3 examples for pCaptPos as

     

    Motor[2].pCaptFlag = Gate3[0].Chan[1].FlagCapt.a

     

    This doesn't seem to exist. Is it HomeCapt?

  20. I can't get this to work. I don't yet know if it is the cable I have had made up. But here are some points I observed from this post:

     

    1. Set Gate3.SerialEncCtrl=$F4000000 (Default value)

     

    After I full reset my gate3's have default values of $F400000 not $F4000000.

     

    I assume you need to set Sys.WpKey = $AAAAAAAA; in script to change this to whichever is correct? (Neither work for me). It would be useful to state this (for newbies to gate3 like me)

     

    2. Set Gate3.SerialEncEna=0 (Default value)

     

    This does not exist so I used Gate3.Chan[j].SerialEncEna=0. I assume this is correct?

     

    3. Read the quadrature counter from Gate3.Chan[j].SerialEncDataA.

     

    Mine sits on 255.

     

    Are there any other setup parameters I could be missing?

     

    My first suspicion lies with the cable as bit 31 of Gate3.Chan[j].SerialEncDataB is set, but I wanted to make sure the setup was right before I make an enemy of the electrician who soldered it up!

×
×
  • Create New...