Serial communication

birrebirre Member Posts: 22
Hi

We are having an issue with a moving board that has an TCP/IP interface (SitePlayer).
There also is a program available where we can connect to the ip address, tcp port no, set the sign adress, ack & time out and we can enter the wanted text to display.

I would like to communicate in CAL with the moving board. Since there is no physical RS232 from the board (only from the interface to the board), the Microsoft Communication V6 can't be used I suppose. Any other possibilities to transfer data to the board?

Comments

  • kinekine Member Posts: 12,562
    You can try to use the Socket communication library to communicate over TCP/IP.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • alby69alby69 Member Posts: 2
    I'm working with pyserial, a python library that communicates
    with serial port.

    We use an old Nav 3.70, but I'm integrating the python program with SHELL command
    I read pyserial use TCP, but I'm using RS232 port.

    In few words:

    1) python program communicate to serial for pilot a weighing bridge Extrim K54.
    2) The K54 answers in a file txt.
    3) NAV reads the data from the file txt and elaborate them...
    4) I print some data to Epson termal printer too..

    It'works ;-))
  • birrebirre Member Posts: 22
    edited 2012-03-14
    kine wrote:
    You can try to use the Socket communication library to communicate over TCP/IP.

    It seems this will be the solution. I do have an error trying to communicate though:
    sendToDevice(text : Text[100])
    IF ISCLEAR(CC2) THEN
      CREATE(CC2);
    IF ISCLEAR(SBA) THEN
      CREATE(SBA);
    
    //SBA.OpenSocket(8000, '');     --> don't think this is necessary? When I try to open the socket to port 8000 I receive an error
    
    CC2.AddBusAdapter(SBA, 0);
    OutMsg:= CC2.CreateoutMessage('Sockets://130.0.112.44:8000'); //The ip:port that needs to receive the text
    
    outS:= OutMsg.GetStream();
    OutS.WRITE(text);
    OutMsg.Send(0);
    

    When I try to comple I receive 'Unknown variable WRITE. Define the variable under the global variables.
    These are my globals:
    Name	DataType	Subtype	Length
    CC2	Automation	'Navision Communication Component version 2'.CommunicationComponent	
    SBA	Automation	'Navision Socket Bus Adapter'.SocketBusAdapter	
    OutMsg	Automation	'Navision Communication Component version 2'.OutMessage	
    outS	OutStream		
    textString	Text		100
    inS	InStream		
    inMsg	Automation	'Navision Communication Component version 2'.InMessage	
    txt	Text		500
    
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    I have once used the freeware SocketWrench library, http://www.catalyst.com/support/faq/socketwrench.html, to do some TCP/IP communication from C/AL, as the NAV communication component was inadequate.

    You get the error because you are using WRITE with an InStream, which is unsupported.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
Sign In or Register to comment.