Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - garysdickinson

Pages: 1 ... 24 25 [26] 27 28 ... 34
376
Technical support / iTrilogi Ver 6.45 build 3, Edit issues
« on: December 26, 2012, 06:45:59 PM »
Hello all, just my usual rant about messy code, again.

I've noticed in the V6.45 version build 3, that if the "I/O Shift down" option is used in the "I/O Table" menu with Custom functions that the shift  does not appear in the "Open CusFn" menu item.

If the file is saved and then I-TrilogI is closed and reopened, then the various I/O Tables and list of custom functions are correctly reconstructed.

I have another pet peeve that I'd like to share.  This is been in many versions of i-Trilogi.  It is not unique to V6.45.  I just on a mini rant.

When I press the "Insert" key on my keyboard the "Open CusFn" menu opens.  However the behavior of the custom function editor changes from "insert mode" to "overwrite mode".  In order to get the editor back to "insert mode", I have to close the "Open CusFn" menu, then press "Insert" a 2nd time and close the "Open CusFn" menu a second time.

It seems that your choice of using the "Insert Key" as a way to open another menu has an annoying side effect on the state of the text editing code.

Is there some way I can use some other key than "Insert" to open this menu?  Say F8?  Is there something in the EN_xxxx.ini
file that I can tweak with?  And why if I am in the custom function editor is useful to have the "Open CusFn" menu appear?

OK here's a new  feature of V6.45.  If you are editing a custom function and you want to know the name of a RELAY, you can open the I/O table. If you highlight the "label name" and press <ctrl>-C instead of making a copy of the highlighted text for latter insert into the body of the custom function, the <ctrl>-C opens the "Copy Ladder Circuits" Dialog.  This is very confusing and seems to be mixing ladder logic editing with custom function editing...

Sorry, but I really am perturbed.  How come the "View Custom Function" window does not use the same tab spacing as the normal custom function edit window?  Is there something in the .ini file to set the tab spacing for this window?

best regards,

Gary D

377
Technical support / Re:RSHIFT on Nano-10 +r73
« on: December 22, 2012, 04:08:31 PM »
Thanks,

I am using a work-around for the firmware problem:
 

   ' This code is a work-around for the firmware problem.
   '
   ' The following code is equivalent to this statement:
   '   RSHIFT DM[1],4
   '
   for j = 1 to 3             ' worry about carry in for first 3 registers
      RSHIFT DM[j],1      
      if testbit(DM[j+1],0)
         setbit DM[j],15      ' Carry-in will be a 1
      else
         clrbit DM[j],15      ' Carry-in will be a 0
      endif
   next
   RSHIFT DM[j],1            ' No carry into most significant register

[/color][/font]

This will keep me working until I get new hardware,

Gary D.

378
Technical support / RSHIFT on Nano-10 +r73
« on: December 21, 2012, 11:24:17 PM »
Is it a know problem with Nano-10 +r73 that the RSHIFT command does not function as documented on actual hardware?

If I initialize DM[] as follows:
DM[1] = &H8000
DM[2] = &H8000
DM[3] = &H8000
DM[4] = &H8000

Then issue:
RSHIFT DM[1],4       ' shift one bit right DM[1..4]

This is what I see:

DM[1] = &HC000
DM[2] = &HC000
DM[3] = &HC000
DM[4] = &HC000

This is what I expected:
DM[1] = &H4000
DM[2] = &H4000
DM[3] = &H4000
DM[4] = &H4000


I am not seeing the least significant bit being shifted into the most significant bit of the lower numbered variable.

What I am seeing is a shift within each 16 bit register that is mostly a propagation of the signed bit.  

For RSHIFT to be useful it CAN NOT be a 16-bit unsigned shift.

In the simulator the RSHIFT command executes as documented.

If I purchase a new Nano-10 is this problem resolved?

Gary D

379
Technical support / Re:i-TriLOGI V6.45 font issue
« on: December 21, 2012, 11:08:42 PM »
Thanks,

Your right about ugly, but I like things to line up.

Gary D

380
Technical support / i-TriLOGI V6.45 font issue
« on: December 21, 2012, 12:20:31 PM »
I just down loaded the most recent i-TriLOGI and ran into an issue with the incorrect font usages.  I expected that the custom function editor would use a mono-pitched font.  But some of the syntax highlighting must use a variable-pitched font.

Please see screen dump and notice that the line with the "FF".

Thanks,

Gary D


381
Technical support / Re:Hardware Flow control for RS-232 Ports
« on: December 18, 2012, 02:13:27 PM »
I have rewritten my GSM MODEM test code to use DM[] as a FIFO between the PLC's receive buffer for port #1 and the application code.  This is in effect double buffering!

This approach has greatly simplified my application code and provides a much more robust interface for the GSM MODEM.

I've attached an PC6 program that shows how to implement a FIFO structure in DM[] and a replacement for the INPUT$(n) function works with the FIFO structure.

The code shows part of the solution to working with messages that are greater than 70 characters in length.

Please note that this code has been tested on the Nano-10 and the FMD PLCs.  The code makes extensive use the #Define mechanism.

Gary D.

382
Technical support / Re:Hardware Flow control for RS-232 Ports
« on: November 28, 2012, 10:25:37 AM »
Thanks,

I have been using INCOMM rather than INPUT$ because the GSM MODEM sends some data that is not delimited by a CR character.  

I also have been using INCOMM because the GSM MODEM uses the pair of characters, CR and LF, as end of line markers.  INPUT$ leaves the terminating LF in the buffer and it becomes the first character of the next string.

Many of the messages from the GSM MODEM do not fit within the string length limitations of 70 characters, so I have been using DM[] to for a lot of the string manipulations.

I think that the use of DM[] as an extended buffer space is an excellent idea.  I will have to ask Mr. R. Tito to drop the BAUD rate to 9600 to ensure that the receive buffer will not overflow between scans.

Thanks for the suggestion.

Gary D.

383
Technical support / Hardware Flow control for RS-232 Ports
« on: November 26, 2012, 10:36:16 PM »
Gentlemen,

I have been working  with Mr. R. Tito to interface a FMD series PLC to a GSM MODEM using the RS-232 port.

We have been able to solve most of the interface issues.  We have been able to get a system that handles a reasonable subset of sending/receiving SMS text messages.

I have run into a problem that I can not solve with clever use of TBASIC and ladder logic.  The GSM MODEM can and will send responses that exceed 256 characters.  Unfortunately, the PLC does not appear to support any sort of hardware handshake (RTS or DTR) to prevent the GSM MODEM from sending more characters than the PLC receive buffer can handle.

The typical GSM MODEMs do support hardware handshake on their RS-232 ports to prevent buffer overrun.

Have I missed something in my understanding of the PLC RS-232 behavior?  

Is there some semi-secret system command or jumper that could be set to get the PLC to indicate when it can not accept serial data without corrupting the receive buffer?


Thanks,

Gary D.

384
Technical support / Re:LCD update data instantly
« on: August 25, 2012, 09:25:55 PM »
Tito,

I have a ".pc6" program that demonstrate a simple FIFO mechanism that you may need to deal with the issue of input changes that may happen at a rate that exceeds the rate that SMS messages can be generated and sent.

Please send me your email address (you can find mine in my user profile) and I will send you the ".pc6" file.

The FIFO uses DM[] memory to hold the data.  Data is enqueued (written into DM[]) based on the index, ENQ_Index.  Data is dequeued (read from DM[] based on the index DEQ_Index.

Once data is placed into DM[] it is not moved.  The indices are adjusted.  It is faster and simpler to not move the data.

Please note that this code uses the #Define mechanism to make the code a bit more readable.  These are the items that use the #Define mechanism:

#   #Define Name   Value
1   ENQ_Index   DM[1]  
2   DEQ_Index   DM[2]
3   FIFO_Cnt           DM[3]
4   FIFO_Size           4
5   FIFO_StartIndex   11


ENQ_Index determines where data is stored
DEQ_Index determines where data is read
FIFO_Cnt is the quantity of data stored in the FIFO
FIFO_Size is the size of the FIFO.  In this example the FIFO can
hold 4 items.  Change this value to change the size of the FIFO and rerun the code.
FIFO_StartIndex is the index into DM[] for start of the actual data storage.  In this example I use DM[11.15] to store the 4 data items.


There are 3 custom functions involved in this example:

1. InitFIFO - this must be called once at the start of the PLC program to make the FIFO appear to be empty.

' InitFIFO - Initialize FIFO indices and flags
'
ENQ_Index   = 0
DEQ_Index    = 0
FIFO_Cnt    = 0
SetIO FIFO_EMPTY
ClrIO FIFO_FULL

2. ENQ_A - this function writes a value to the FIFO:

' ENQ_A - function to enqueue the least significant 16 bits of A

IF TestIO(FIFO_FULL)
   ' the FIFO is full and cannot accept data
   ' this is and error condition
   '
   RETURN
ENDIF


DM[FIFO_StartIndex + ENQ_Index] = A      ' Add a value to the FIFO

' Update FIFO index, counter and flags
'
ENQ_Index = (ENQ_Index + 1) MOD FIFO_Size
FIFO_Cnt = FIFO_Cnt + 1

ClrIO FIFO_EMPTY         ' FIFO cannot be empty

IF FIFO_Cnt = FIFO_Size
   SetIO FIFO_FULL         ' the FIFO is full and cannot accept more data
ENDIF


3. DEQ_A function to read a value from the FIFO

' DEQ_A - function to dequeue a 16 bit value from the FIFO and load it into A
'

IF TestIO(FIFO_Empty)
   ' the FIFO is empty and there are no values to remove from the FIFO
   ' this is and error condition
   '
   RETURN
ENDIF


A = DM[FIFO_StartIndex + DEQ_Index]      ' remove one value from the FIFO

' Update index, FIFO count and flags
'
DEQ_Index = (DEQ_Index + 1) MOD FIFO_Size
FIFO_Cnt = FIFO_Cnt - 1

ClrIO FIFO_FULL         ' FIFO cannot be full

IF FIFO_Cnt = 0
   SetIO FIFO_EMPTY   ' the FIFO is empty and there is no more data to remove
ENDIF



I know that you may me overwhelmed by the detail of this code, but this is the simplest way that I know to get the job done with TBASIC.  The sample code sets, clears and tests the following RELAYS: FIFO_FULL and FIFO_EMPTY.  This was done to allow ladder logic to "Know" the current state of the FIFO.

Best regards,

Gary D.

385
Technical support / Re:LCD update data instantly
« on: August 25, 2012, 09:25:37 AM »
Tito,

You have a problem. If it takes 10 seconds to send SMS messages for an event and an event happens every second, your system will fail.  

With that set of rules, an infinite queue length is not long enough. Think "tortoise and hare", with the tortoise being SMS  transit time and the hare being the an "event".  Unless the hare stops running, the tortoise never catches up.

The moral of this story is you need to be able to calculate how long your queue needs to be for your worst case bursts of event.

Questions that you need to answer:

1. What is the maximum frequency that an input can change state.  The answer to this determines how often you will have to "poll" for changes.

2. Are there periods of time while no inputs change?  

3. Do the input changes come in bursts of changes followed by long periods of inactivity?

4.  What happens if the queue is full and another event occurs?  Can your system tolerate periodic loss of data?


It is possible to build a queue in DM[] to store a copy of INPUT[1] every time an input chages.  Do you need record the time/date that for each event?

I can show you a "simple" queue or more correctly a FIFO (first in first out) mechanism coded in TBASIC in another post.

Gary d

386
Technical support / Re:LCD update data instantly
« on: August 24, 2012, 09:37:12 PM »
Tito,

Excellent question.  

In your examples you were only using 5 INPUTS.

INPUT[1]  represents the first 16 input bits.  You seemed to be interested in only the first 5 inputs.

The & &h1f is a "mask" that isolates only the first 5 inputs. If you omit the & &h1f term then the all 16 inputs would be evaluated.

I use the &h notation to remind me that this is but mask.  I don't do bits well in decimal.

Gary d

387
Technical support / Re:LCD update data instantly
« on: August 24, 2012, 07:46:18 PM »
Tito,

I don't know what you mean by " if i am CALLing functions on for every sensor triggered, how can i put in queuing system".

Let's say that you only want to update K$ when any input has changed state.  This can be done in ladder logic, but I don't think you are ready for this.  It can also be done using a custom function.

I've added an IF statement to the previous code snippet.  K$ will only be updated if the state of the INPUT[1] has changed from the last time that this function was called.


' Custom funtion to check if inputs have changed from the last call.
'
' If nothing has changed, then nothing will be done
'
IF ((DM[17] ^ INPUT[1]) & &H1F) = 0
   RETURN               ' Inputs have not changed, bail out.
ENDIF

' Inputs have changed. Save new value and build string in K$

DM[17] = INPUT[1]      ' Store Present Version of INPUT[1] state for future
FOR I = 0 to 4
  IF TESTBIT(INPUT[1],I)
    DM[I+1] = 1
  ELSE
    DM[I+1] = 0
  ENDIF
NEXT

K$= STR$(DM[1]) +","+ STR$(DM[2])+","+STR$(DM[3])+","+STR$(DM[4])+","+STR$(DM[5])
 


Am I getting any closer in guessing what you need?

Gary D

388
Technical support / Re:LCD update data instantly
« on: August 24, 2012, 08:21:13 AM »
Tito,

Run your code in the simulator.

Look what happens if more than one input is active.  You should observe that K$ will be something like this, "0,0,0,0,0".

Is this what you want?

Gary d

389
Technical support / Re:Setsystem
« on: August 16, 2012, 07:58:21 AM »
Marcus,

I'm still a little worried about this line:

SETSYSTEM 8,&H03 + DM[66]

I think you want something more like this:

SETSYSTEM 8,&H0300+ DM[66]

I assume that dm[65] holds a decimal value in the range of 1..255. If dm[65] holds the value 7 then your version will compute to a value of 10.

In my version you should get &h307

Best regards,

Gary d

390
Technical support / Re:Setsystem
« on: August 14, 2012, 07:47:16 PM »
Have you tried something even simpler:

SETSYSTEM 8, DM[65]

This passes muster with the simulator.

Adding the &H to get &HDM[65] should get you a syntax error.  The &H prefix is only used to give the TBASIC interpreter the "heads up" that you are trying to enter a numeric constant in hexadecimal notation.

A = F      assigns the value of the variable F to variable A
A = &HF  assigns the hexadecimal value "F" (15 decimal) to variable A

TBASIC will see &HDM[65] and will be fine with the &HD part, but when it parses the "M" it will blowup as "M" is not a legal hex digit. The interpreter will never get to the [65] part...

Gary D

Pages: 1 ... 24 25 [26] 27 28 ... 34