count
adn
Posts: 17
Could you please help me with the code for the following...
I want to count external pulses comming into a pin of the sx28 for a period of 2.5 seconds and send the result over serial conection to a pc.
This needs to be done with inerupts and I am not very good with progamming. I am using the sx basic compiler.
Thanks
I want to count external pulses comming into a pin of the sx28 for a period of 2.5 seconds and send the result over serial conection to a pc.
This needs to be done with inerupts and I am not very good with progamming. I am using the sx basic compiler.
Thanks
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
The subroutine for counting needs to work in the backround and I dont how to do that. The serout is not a problem
Thanks
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
Available soon!! Video overlay(OSD) module...
"I'm a man, but I can change, if I have to, I guess"
Red Green
·
The max count will be 150.
What is the mimimum on and off time of the pulses ?
What clock speed are you using for the SX chip ?
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
Available soon!! Video overlay(OSD) module...
"I'm a man, but I can change, if I have to, I guess"
Red Green
·
I am using the 50 MHz resonator that came with the kit but I can use the 4MHz if it is better.
I am not sure about the mimimum on and off time of the pulses but the pulse is generated from a reed swich which is connected to a rotating mechanism of an anemometer. One rev is one pulse. I dont know if this helps...
Be sure to change the pins and baud to whatever you are using.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
Available soon!! Video overlay(OSD) module...
"I'm a man, but I can change, if I have to, I guess"
Red Green
I will give it a try and hopefully it will be ok.
Thanks again for your time
I fear that I have led you astray. I completely forgot about the RTCC input on the SX chip.
You can simply connect the signal to the RTCC pin and use this code with no interrupts...
Here is a much improved program...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
Available soon!! Video overlay(OSD) module...
"I'm a man, but I can change, if I have to, I guess"
Red Green
Thanks for your reply.
I am a litle bit confused now.
I need to perform some other calculations at the same time and thats why I was thinking that I had to use interrupts. I can not use the pause command ... so I believe the first program is better.
Is this correct?
Thanks
The RTCC input is made to count pulses, it's the way to go.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
Available soon!! Video overlay(OSD) module...
"I'm a man, but I can change, if I have to, I guess"
Red Green
·
Oh well, go ahead and use the original version...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
Available soon!! Video overlay(OSD) module...
"I'm a man, but I can change, if I have to, I guess"
Red Green
·