Sign in to follow this  
Followers 0
benbrad

High Speed A/D Sampling

10 posts in this topic

I don't know whether a PLC can do this but.... I'm using a CJ1M cpu23 with an AD081 v1 and I want to record the operation of a high speed valve with a 0-10v return. The valve travels from closed to open in 4ms. Currently I have a little IRQ doing the work and the recording at high speed isn't a problem but the sampling of the A/D is. At present the command to open the valve is issued and immediately followed by a record loop but the figures recorded are those of closed valve even though the valve is opening as the recording is happening. What am I missing? Do I have to allow the PLC to do a full cycle before it refreshes the A/D? Does the A/D have a flag to say it's just sampled? I've included my little routine in the hope that someone on here can see my mistake and put me straight. Many thanks in advance, Ben Valve_response.cxp

Share this post


Link to post
Share on other sites
benbrad, Attached are the specs for the CJ1 Analog Inputs from W345 manual. Response time of the module will depend on module setup (1ms / 250 microsec). Note 10: Yes the value is only updated once per scan. Hope this will help. CJ1_AnalogIn_Specs.pdf

Share this post


Link to post
Share on other sites
Cheers gtsuport, I'd overlooked note10 in the pdf, guess I need to have a bit of a rethink on this one.

Share this post


Link to post
Share on other sites
Hi Ben, You could make the PLC do an IO Refresh (use the IORF ladder instruction) every 1mS using a timed interrupt ... ?? You can also disable the 'cyclic' refresh of the analog (SIOU) unit in the PLC settings, and then perform a refresh when you wish (eg timed interrupt). The IORF function can be used just to refresh a particular SIOU (analog) unit. Have a look also at the CJ1W-SPU01 data logging unit also. Just some ideas ... Nibroc

Share this post


Link to post
Share on other sites
Hey Nibby.... His original topic title was 4kHz ... = 250 uSecs.... / sample which would give him 16 samples over 4ms...

Share this post


Link to post
Share on other sites
Hi Sleepy, (haven't been around much lately, although I keep an eye on the forum and note there are many valuable contributers to this great forum ) Was just trying to provide some food for thought: A/D can be set to 250 micro seconds. A/D can have cyclic refresh switched off (PLC settings, SIOU refresh off selected) PLC can have timed interrupt which could execute IORF to A/D unit every 100 micro seconds, and store the value (will get approx 40 samples is 4mS, however a max of 16 different values possible) Although I understand that the PLC reads (refreshes) the A/D only once per scan under normal settings, I though it may be possible to refresh more often ... Just a thought .. Nibroc Edited by Nibroc

Share this post


Link to post
Share on other sites
Good to see your back mate... Am i to assum that when you said 1mS u actually meant 1uS... Always have appreciated your responses...

Share this post


Link to post
Share on other sites
... oops, no - I did mean milli second, (I should read the post properly ) - thanks sleepy. however I agree this is not fast enough. The fastest setting for a timed interrupt is 100 micro seconds, which is fast enough. (although I would definately do some testing to prove this as a solution - is only a suggestion at this stage) Nibroc

Share this post


Link to post
Share on other sites
Cheers guys, I've re-written it now to shut down all processes except for 3 lines of cyclic code that does the record. I'm hoping this should cut the 5ms cycle down to under 1ms and if I can get near 8 samples I'd be happy. As yet it's not tested but fingers crossed it should get me somewhere close. Ben

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0