Jump to content
OMRON Forums

SilentLee

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by SilentLee

  1. The data sent must have each line separated by null byte, ASCII 00 (0x00) - not a "carrage return+linefeed" sequence.

    For your example you should be sending:

    OPEN PROG 1 CLEAR<00>Q1=Q1+1<00>CLOSE<00>

     

    I will have the software group add the description of "VR_PMAC_SENDCTRLCHAR". What other errors did you find?

     

    The data I send was “OPEN PROG 1 CLEAR<00>Q1=Q1+1<00>CLOSE<00>”where <00> indicated ASCII 0. If using "carrage return+linefeed" sequence, downloading error would happen. Is there something I left out during downloading such as compiling or other procedure?

    The errors I found were literal, among them were some questions.

    Page 3

    (1)Second line---->What did ^X mean?

    (2)17th line---- There is no definition of FLUSH_TIMEOUT

     

    Page 4

    (1)Controdiction:29th line EthCmd.RequestType = VR_UPLOAD; 36th EthCmd.RequestType = VR_DOWNLOAD;

    (2)Next-to-last line: Function “send” and “recv” did not use “outstr”! What was the role of “outstr” played in the example?

     

    Page 5

    (1)10th line: EthCmd.RequestType=VR_UPLOAD; EthCmd.Request = VR_PMAC_GETBUFFER;

    18th line: EthCmd.RequestType = VR_DOWNLOAD; EthCmd.Request = VR_PMAC_GETLINE;

    (2)22th line:What was the role of “outstr”?

     

    Page 6

    (1)In VR_PMAC_PORT, what was the meaning of “offset” and “outch”?

  2. What are you trying to download and how is it not working for you?

     

    The "Ethernet Protocol" tells VR_PMAC_WRITEBUFFER is usually used for

    downloading a file.

    We download motion programs to clipper using VR_PMAC_WRITEBUFFER by ethernet communication as follows:

    “OPEN PROG 1 CLEAR

    Q1=Q1+1

    CLOSE”

    The responed string is:03 00 00 00. It indicates there's no error during downloading. However, we can't find the downloaded program. Why?

    Should we complie the motion program before downloading? How to compile?

    Otherwise, there is no definition of VR_PMAC_SENDCTRLCHAR and seveval little errors in "Ethernet Protocol".

  3. I has received the data with the help of wireshark. Thanks

    I have modificated programs as you advised, but it did not work. Here are the programs, could you help me to find problems?

    The header file can't be attached, I have changed it to txt file. Just rename the file.Thanks!

     

    I think you are moving the pointer around instead of just putting data into it.

    Should

    recv(sock,(char*)&instr,1400,0);

    be

    recv(sock,(char*)instr,1400,0);

    ?

     

    Go to this forum link.

     

    http://forums.deltatau.com/showthread.php?tid=57

     

    In the zip file in the pmaceth/src folder is a functioning getresponse.

     

    Don't worry that the title is Linux Driver and Comm for Turbo PMAC.zip because ethernet socket communication is very portable.

  4. I have modificated programs as you advised, but it did not work. Here are the programs, could you help me to find problems?

    The header file can't be attached, I have changed it to txt file. Just rename the file.Thanks!

     

    I think you are moving the pointer around instead of just putting data into it.

    Should

    recv(sock,(char*)&instr,1400,0);

    be

    recv(sock,(char*)instr,1400,0);

    ?

    main.c

    pmacethernet1.c

    pmacethernet1.txt

  5. Hi,

    We want to use RTX as host system. According to Ethernet Protocal, we write programs to communicate with clipper through sockets. If we send no-line commands, clipper would do Corresponding action such as "#2j+". But if we send single-line commands, the charcters responsed is null such as "I122". WHY? The programs are as follows:

     

    main:

    void main()

    {

    char Cmd_Clear = 18;

    char Cmd1[10] = "I122=55";

    char Cmd2[10] = "I122";

    char *I122str = NULL;

     

     

    Cmd[7] = 13; //Add at the end of sending command,

    Cmd[4] = 13; //whether add or not ,the result is the same

     

    InitPmacEthernet(); //Build connection

     

    PmacSockPortSend(Cmd_Clear);

    PmacSockSendLine("#2j+"); //Motor2 forward

     

    PmacSockGetResponse(Cmd2,I122str);

    printf("The original value of I122 is %s\n",I122str);

     

    PmacSockGetResponse(Cmd2,I122str);

    printf("Now, The value of I122 is %s\n",I122str);

     

    Sleep(10000);

    ClosePmacEthernet();

    }

     

    SUBfunction:

    int InitPmacEthernet()

    {

    int Ret;

     

    if ((Ret = WSAStartup(MAKEWORD(2,2), &wsaData)) != 0)

    {

    printf("WSAStartup failed with error %d\n", Ret);

    return WSA_START_ERROR;

    }

     

    // Create a new socket to make a client connection.

    if ((sock = socket(AF_INET, SOCK_STREAM, 0))

    == INVALID_SOCKET)

    {

    printf("socket failed with error %d\n", WSAGetLastError());

    WSACleanup();

    return SOCKET_CREATE_ERROR;

    }

     

    PmacAddr.sin_family = AF_INET;

    PmacAddr.sin_port = htons(PMACPORT);

    PmacAddr.sin_addr.s_addr = inet_addr(PMACIP);

     

    // Make a connection to the server with socket s.

     

    printf("We are trying to connect to %s:%d...\n",

    inet_ntoa(PmacAddr.sin_addr), htons(PmacAddr.sin_port));

     

    if (connect(sock, (SOCKADDR *) &PmacAddr, sizeof(PmacAddr))

    == SOCKET_ERROR)

    {

    printf("connect failed with error %d\n", WSAGetLastError());

    closesocket(sock);

    WSACleanup();

    Sleep(3000);

    return CONNECT_ERROR;

    }

     

    printf("Our connection succeeded.\n");

    Sleep(2000);

    return 0;

    }

    int CALLBACK PmacSockGetResponse(char *outstr, char *instr)

    {

    EthCmd.RequestType = VR_DOWNLOAD;

    EthCmd.Request = VR_PMAC_GETRESPONSE;

    EthCmd.wValue = 0;

    EthCmd.wIndex = 0;

    EthCmd.wLength = htons( (WORD)strlen(outstr));

    strncpy((char *)&EthCmd.bData[0],outstr,(WORD)strlen(outstr));

     

    send(sock,(char*)&EthCmd,ETHERNETCMDSIZE + strlen(outstr),0);

    recv(sock,(char*)&instr,1400,0);

    return 0;

    }

    int CALLBACK PmacSockSendLine(char *outstr)

    {

    EthCmd.RequestType = VR_DOWNLOAD;

    EthCmd.Request = VR_PMAC_SENDLINE;

    EthCmd.wValue = 0;

    EthCmd.wIndex = 0;

    EthCmd.wLength = htons( (WORD)strlen(outstr));

    strncpy((char *)&EthCmd.bData[0],outstr,(WORD)strlen(outstr));

     

    send(sock, (char *)&EthCmd, ETHERNETCMDSIZE + strlen(outstr),0);

    recv(sock,(char *)&EthCmd,1,0);

     

    return 0;

    }

     

    The result is:

    1.jpg.4544999713c968e7b504cded471637ba.jpg

  6. The “VR_PMAC_WRITEBUFFER” can only send valid PMAC syntax ASCII text. You would need to provide your own parser to provide PLC compilation and pre-processor directives (#define, #include ...) as is done on our Pcomm32.

     

    Where can I find the rules to compile and pre-process the programs? How Pcomm32 compile and pre-process these programs? It does not open to users?Thanks

  7. We want to use RTX as our host system, Turbo PMAC USER MANUAL tells use VR_PMAC_WRITEBUFFER to download file, if I download them directly, it doesn't work; In PCOMM32, the download file function is PmacDownLoadA(),it first compiles motion or PLC programs and then download to clipper. How could I compile the programs before download them in RTX system. THANKS!
×
×
  • Create New...