Click here to Skip to main content
16,017,986 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am currently on placement in a print company. We have large printing presses that run at high speeds. The operations manager would like a system that compares the actual run speed of the machine to an optimum run speed for the particular job they are printing. This is stored in an excel spreadsheet with job number fields and a run speed field.

The project consists of a set of red and green lights connected to an APCI-RELAY8/IN8 Card in a PC and the other end to a sensor on the machine that sends a high pulse.

Ultimately what I need is to read a count from the sensor in a short amount of time (possibly 10 seconds) and convert that into a pulse per hour value. This then needs compared to a selected job number from a table which has a corresponding run speed in pulses per hour. If the reading from the sensor is higher than the value in the table then we need to output a 1 to the output register to produce a green light and if lower a 0 to produce a red one

A few things…

The problem is that I am not sure if the card can read a count as when I read from the opto - isolated input using the sensor it gives one value for on and one for off, not a count.

Is the solution workable in MS Access or would it be a VB executable?







This is what I have so far

.zip file containing drivers, sample code and a useful help file for the Relay card

Excel spreadsheet containing data

Manual of the relay card



Thanks

Jeff McKee
Posted

1 solution

It's not a straightforward answer: "Access" or "VB" - there are a number of factors you need to consider:
1) How fast are these pulses coming?
2) How wide are these pulses?
3) Can you configure the card for interrupts? If so, can you specify rising or falling edge detect interrupts?
4) Can the card be configured to count pulses?
5) How accurate do you need to be?

This is realtime data: you are trying to process it with non-realtime code. If you need to be accurate, or the pulse width is narrow, then you may be on a loser. Check the manual: you want to offload as much of the processing to the card or it's driver software as possible, before you even start to think what kind of front end software to use!


"The max is 130000 pulses per hour. does this help?
I am a rookie."



That's ~37 pulses per second: that means that assuming the pulse waveform is 1:1 (i.e. up as long as it is down)
_____       _____       _____       
     |     |     |     |
      -----       -----
Then every pulse has a duration of 0.01 seconds: you have to poll the level detector at a minimum every 0.01 seconds (or 0.005 seconds to be safer). Unfortunately, detectors tend to not be 1:1 - waveforms normally look like this:

_________   __________   ______
         | |          | |
          -            -
Which means that the pulse you are trying to detect is a low level and very short. Very, very short. So to catch it accurately using polling on a level, you have to poll at least twice during the duration of each low pulse. Not easy to do in a non-real time environmment! (With Windows, it could be updating the screen when you want to check the level, so you get delayed and miss it)

Check your board documentation: see if the driver can do the detection for you, and if so, what kind. There is a good chance it can detect rising/falling edge and possibly count or time the pulses as well.
 
Share this answer
 
v2
Comments
jeffacake5 9-Jun-11 5:08am    
The max is 130000 pulses per hour. does this help?
I am a rookie.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900