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 ... 30 31 [32] 33 34
466
Technical support / Re:10s CLock
« on: January 28, 2010, 11:14:41 AM »
If you are looking for a clock with a period of 10 seconds (frequency is 1/10 Hz) then the following circuit will work.  

If the Set Value of the COUNTER, 10SecClk, is 10, then  10SecClk will go active for 1 scan time every 10 seconds.



  The RSctr (counter reset) should be placed
  immediately BEFORE the rung that causes the counter to decrement.
  This ensures that the 10SecClk will be active for a full
  scan of the ladder logic.

  If the order of the ladder logic rungs is switched, then
  the 10SecClk will not be seen by the ladder logic

   10SecClk                                 10SecClk
-----||--------------------------------------(RSctr)

   Clk:1s                                   10SecClk
-----||---------------------------------------(CTR)


If you are looking for a 10 second time period to be used as a delay, time limit, minimum ON time, then I'd use a TIMER.

Gary D

467
General Discussions / Re:Generic ladder logic question
« on: January 27, 2010, 02:53:24 PM »
The following logic will detect when the 3 inputs have been stable for the minimum time determined by the SetValue of TIMER, InputChange.

I'd give this logic a try,

Gary D.




  Detect Input Change.  Have any of the inputs changed
  since the previous scan through the ladder logic?

   Input1  Latched1                            InputChange
-----||-----|\|--------+--------------------------(RLY)
                       |
   Input1  Latched1    |
-----|\|-----||--------+
                       |
   Input2  Latched2    |
-----||-----|\|--------+
                       |
   Input2  Latched2    |
-----|\|-----||--------+
                       |
   Input3  Latched3    |
-----||-----|\|--------+
                       |
   Input3  Latched3    |
-----|\|-----||--------+


  When Inputs have remained stable longer than the
  SetValue of the InputStable TIMER then InputStable will
  be TRUE.

   InputChange                                 InputStable
-----|\|------------------------------------------(TIM)


  Remember Input state for comparison on
  Next scan of logic.

   Input1                                        Latched1
-----||-------------------------------------------(RLY)

   Input2                                        Latched2
-----||-------------------------------------------(RLY)

   Input3                                        Latched3
-----||-------------------------------------------(RLY)



468
Technical support / Re:Program Question
« on: January 26, 2010, 01:08:11 PM »
No. Custom functions are executed one at a time.

The PLC evaluates your ladder logic program one rung at a time from the top to bottom of your program.

If a custom function is invoked during the evaluation of a ladder logic rung, then the PLC will wait until the custom function completes before continuing to the next rung of the program.

If your custom function "waits" for some event, then execution of the PLC will wait, also.

You should rethink your approach.  If the "enter" key is a discrete input to the PLC, invoke a custom function when this key is pressed:

   Enter                   EnterPressed

----||-----------------------{dCusF}


This is only part of what you need to do, but it should point you in the right direction.

There are sample programs written for TriLogi's HMI interface.  Look for "HMIxxtoyy.PC6".  The HMI hardware looks like a bunch of separate input switches to the PLC. They demonstrate a method to handle input without hanging up the execution of the PLC program. Look for files with names: "HMIxxtoyy.PC6".  

Good luck,

Gary D.

469
Technical support / Re:Setting Variables
« on: January 16, 2010, 08:16:26 PM »
Your programming example has several problems:
  • In your first line, RLY[1] should have been RELAY[1]
  • You have two "IF" statements, but only 1 "ENDIF"
  • You don't need line numbers (@10, @20, ...) on any line except the target of the GOTO statment.
  • You don't need the GOTO statement at all.
  • I suggest that you use the TESTIO(x) function to test the state of an input rather than the RELAY[1] mechanism because it is easier to read and to maintain.
The following code is a bit more straight forward and may be easier to debug/maintain:

IF TestIO(Input_X) OR ((DATE[4]<1 OR DATE[4}>5) AND (TIME[1]<=7 OR TIME[1]>=16))
   SetIO PWR_TV
   SetIO PWR_COMP
ELSE
   ClrIO PWR_TV
   ClrIO PWR_COMP
EDNDIF


470
Technical support / Re:Setting a DM location = to a counter value
« on: January 12, 2010, 03:40:18 PM »
You can make the DM[] array act as if it is non-volatile using a couple of different methods:
  • If you have the MX-RTC battery backed clock calendar option it is possible to make the DM[] behave as it is is non-volatile.  This requires both the MX-RTC module and a dip-switch setting on the PLC board.
  • Copy the values that you want to save into the EEPROM and reload the DM[] from EEPROM at power up/reset
I use the following code to copy the first 96 entries of DM[] into EEPROM at addresses 1 to 96:

    FOR I = 1 to 96
      SAVE_EEP DM,I
    NEXT


I use the following code to reload DM[] when the PLC is reset:

   for i = 1 to 96
      dm=LOAD_EEP(i)
   next


471
Technical support / Re:T100MD+ High Speed Counters
« on: December 01, 2009, 08:42:39 AM »
Doug,

If your application cannot tolerate the +/- delay of the ladder logic scans, you should rethink your use of a PLC for this critical bit of timing.  

The only way you can reduce the variability is to do everything relaated to handing the external event and your time delay need in the interurpt handling function.  Start the timer, force the output, poll for timer to compled clear the output and then exit the custom funciton. This has the negative side effect of shutting dow the PLC for the duration of your delay.  The ladder logic scan mechanism will be suspended and the system will be unresponsive to changes on inputs.

You may want to figure out how to do the precise time delays using circuity external to the PLC.   I'd investigate the use of cheap microcontrollers such as Basic Stamp, Rabbit or PIC.  The PLC can handle the user interface and "talk" to the external microcontroller via the RS-485 serial port. The microcontroller could act as a precision, programable time delay relay.
 
Gary D

472
Technical support / Re:T100MD+ High Speed Counters
« on: November 27, 2009, 02:02:35 PM »
The relationship between the Input pin # and the Interrupts are documented in section 1.2 of the T100MD+ User's Manual.

Input pin #3 is the physical input for interrupt #1
Input pin #4 is the physical input for interrupt #2
Input pin #5 is the physical input for interrupt #3
Input pin #6 is the physical input for interrupt #4

If your goal is to start a timer based on an external edge event, I'd suggest using the normal ladder logic.

In the following example:
  • Start is the INPUT
  • Timer1 is the TIMER
  • StartEvent is a RELAY that is active for a single ladder logic scan on the rising edge of the Start INPUT.
  • Event is a RELAY that is set by the StartEvent  and cleared

when Timer1 times out.
[/list]

    Start                                   StartEvent
-----||---------------------------------------[dDIFU]

  StartEvent     Timer1                        Event
-----||-----+----|/|-------------------+------(RLY)
            |                          |
   Event    |                          |      Timer1
-----||-----+                          +------(TIM)


Good luck,

Gary D

473
Technical support / Re:T100MD+ High Speed Counters
« on: October 14, 2009, 10:35:35 PM »
I've taken a stab at using the interrupt input mechanism to interface a low speed quadrature encoder at 2X to the M-series PLC.

This approach is just fast enough.  I connected the the A phase to Input pins 3 and 4 (Interrupts #1 and #2).  I connected the B phase to Input #5 (no special handling).  Variable A will be used to hold the current count. RELAY "TIC" will be used to comunicate to the ladder logic that the A variable has changed.

I initialized the interrupt system with the following TBASIC code:

INTRDEF 1, 2, 1      ' Positive Edge Interrupt handler
INTRDEF 2, 3, 0      ' Negative Edge Interrupt handler

A = 0            ' A will be used to store count

Interrupt #1 will handle the positive edge of phase A and the TBASIC code is as follows:

' PosEdgeA Interrupt handler
'
' Increment/Decrement based on phase B
'
if testIO(B) : A=A+1 : else A=A-1 endif
setIO TIC

Interrupt #2 handles the negative edge of the A phase:

' NegEdgeA
'
' Increment/Decrement based on phase B
'
if testIO(B): A=A-1 : else A=A+1 endif
SetIO TIC


Thanks for all you your support.  

Gary D

474
Technical support / Re:T100MD+ High Speed Counters
« on: October 14, 2009, 01:00:26 AM »
Thank you.  

Let's not worry about my question #4.  I didn't ask the right question.  Sorry.

About question #5.  I think that what you are saying is that during the execution of the following TBASIC code:

    C = hscPV[1]

The M-series PLC has to access the 32-bit hscPV[1] register with two 16-bit reads. AND that there is an interlock to ensure that the HSC does not change value both 16-bit reads have completed.

If there was a possibility of the interrupt to update the HSC might occur between the two 16-bit reads counter then I can use the following sort of trick to get a stable (valid) read:

   C = hscPV[1]              ' read HSC one time
   while C <> hscPV[1]       ' verify that we get the same value 2x
      C = hspPV[1]         '     no, read HSC again
   endwhile

   ' If I get here then we have a good read of the HSC


Thanks again for your help,


Gary D.

475
Technical support / Re:PC LCD MONITOR Text SIZES
« on: October 13, 2009, 12:23:05 PM »
I have no problems with font size with the TRilog tools.

I'm using a wide-screen monitor with a native resolution of 1920x1200.  My system, now is Vista-32 and the most recent version of Java (1.6.0_15-b03).

I was using the same monitor with my XP system.

The default screen font size is determined by Windows.  There is a setting that controls the size and appearance of the default screen font.  I have set my screen resolution to 96 DPI.

For XP, right click on an empty space on the desk top.  From the pop up window select:

    Display Properties > Settings > Advanced > Display dpi

Change the DPI settings to something like 120 DPI for really big text.

For Vista, right click on an empty space on the desk top. From the pop up window select:

    Personalize > Adjust font size (DPI) > Custom DPI ...


gary d

476
Technical support / Re:T100MD+ High Speed Counters
« on: October 12, 2009, 09:41:01 PM »
Thank you very much for the answers to my questions.  

The F-Series may be a "better" choice for the rotary encoder.

QUESTION 4:

Is there a mechanism available to the F-Series to synchronously increment/decrement the 32-bit value associated with the HSC from a custom function?

The reason that I am interested, is that I'd like to translate the value of the 32-bit count value to a series of ladder logic events by way of a custom function that is called periodically.

The following is that sort of code that I'm interested in:

if hscPV[1] > 0
   setIO DEC
   hscPV[1] = hscPV[1]-1
endif
if hscPV[1]< 0
   setIO INC
   hscPV[1] = hscPV[1]+1
endif


The relays DEC and INC will be cleared by ladder logic before the custom function will be called again.  

I suspect that this sort of code may fail because the HSC count value may change during the time that the custom function is executing and it would be possible for each read of the HSC to return a different value.

I will experiment with something more like this

Custom function to initialize HSC #1:

   hscdef 1, 255, 32000
   hscPV[1] = 0
   C = 0      ' tracking value


Custom function 255 has no use for me as the absolute value of the HSC counter is not very useful.  It is the differential value (or the change in value) that I'm trying to learn.


Custom function call periodically to translate counter values to ladder logic events:

   E = hscPV[1] - C     ' Tracking error. Single read access of HSC value

   if E > 0
      setIO DEC
      C = C + 1
   endif
   if E < 0
      setio INC
      C = C - 1
   endif



QUESTION 5:

Is it even possible to read the value of a HSC while the A/B inputs may be changing and get a valid result?

My concern is that you document the HSC counters as behaving as a signed 32-bit integer.  Since I do not know the internal details of your PLC  ASIC, I don't know if TBASIC code:

    C = hscPV[1]

accesses the 32-bit counter with a single 32-bit access or if your ASIC performs 2 16-bit accesses, 4 8-bit accesses...

My concern is that IF the TBASIC code has to "assemble" the 32-bit value from more that a single read access to the HSC than there is a possibility that the value assigned to C will be invalid on some occasions.

A possible issue is when the HSC counter has a value of -1 (0xffffffff) and if the TBASIC accesses the HSC counter as 2 16-bit registers.  If the HSC counter changes value to 0 (it has been incremented) is it possible for the value assigned to C to be some odd mixture of pre and post increment (-1 to 0) and C might get assigned a value of 0x0000ffff (65535) instead of either 0xffffffff(-1) or 0x00000000(0) .

Thanks again.

477
Technical support / T100MD+ High Speed Counters
« on: October 11, 2009, 09:37:02 PM »
I attempted to interface a mechanical rotary encoder to a T100MD+ PLC.  The goal was to use the encoder for a simple input control for PLC based project.  Just one knob and one or two external push button switches.

These encoders are typically used as volume controls on car radios and many other consumer devices.  The encoder that I was using is a EVQ-WTE series encoder manufactured by Panasonic.  The encoder act just like typical 2-bit quadrature encoders with A/B outputs that are out of phase by 90 degrees.   The encoder has 30 mechanical detents for each revolution of the knob but only produces 15 complete output cycles.

The encoder waveforms look like this:

            +----+----+------ Mechanical Detent
            |     |     |
            V     V     V        
      ---+     +----+     +---
  A      |     |     |     |
         +----+     +----+

         ---+     +----+     +---
  B         |     |     |     |
           +----+      +----+
              ^         ^
              |         |
              +--------+------ HSC counts here

  A/B Phase relation for C.W. Rotation



I tried 2 different approaches to interface this encoder to the PLC:

1.  Ladder logic.  This failed because the "debounce" logic used for the PLC INPUT circuits limits the speed that the the encoder can be operated and the ladder logic scan time is a  too slow to catch all of the transitions on the A/B inputs.

If the knob is turned quickly at a speed of about 1 RPM the phase difference of A/B can be as little a 2.5 ms.

I used the following ladder logic.  I used a Sequencer because it is easy to initialize to a value of "0" without having to use a custom function.


 |
 | 1st.Scan                              Seq1:0
 +-----||--------------------------------[StepN]
 |
 |     A                                  CLKA
 +-----||--------------------------------[dDIFU]
 |
 |      A                                 CLKAN
 +-----|/|-------------------------------[dDIFU]
 |
 |    CLKA     B                          Seq1
 +-----||-----|/|---+--------------------[Upctr]
 |                   |
 |    CLKAN   B      |
 +-----||-----||----+
 |
 |    CLKA    B                           Seq1
 +-----||-----||------+-----------------[Cnctr]
 |                    |
 |    CLKAN    B      |
 +-----||-----|/|-----+
 |
 |


2. High Speed Sequencer.  Using HSCDEF 2,2,32000 in a custom function and connected the A and B phase signals to input pins 5 and 6.

The high speed sequencer only counts on the positive transitions of the A phase.   As a result, for every two clicks (mechanical detents) on the encoder the HSCPV[2] will count up/down only one time.  

The good news is that the HSC mechanism is fast enough for my low speed counter application.  Unfortunately the HSC only counts 1/2 of the time!

3. My next experiment is to use both HSC #1 and HSC#2 to connect to the mechanical encoder.  I will connect the encoder A/B inputs directly to HSC #1.  I will connect inverted versions of A/B (ULN2003?) to HSC #1.  I will then use a custom function to calculate the total count T:

    T = hscPV[1] + hscPV[2]

QUESTION  1:

Is there a mechanism to configure the High Speed Counters for the M series of the F series to count on both transitions of the A phase?  Look at my ladder logic for an example of how this is done.


QUESTION 2:

Do you have any other suggestions on how to get a low speed quadrature encoder to work with your PLCs?

QUESTION 3:

Is there some easier mechanism for me to draw waveforms on your YaBB system?  I change the fonts to "Courier" but your BB system has issues with ASCII spaces (0x20) and does not treat them as having the same horizontal width as other printable characters.  This makes it impossible to do nice ASCII artwork.

Thanks,

Gary D.

478
Technical support / Re:Trilogi 6.22 I/O Labels
« on: October 08, 2009, 10:38:00 PM »
I'm using Java Version 6 Update 15 (1.6.0_15-b03) on 32 Bit Vista.

I'm using TriLOGI Version 6.24 Build 03.

The combination works for me.

One other issue has to do with video display drivers.  I recently replaced my video card, and found that the new card with the most recent drivers fixed a small display issue with the "Internet TRiLOGI Server".

Good luck.

479
Technical support / Re:Multiple output for event schedule
« on: September 22, 2009, 06:44:56 PM »
You can use ladder logic to create OUT2 so that it is ON for the first 30 seconds that OUT1 is ON.

You can use a TIMER with a Set Value of 300 (30 seconds) to generate OUT2 from OUT1.

In the following example, Tmr30Sec is a TIMER with a SV of 300:


   Out1                                  Tmr30Sec
----||------------------------------------(TIM)

   Out1   Tmr30Sec                        Out2
----||------|/|---------------------------(OUT)



There is sample code posted on the TRI website that demonstrates how to set/clear many relays based on the current time.  I use this code in all of my PLC projects and it is 100% reliable.

http://www.tri-plc.com/trilogi/RTCAppByGDK.zip

Gary D.

480
Archived Tech Support / Re:Using MX-RTC
« on: July 29, 2009, 05:09:54 PM »
I have modified the demo program for improved reliability. I have added a routine to access the TIME[] registers to ensure that the correct time is returned.  I would be happy to e-mail my modified program.  Please let me know.

Gary Dickinson

Pages: 1 ... 30 31 [32] 33 34