High frequency pulse counter troubleshooting

Could you please describe working mechanism of high frequency pulse counter. After one pulse it get large random numbers.
Does it work based on rising edge or counts cycles in closed state?

Each transition through open circuit to closed circuit will cause a pulse. Be sure you are workign with dry contacts. If you are working with PNP or NPN type transistor type, or hall effect sensors you can try with reversing the polarity. Let me know what device you are using. and I can offer better suggestions.

Be aware of contact bounce as the dry contact closes, if you’re using a wire to open/close the inputs this could add noise to your results.

Dear Maurice,

I use T3-BB-ARM with the latest firmware, input number 29 (high speed) and range Counter 100Hz.
After a shorting of input (it is dry contact) I receive as a value something like -22121 (with a minus). After a second shorting value changes to positive one and so on.

Fixed high speed counter in rev49.5. High word and low word are inversed in recent version.

Thanks a lot! Works!

How to reset the counter from ModBus?

You should be able to just write to the value with a zero. Give it a try and report back. I am traveling just now or I would try it for you.

Maurice Duteau

Unfortunately it is read only. There is no reaction after writing to register 7547 (UI32 on T3-BB Arm).
And I think it could be much better not to multiply counter value by 1000 in ModBus registers. In DWORD type we have 4294967295 values, I think you use DINT divided by two WORD so it will be 2147483647. After multiply by 1000 it allow us to have just 2 147 483 results in counter.

I will have to ask Chelsea to reply here, you’re really pushing us here but that’s OK Philip. We want to make this equipment as useful as possible on your projects.

Dear Maurice,
Sorry, don’t want to push on you. :slight_smile:
It will be enough to give a possibility to reset the counter from the ModBus by somehow.

You should be able to write zero to the modbus register and it will accept the new value. Give it a try and report back.

I tried again and again without any success. Please check attached screenshot.

Could you try with the T3000 application for a start. Once we see that you can in fact zero it out with the graphical front end then we can work on the modbus method. I have forwarded this to Chelsea and she will also be checking in shortly.

In T3000 there is no possibility to enter any value when the port in Auto mode.

Dear Maurice,
Please check attached image. If I set Manual in third column the fourth one become editable. But in other case it cannot be edited. As far as I remember input cannot be operated in Manual mode. Or i’m wrong?

Yes, put it to manual and type in a zero to zero it out. Then put it to auto and it should start incrementing from zero.

:slight_smile: Yes, I know how to do it manually. But this is not a solution to reset it every day manually.
I even can switch it to Manual mode through the ModBus to reset it after. But since there are a lot of communication over RS485 my polling period is 7000 ms so the counter will be steady for three polling periods which means 21 seconds when counter will be unworkable.

I believe there is a register for setting i/o to auto/manual in your program. I don’t know the register off hand but you can use the T3000 → tools → Modbus register viewer to search and find the register. Once you have that you write the input to manual mode and then set it to zero every time you need it from your external master controller.

You mention you are having troubles due to heavy polling. If you need something to happen quickly when the counter hits a certain value you could consider using one of the T3 controllers, they are programmable and could act immediately on seeing some pulses or whatever’s going on in your application. The relevant output should be on the same controller as the input pulse is wired to otherwise you’ll still have a small delay as the information gets sync’d over the network.

If you tell me more about the application I can make better suggestions.

Maurice

I use T3-BB and other your devices as IOs for Codesys running PLC because I have a huge integration with other systems and protocols. I have more than 30 RS485 nodes devided by 3 segments. Each node has a lot of IOs so it take long time to read and write everything (since your devices don’t support 16 function in Modbus it takes more time).

In order to reset the counter I have to send a command to change from Auto to Manual it type. Then after one polling cycle I have to send a 0 there. And then after another cycle move it back to Auto. So it will take 3 polling cycles while the counter will not count anything.

Interesting project.
Let me know more about the “16 function in Modbus”. We can implement that, no trouble.