cog usage question?
yarisboy
Posts: 245
I'm going to be using jw_freqin.spin to monitor frequencies on pins 0, 1, and 2. Does that mean that I can use counters A and B and cog zero and then would need to launch another cog and use A on it to pick up pin 2? I'll be reading a serial input and writing to two serial outputs. I'm using Synth.spin to generate a clock pulse for the serial outputs. I've never hit the limit on cog 0 yet but my program just keeps growing. With that many things going on I'm still a little fuzzy on when I need another cog and when I don't.
Yes, I meant jm_freqin.spin. Sorry
Yes, I meant jm_freqin.spin. Sorry
Comments
http://obex.parallax.com/objects/479/
Jim
How right you are. Jon Williams is an author name. Here he goes by JonnyMac. It runs in the background on counters looking for low to high and high to low transitions and returns the clock tics between the trigger points.
Your description of the rest of your stuff doesn't make a lot of sense. Are your serial inputs and outputs asynchronous or synchronous? Asynchronous doesn't need a clock while Synth.spin is not intended for use as a clock source for a synchronous serial stream. Usually that's included in the code for the serial data handling so it's synchronous with the data.
yarisboy, as mike confirms, it does launch a cog to measure the frequency. It uses both counters to measure one frequency so you will need 3 cogs for 3 frequencies unless you modify it.
Perhaps there are other objects for multiple frequencies.
When learning to walk, you crawl first.
Explain what you are trying to do as clearly and in as much detail as possible. For example, the 3 frequencies you are trying to measure, what is the maximum frequency expected and how often do you need to update it. Measuring 3 frequencies of a few KHz could be done in one cog, whereas frequencies in the MHz range might require 2 or 3 cogs.
Look in the OBEX for drivers. Even if there is no driver for your specific IC or function there is probably something close that will provide a good starting point as well as code examples.
The IC data sheets are your friend. They usually provide all the information you need to use an IC. If you do not understand all the details ask this forum, and please, provide details.
The speedometer at 50 MPH is getting a pulse frequency of 57 Hz
Neither of those applications is any challenge for the Propeller. The temp sensor can also be run at low baud rates. Its the perfect project-set to get a handle on the Spin fundamentals.
The Prop can run so fast that Op-amps left over from the BS2 stuff gives square waves if run slow, trapazoid waves on medium, and triangle waves on fast. My cheapy legacy chips just don't have the slew rate of the modern stuff. I'm just dazzled by the performance even with just Spin. Back in '69 my transmitter and receiver consisted of vacuum tubes. Whoda thought we would have such a cheap source of fun like this today. Once I've released the current objects I'll be converting them to PropBasic openly on the forum. They say to slow down alzheimers one must stay mentally challenged. This is my challenge. Then maybe I can draw Bean into the PITA club. (HeHe..)
In a year I may be able to challenge the Prop in PSAM or PropBasic with some high frequency applications but for now I'm having fun putting stuff on the Yaris that would have cost thousands from the dealer and at a BS2 level of difficulty. NickMaClick got me off the BS2 because it just costs too much.