Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
Technical support / Re: FMD1616 - Open Socket TCP as server(slave)
« Last post by Netanel on March 19, 2020, 02:54:21 AM »
 Thanks,
while i connect, disconnect, and reconnect, the port changes, can I define const(hard) port?

another question:

"The FMD1616 PLC server socket is always open" which type of server this?

i succeed to connect to FMD1616 PLC server
but i try to send the string "abc/n", i got error, what i did wrong?

how i read the data from the controller?

my c# code:

tcpclnt.Connect("192.168.1.5", 9080);
// use the ipaddress as in the server program
Console.WriteLine("Connected");
Console.Write("Enter the string to be transmitted : ");
String str = Console.ReadLine();
Stream stm = tcpclnt.GetStream();
ASCIIEncoding asen = new ASCIIEncoding();
byte[] ba = asen.GetBytes(str);
Console.WriteLine("Transmitting.....");
stm.Write(ba, 0, ba.Length);
22
Technical support / Re: FMD1616 - Open Socket TCP as server(slave)
« Last post by support on March 17, 2020, 12:21:15 AM »
Yes if the Linux server is listening on a TCP socket the FMD1616 PLC is able to using PRINT #4 "<TCPCONNECT ...>" command to connect to the server port and interact with the server.
23
Technical support / Re: FMD1616 - Open Socket TCP as server(slave)
« Last post by Netanel on March 16, 2020, 11:11:07 PM »
"iTRiLOGI is a client that can connect to the PLC's server socket", FMD1616 can connect to Linux server socket?
24
Technical support / Re: People Counter
« Last post by garysdickinson on March 16, 2020, 10:40:15 PM »
Lorne,

In trying to explain how the counting mechanism worked, I realized that my algorithm was not as robust as it could be.

So I modified the code and attached it to this post as V3.

Please look at the state machine diagram in an earlier post: http://triplc.com/smf/index.php?action=dlattach;topic=2429.0;attach=235  as reference.


The idea of the new code is to ensure that the state machine went through all 4 states before updating the count of "people".  I used the #define mechanism to carve out two 32 bit variables:
  • TicCnt - count of the number of states from state 0. This value increments when going clockwise else it decrements
  • TotalCnt - running count of "people"

This is the the "new V3" version of the NextSate CF:
Code: [Select]
' NextState - This CF is called on each new state that is to the "right" of
' The previous state. Think of this as going clockwise through the states.
'
' 0-->1-->2-->3-->0-->1-->2-->3-->0 ...
'
'
' On entry: StateCntr has been updated and represents the current state
'
' On exit:
'
' RELAY[2] is updated the patterns for the next legal states
'
' TicCnt will be updated
' TotalCnt may be incremented
'
RELAY[2] = DM[StateTableBase + CtrPV[StateCntr]]
TicCnt = TicCnt + 1 ' we have advanced clockwise one state

' If the current state is 0. Check to see it we should increment
' the TotalCnt value.
'
If CtrPV[StateCntr] = 0

if TicCnt = 4
TotalCnt = TotalCnt + 1 ' We have gone one full turn
endif

' The TicCnt is reset on transitions to state #0
'
' This makes it easy to "know" when to increment the TotalCnt value.
'
' The other issue is that the PLC scan rate must be significantly faster than
' the objects being counted. As there are 4 states the scan ran has to be
' about 8x faster in order to keep up.
'
TicCnt = 0

endif

The PreviousState CF is substantially similar and deals with the counter-clockwise case.

This is a 1x decoder that only counts once each time the state machine goes full circle.  There are 2x and 4x encoders that count 2x or 4x for complete loops through the state machine.

Best regards,

Gary Dickinson
25
Technical support / Re: FMD1616 - Open Socket TCP as server(slave)
« Last post by support on March 16, 2020, 03:39:06 PM »
The FMD1616 PLC server socket is always open. So you just need the client to connect to it. iTRiLOGI is a client that can connect to the PLC's server socket.

The TBASIC language does not have built-in support for user initiated UDP client connection to external UDP server. Only TCP client connection is supported.
26
Technical support / Re: People Counter
« Last post by Lorne Van Dusen on March 16, 2020, 02:00:22 PM »
 :) Gary I finally had some spare time to play with your program.
I am impressed with the way you did it in a state machine and how works.
However I am at a loss on how to determine an actual count value.
27
Technical support / Re: Bit Shift
« Last post by Lorne Van Dusen on March 16, 2020, 01:37:05 PM »
Your explanation was perfect and the solution was simple
In my custom function i just used X = ? and I change the ? to the number of shifts I needed
example
X = 4 'To shift 4 bits to the left
FOR I = 1 to X
LSHIFT RELAY[1] 'I only needed 1 channel
NEXT
28
Technical support / FMD1616 - Open Socket TCP as server(slave)
« Last post by Netanel on March 16, 2020, 01:28:41 PM »
Hi

How can i open TCP Socket as server(slave)?

How can i open UDP Socket as Client?

Thanks

29
Technical support / Re: Bit Shift
« Last post by support on March 10, 2020, 02:00:10 PM »
Attached is a sample program for using the LSHIFT function for multiple bits.

A parameter X that contains the number of bits is passed to the function fnLShiftXBit which then uses a FOR NEXT loop to shift X bits to the left.

Note:
We cascaded two relay channels so that the single bit will shift across both RELAY[1] and RELAY[2] - total 32-bits. You can change the number of channels to 1 if you just want the shift to happen within RELAY[1] and not moving into the higher RELAY[n] channels.

30
Technical support / Re: Bit Shift
« Last post by Forum Admin on March 09, 2020, 07:48:59 PM »
LSHIFT or RSHIFT only shift left or right by 1 bit. It doesn't support multiple bit shifting in a single command.

You can use a FOR NEXT loop and execute the number of time you want to shift the bit.

Another way is to multiply the channel with a number. E.g. x2 is to shift 1 bit to the left , x4 is to shift 2 bits to the left... x 256 is to shift by 8 bit to the left. You will probably need to mask out the overflow bit with an AND mask to prevent number from turning into negative.
Pages: 1 2 [3] 4 5 ... 10