Hi,
I need to write a counter code to count the number of spikes in the TTL logic input signal... What should I take as an input... Can i write it normally by putting the count in an infinite loop like
while(1)
// increment count
exit(1)
something like this... or is there a different way of doing this.
J
What has your instructor or teacher advised you to do? Do you have any notes.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
I would suppose it depends on how the pulse generator is sending the signals -- out its RS232 serial port ? If that is the case you will have to attach an rs232 serial cable to your com1 or com2 port and listen for incoming data on the computer side. Most likely it will be just a change in state of one of the pins instead of incoming data. Its been over 10 years since the last time I have done that so I would have to research some very old code, if I still have it, to see how that is done. One thing for certain, you will need a 16-bit compiler such as Turbo C that will allow direct access to ports. You might also need to do a little assembly language.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
how is the pulse generator connected to the computer?
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
is the pulse generator going to actually send data to the computer or just change the state of one of its 32 pins to on and off ?
Please read this site
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
You keep asking the same question over and over. Unfortunately, without knowing what the data looks like (as all responses have tried to ascertain) there's not much we can suggest. Figure out what the data looks like to the program, then the way to count the pulses will become apparent.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
It's best if you just ask the manufacturer of that board. Not very likely anyone around here knows the answer.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
you will need a 16-bit compiler such as Turbo C
You could better use your own compiler and look for inpout32 .dll which gives you direct acces to ports in XP.
using an RS 485 cable
So a 2-wire protocol? You could use one of the five input on the parrallel cable (like the error bit) and test on that
Nick Evan
Not a Llama
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403