Author Topic: Annoying High Speed Counter messages  (Read 10801 times)

skj1402

  • Newbie
  • Posts: 28
  • The Innovator!
    • View Profile
Annoying High Speed Counter messages
« on: August 24, 2005, 01:15:43 PM »
I'm trying to use the HSCDEF function in a Cusfn to enable me to count an encoder output, but I keep getting a message box come up repeatedly titled 'HSCDEF executed in Fn #n' that tell me that 'CusFn #n is triggered when HSCPV #n = n' (where n is any number that I maybe using).

A new one of these message boxes is generated every time the Cusfn is called so I end up having 100's of the things on the screen and in the end the programme just locks up through sheer saturation.

Is there any way I can stop these very annoying things coming up? Thanks! >:(

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Annoying High Speed Counter messages
« Reply #1 on: August 24, 2005, 09:35:07 PM »
You must have put HSCDEF in a function that is being executed all the time (a non differentiated CF? ). HSCDEF should only be executed once when you are defining the terminal count where an interrupt service routine should be executed. So please check your program to ensure that it is not being executed repeatedly.  

When using custom function, check that you are using the differentiated form {dCusF} and not the continuous form {CusFn}.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

skj1402

  • Newbie
  • Posts: 28
  • The Innovator!
    • View Profile
Re:Annoying High Speed Counter messages
« Reply #2 on: August 25, 2005, 04:35:51 AM »
Hi

Thanks for the explanation, however I'm still a little confused as to how these high speed counters actually do work, as there seems to be very little written up in the manuals to describe how you are supposed to use them, unless you have a 'quadrature application which I unfortunately don't.  
I know that they are independent of the logic scan time and can only be used from within a CusFn (or a diffCusFn), but does the Cusfn it resides within need to be invoked first to start the thing counting (providing there is a pulsing input to it)? In fact in what way is the HSCDEF instruction affected by the CusFn being invoked?

I've tried many different ways to use the HSCDEF (i.e.HSCDEF 1,1,20) and whilst in simulation mode placed a pulsed input on I/P 3 (which I understand is one of the two HSC dual channels 3,4,5 & 6), but when I monitor the effect of the HSC1 output in the 'View Integer Variables' box, the HSC1 output just remains at 0. Can you please tell me what I'm doing wrong?

Finally, in the manual it states there 8 channels that the HSCDEF instruction can use. Why 8 when there is only 4 physical inputs available i.e. 3,4,5 & 6.   Thanks.

skj1402

  • Newbie
  • Posts: 28
  • The Innovator!
    • View Profile
Re:Annoying High Speed Counter messages
« Reply #3 on: August 25, 2005, 07:29:26 AM »
OK, so I've just discovered, from scanning through earlier forum articles on similar topics, that it seems you cannot simulate an HSC input either, and this was verified when I downloaded my test program into the PLC and placed a hardwired pulse input to ch#3, and hey presto, counts were observed in the HSC1's 'View Integer Variables' box.
I must say that this sort of information would be very helpful if it were to be mentioned in the TBasic handbook (like a lot of other stuff I'm finding out about through trial and error).
It appears this limitation will impede the simulated testing of programs where HSC's are used, so is there any way around this? ::)

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Annoying High Speed Counter messages
« Reply #4 on: August 25, 2005, 11:33:45 AM »
In the T100MD+ PLC, the HSC inputs are mapped to input #3,4 and #5,6. These mapping are a result of the hardware design of the T100MD+ and T100MX+ CPU. Ideally the HSC input should be seperate from the physical inputs but in practice sharing them save cost and therefore enable us to offer the PLC at extremely low price.

On the other hand, the TBASIC is meant to be a generic programming language that we can use to support more than 1 family of PLCs.  So we did not want to encode the actual input mapping of the T100MD+ to the TRiLOGI version 5.xx.

In any case, the HSC input is supposed to be connect to encoders and therefore to properly increment/decrement the HSC, you are supposed to go through the phase A, phase B rising and falling edge in sequence. It is not easy to actually simulate it on screen. So we decided to leave it out. You can test the execution of the interrupt custom function associated with the HSC by connecting it in a ladder diagram to an unused relay bit, so during simulation, you can just click on the relay bit to execute the custom function.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS