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.


Topics - garysdickinson

Pages: [1] 2 3 ... 5
1
A long time back I worked with the pre-production Wx100 product using any of a number of versions i-TRiLOGI that were test builds.

I got an email from a Wx100 user and he was having problems with compiling a Wx100 program that I wrote.

The affected file is named "Wx100 Simple Menu V1_12.PC7.

The problem is that this demo code was written with an early version of i-TRiLOGI when the "Comment" field was added to the #define mechanism.  The current tool set V7.5 Build 14 uses a different field separator in the .PC7 file than was used by the early version that I wrote the code with...

The early version used commas as field separators in the PC7 file. Sort of like this:  #,Defined Name,Value,Comment
The current tool set uses commas and an ASCII <RS> (record separator). Looks like this: #,Defined Name,Value<RS>Comment

The problem is that my "old" code when compiled with current tools doesn't recognize the "," before the Comment field so the Value field ends up with the correct "Value" a comma and then the Comment text.  The Comment field is always empty.

I was able to fix the problem for the user, by exporting the #Define Table to a text file and replacing the first "," character by an ASCII TAB character and then importing the edited #Define table back into the PC7 program.  The edited #define table now works perfectly and if I peek into the PC7 file I see the <RS> character in the correct spot.

I have attached the corrected .PC7 file.  It is now named "Wx100 Simple Menu V1_13.PC7.  The only changes from the V1_12 file is the corrected #define and I added a comment for the V1.13 version to give a hint as to why it was changed.

I think that the V1.12 version may appear in in the Wx_Specifics directory and in a Zipped file named "Wx100 Simple Menu.  Is this something that you can fix in a future release?

Best regards,

Gary Dickinson


2
Technical support / PLC INPUT Interrupt Behavior
« on: October 05, 2022, 03:12:18 PM »
I have been working on using the INPUT interrupts that are tied to end limit switches for a stepper based motion system.  I have gotten them to work, but am a little confused about the timing.

This is the code for one of the ISRs:


' Ch1LoLmtISR - Interrupt handler for Ch1LmtSwLo
'
' This code aborts the CH1_Y stepper system when the interrupt condition is met
'
StepStop CH1_Y          ' Abort Stepper Motion
IntrOff Ch1LmtSwLo_Int  ' Disable interrupts for this Input
SetIO Ch1Intr           ' Set ISR event RELAY


I am aware that while an ISR is active, following the execution of IntrDef, that the INPUT pin status is NOT latched at the end of the ladder logic scan. When the ISR for an input is disabled, the INPUT status is "visible" to ladder logic.  So my "initial fix" was to re-sych the Ch1Intr RELAY at the end of the ladder logic to control a 2nd RELAY, Ch1IntrDly, with something that looks like this:

Ch1Intr
----||-----------------------------------------(Ch1IntrDly)

My assumption is that if the ISR set CH1Intr then waiting one scan time the delayed version of CH1IntrDLY in ladder logic, that the physical INPUT would be visible to the ladder logic.

Sometimes this works and sometimes it does not.  So I added more logic to delay the CH1Intr by a 2nd scan and this worked a bit better, but sometimes failed.

Ch1IntrDly
----||-----------------------------------------(Ch1IntrDly2)

Ch1Intr
----||-----------------------------------------(Ch1IntrDly)

My "ultimate" fix was to make Ch1IntrDly a TIMER and not a RELAY. This will result in multiple scan times before the TIMER goes off.  Now everything is visible to the ladder logic.

Do you have any suggestions on a better approach to "know" when the INPUTs are working after turning off an INPUT interrupt?

Is there some other timing issue that I am missing?

Does the SetStop take a lot of time to execute? If so should I have rearranged the order of the lines of code in the ISR?
Does the IntrOFF statement take effect immediately, or is it delayed to some point in time that is tied to the ladder logic scanner?

Beat regards,

Gary Dickinson

3
Technical support / Small quibble on Version 7.5 Build 14
« on: September 08, 2022, 02:12:25 PM »
The Print Dialog box gets overwritten with parts of the displayed .pc7 file after pressing on the "Print" button.

See attachment

Gary D

4
Technical support / EZWire1616 Stepper controller OUTPUTs
« on: September 07, 2022, 08:32:14 PM »
I am working with the EZWire1616 and have run into some questions with the stepper control mechanism.

I am using CH1 and CH2 to drive external stepper drivers using
PULSE and DIRECTION signals.

The user manual that I can find is Rev 1.0 dated 3/17/2016.  It shows support for 3 steppers with the control signals on OUTPUTS 5 and 6 for CH1. OUTPUTS 9 and 10 for CH2 and 13 and 14 for CH3

The issue is that the CH2 OUTPUTS appear to be actually using 7 and 8 and NOT 9 and 10.

Other documentation on the website says that this PLC only supports 2 steppers and not 3.

Questions:

What is the correct wiring for CH2?
Is there support for CH3 if I need it?
Is the more accurate documentation available for this PLC?

Gary Dickinson

5
Technical support / Interfacing Thermistors to TRI PLCs
« on: October 14, 2020, 02:50:25 PM »
I am working on a PLC project that needed to use Thermistors for temperature measurements.  This is not a new topic, but for my current application I decided to see if I could do this without the traditional lookup table and linear interpolation algorithms.

My application did not only required accuracy over a range or 30 or 40 degrees C. 

I was able to get the math for converting ADC counts to temperature to a single equation for my application:
 
      y# = x * 2.1095E-2 - 3.3485E+1         

No lookup tables.

So I am sharing how I got to this sort of solution. Perhaps, it would be useful to others.

I have attached the documentation to this message. I will post the Excel spreadsheet on the next message in this thread.

Gary Dickinson

6
Technical support / Implementation of a Stack or LIFO in TBASIC
« on: January 06, 2020, 03:31:35 PM »
This post shows how to implement a stack or Last In First Out data structure in TBASIC.

This example builds the stack in DM32[]. 
The size and location of the stack is controlled by entries in the #Define table.
Separate custom functions to initialize, push data and pop data are written to be as small and fast as possible.

The Stack.PC6 file is attached to this post. This is test bed code that will run in the i-TRiLOGI  simulator. This code should be easily adaptable for many uses.

The next post will have post a bit of documentation on how the stack operates.

Best regards,

Gary Dickinson

7
Technical support / User written Modbus RTU example code
« on: June 11, 2019, 05:22:29 PM »
I am presenting the code that I have been using for the last 5 years as an alternative to the TBASIC ReadModbus, ReadMB2, WriteModbus and WriteMB2.

This code is supports all possible Modbus function codes.

This code is non-blocking. The PLC does not lock up waiting for a response from the slave device.

This code is an example of a user written communication protocol

This code allows you to see both the Modbus response packet and every byte received from the Modbus slave.  This allows you tremendous debug capability that is not available with the TBASIC Modbus support.

I will post the PLC code and the documentation in pieces to keep them under 200KB

Regards

Gary Dickinson

8
The forum webpages are displaying odd Unicode characters in place of ASCII spaces or ASCII tabs.  These characters are showing up: ���

Is there some secret settings I need to make to my internet browser to fix these funny characters?

Best regards,

Gary D*ckinson

9
Technical support / use of the goto @n statement
« on: December 03, 2018, 08:20:30 PM »
Gentlemen,

I am quite confused about the goto statement. I have never used one as it is considered by many to be "unsophisticated".  But I have been playing with them in an attempt to write a CF that consumes a lot of CPU time without the use of for/next, while/endwhile, delay or SetLCD statements as all of these resets the WDT mechanism.

So I set out to write a non-sense program that used nested for/next loops and a lot of string functions. I picked on the string functions because they are slow.

I wrote the following nonsense code and cannot get it to compile:

' for_next
'
' This code is an eumulation of a for/next loop using goto statements
'
'
/*
   for j = 1 to 3
      b = b + b
   next
*/


j = 1         ' loop counter initialization
@200
if j > 3      ' range check
   goto @220
else
   ' loop body
   '
   b = b + b
@210   ' continue entry point
   j = j + 1   ' counter + step value
   goto @200
endif
@220         ' loop exit
[/color]

The compiler exits with the following error message:

Error:Undefined GOTO destination: @: "-36"

and the first 3 characters of the last line of the program are highlighted in yellow:

@220         ' loop exit

Any idea what this error message means?

Any idea what I have done to offend the compiler?

Best regards,

Gary D*ckinson

10
Technical support / Watch dog timer.
« on: November 21, 2018, 06:45:08 PM »
I have a client that is concerned that his PLC based system is becoming non-responsive.  He has 25 of these systems running in at least 3 different countries. These systems have been running for 3+ years.

I am looking at the SetSystem 255 command.  This is described as an "on-CPU Watch Dog Timer".  I fully understand the concept of this mechanism.

However I am puzzled by the documentation.  The initial description, "If enabled and the CPU goes astray because of noise induced troube, the WDT will reset the CPU when it times out."  This is exactly what I would expect for a WDT.

Here is where I get into trouble.  The documentation talks about "when the programed is stucked [sic] inside a GOTO loop".  Then the documentation states that "the WDT will not kick in if your program is stucked [sic] inside a FOR..NEXT or WHILE..ENDWHILE loop."  So you are telling me that the WDT only works in a GOTO loop but not FOR..NEXT or WHILE..ENDWHILE?  This makes no sense.

Now for the big issue the documentation states, "WDT also will not activate if your program encounters undefined interrupt error..."  

I believe that there is a SetSystem command that allows me to set up an trap for undefined interrupts.  I, currently, can't find where this is documented, but I believe that I can create a CF that could reset the PLC in the event of these interrupts.

Can I use both the WDT and the undefined interrupt trap at the same time?

Can you point me to the documentation for the interrupt trap?

Best regards,

Gary D*ckinson


11
Technical support / Stepper Motor Demo Code
« on: May 02, 2018, 03:10:38 PM »
I have attached the PLC program StepperTest V2_01.PC6 to this post.

This is a test program that I wrote about 3 years ago to test a stepper motor-controlled valve.  This is a simplified version of that test code.  

If you are thinking about use the PLC for stepper control, this is an excellent starting point as all of the code can be used and extended for your purposes.

Best regards,

Gary D*ckinson

12
Technical support / Tic Tac Toe game for PLC
« on: December 08, 2017, 11:35:22 AM »
I got bored.  So I wrote PLC program to play Tic Tac Toe (Noughts and Crosses).  

The game will run on any of the current TRI PLCs.  The program does not use any physical INPUTs or OUTPUTs. You could run it with a Nano-10.  The game can be played using the on-line monitor or using a touch screen HMI.  I'll put up the code for the Weintek HMI that I am using in a future post.

The game is written in 99.9% ladder logic.  It is a good demo of the use of PLC sequencers to implement finite element state machines.

I'll put up some documentation that helps explain my use of state machine design and the PLC sequencer mechanism.

I've attached the PC6 program to this posting.

Gary D*ckinson

13
Technical support / Update to i-TRiLOGI
« on: November 07, 2017, 06:25:15 PM »
I just tried to see if a new update to the i=TrRiLOGI software was available by clicking

Help->TRiLOGI Update  (from i-TRiLOGI V 7.12 Build 04)

This opened my default web browser  with this URL: http://www.triplc.com/TRiLOGI/Help/upgrade.htm

Unfortunately this URL cannot be found and my browser returned a 404 error.

I assume that things are in flux and I will check back later.

Best Regards,

Gary D*ckinson

14
Technical support / TIMER Contact Behavior
« on: September 13, 2017, 04:41:50 PM »
I have run into a ladder logic behavior that I can't quite figure out.
I have attached a screen shot of the entire program.

The middle rung of logic is a simple oscillator that uses a TIMER and it's inverted contact in a bit of a loop.  I am an old hardware guy and I'd describe this as either a relaxation oscillator or a ring oscillator.

My expectations are that once the TIMER runs out that it's contact would go active for 1 entire scan of the ladder logic and then go inactive for the SV period of the TIMER.

This contact behavior is consistent with both the simulator and my Nano-10 test hardware.


What I observe:
  • The TIMER counts down and reloads with a period determined by it's SV.  It oscillates as expected!
  • The TIMER's contact goes active and inactive and can be "seen" on ladder rungs before the TIMER.  As expected!
  • The contact appears to only be inactive after the rung with the TIMER.
The sample code has 2 simple pulse catches that sets RELAYs if the TIMER contact is ever active.  These RELAYs can only be cleared by restarting the PLC or via the online monitoring program.

Why can't I come up with a good story as to why the RELAY contact is not visible below the line of code with the TIMER, but is visible on the next scan to ladder rungs that come before the TIMER.

I am just getting too senile to work with this stuff???

Best regards,

Gary D*ckinson

15
Technical support / Parsing issue with bitwise not "~" operator
« on: June 16, 2017, 02:45:51 PM »
The bitwise not operator, "~", is not handled very well by i-TRiLOGI.

In an arithmetic expression the bitwise not operator is only must be the first thing in the expression to be correctly parsed.  If "~" is not the first thing in the expression, then "~" and the expression that follows must by grouped with parenthesis (I'm guessing that the expression parser is recursive and this why the use of parenthesis makes the unary operator appear to be the first operator since the open parenthesis).

OK. This works:
Code: [Select]
B = ~A & &hff      ' bitwise not compiles
This fails:
Code: [Select]
B =  &hFF & ~A      ' Error:Unknown Keyword: "~"
This will compile:
Code: [Select]
B =  &hFF & (~A)      ' OK

"Bitwise not" is a unary operator and should work on the numeric expression that follows the ~. But the design of TBASIC either got the hierarchy of operators (operator precedence) wrong or was never designed to handle unwary operators correctly. Unary operators should be right below the parentheses in hierarchy and not lumped in with other binary operators (&,|,^).

The negate operator "-" has the same parsing behavior issue as "~".  The negate operator is, also, a unary operator and only works on the numeric argument that follows.  It's operator precedence should be up with the "~".

In both cases, I don't think that you can fix TBASIC, now.  It is way too late.  But you could document the behavior and suggest that the programmer force the evaluation order by using parenthesis around most usages of the unary operators "-" and "~".

The documentation on Bitwise logical operators:
iii) Bitwise Logical Operators: logical operations is perform bit-for-bit between two 16-bit integer data.

There are a major problems with the documentation:
1. All operations are 32 bit not 16 bit for current FMD, Fx, Nano-10 style PLCs.
2. The ~ operator is a unary (not binary) operator and does not "perform bit-for-bit between two 16-bit integer data [values]".  The ~ operator acts on the numeric expression that follows and the result of the operation will be 32 bit.
3. The negate, "-",  operator is a unary (not binary) operator and does not "perform bit-for-bit between two 16-bit integer data [values]".  The - operator acts on the numeric expression that follows the operator.
4. TBASIC's expression parser cannot handle 2 consecutive operators.  if the second operator is - or ~ you must enclose this operator and the expression to the operator's right in parenthesis inorder to get TBASIC to properly evaluate the expression.
5. Mixing up the terms, bitwise, logical and comparison operators.  I think of logical and comparison operators resulting in a value of 0 and not 0.  Bit wise operators result in a 32-bit value with each individual bit being some function of the value(s) and the operator involved.

Best regards,

Gary D*ckinson

Pages: [1] 2 3 ... 5