×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Need help to make a programmable timer...

Need help to make a programmable timer...

Need help to make a programmable timer...

(OP)
Basically, I'm bothering because I want to make a programmable timer...
Here is the figure:

The timer must have three buttons: Two of them add a different, programmable number of minutes to the count on each press. The third one resets the counter to 0. As long as the count is not 0, the output is 1.
It should have a 3 digit display to see the remaining minutes.
The number of minutes to add can be programmed with jumpers.

Do I need to use a pic to make this? I saw the 4510 is a nice candidate to do it, the problem is that the counter is not cumulative, it just resets to preset value...

Any ideas?

Thanks!!

RE: Need help to make a programmable timer...

Well, you don't have to use a PIC to make it, but some type of microcontroller will certainly make it an easy task.  It depends on your needs (size, power source, quantity, environment, budget, etc).

RE: Need help to make a programmable timer...

(OP)
I can use a 555 for the timing, a 4510 for counting, and a 4511 for the display... that's perfect, the thing is that it doesn't "add" the preset minutes to the countdown... it just sets the counter to the preset minutes and starts over the countdown...
It is possible to do this "adding" thing without a PIC?

RE: Need help to make a programmable timer...

Why are you trying to avoid the PIC? Or any microcontroller? Get yourself a Basic Stamp. They are child's play to work with and you will have all functionality you need.

They are costly for a product. So if you are doing 100+ units, a PIC or other micro is what you should use. Nothing else is possible if you look at functionality vs cost. The situation where you need to add a twist to the basic function - or add a new function - will be much nicer if you do it in a micro. And it is not at all difficult to do the job. Give yourself a couple of weeks to get the fundamentals. And you will have your functions quicker than you can say "PCB with CMOS ICs"

Gunnar Englund
www.gke.org
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...

RE: Need help to make a programmable timer...

You can do it in a big enough PLD.

TTFN



RE: Need help to make a programmable timer...

(OP)
The thing is that I know 0 of PIC programming, that's why I prefer discrete components...

RE: Need help to make a programmable timer...

As I said: Just start using them. That's how everyone else have started. It is not something you are born with. And your timer is a very good project for a beginner. Not too complex. Very straight forward.

Gunnar Englund
www.gke.org
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...

RE: Need help to make a programmable timer...

Marton, I completely agree with Skogsgurra.  I suspect that you can learn enough BASIC to provide the functionality that you're looking for in a very short time.  Your resultant circuit will have fewer parts, be easier to debug, and much easier to add or change features.  

RE: Need help to make a programmable timer...

You will be disappointed with the 555 etc etc route. Especially when you start talking about displays and adjustability.  No engineer  would go that way.. the Low Road.

Keith Cress
Flamin Systems, Inc.- http://www.flaminsystems.com

RE: Need help to make a programmable timer...

(OP)
Thanks for all the suggestions. I program a little of C so I think PIC-C is the way. Will I have to use interrupts or anything like that? I see that far too complex... And I've been Googling for hours and could not find any timer examples in PIC-C... And delayms(1000) at the end of the loop to wait one second is not the way because I will need to read the switches all the time... It will be a loooong trip I believe...

RE: Need help to make a programmable timer...

I don't think anyone bothers to put PIC example code up on the Web because MicroChip will bury you in it for the asking.

Mike Halloran
Pembroke Pines, FL, USA

RE: Need help to make a programmable timer...

Hiya-

As the other gentlemen have suggested you might start with a PIC or maybe an ATMEL microcontroller.

I've added comments to one of your latter posts:

>Thanks for all the suggestions. I program a little of C so
>I think PIC-C is the way.

You might also look at cc5x (google for it).  There is no cost for your first professional project, free if you just keep it in house.  I have used this product and found it easy to use and I believe, there are examples of interrupt programming in the documentation.  If you keep your object modules to less than 1K, there is no problem.  Linking 1K object modules together is a little trickier and the documentation is not that clear, but I'm pretty sure that you can complete your enitre project within 1K.


 >Will I have to use interrupts or anything like that? I see
 >that far too complex... And I've been Googling for hours
 >and could not find any timer examples in PIC-C... And

You could do it without interrupts.  If your loop timing is
within the range of the timer resolution you set, you can just sit there and poll the timer expiration.  When that happens, go and update your counter for timing.  Now, if you want to multiplex your display, you don't want to do that.
Just check your timer expiration, then branch off and check your display update timer, check your pushbuttons etc.

 >delayms(1000) at the end of the loop to wait one second is
 >not the way because I will need to read the switches all
 >the time... It will be a loooong trip I believe...

As mentioned, just poll the timer. If "popped" then service it, otherwise, go on and check the pushbuttons.

Or you can mix and match.  You can poll for the pushbuttons,  poll for the timer, and interrupt on another timer for the digit display.

As an aside, I did my FIRST pic project as an enlarger timer with two digits and a couple of up/down pushbuttons.  Also had stored the timer value in EEPROM on the chip.  I have only a two digit display and it only does seconds from 0 to 99.  Did it in assembly.

I might suggest starting with small little portions of the project and stitching them together. Like start with the display and see how that goes.  Then maybe add a 1 second timer.  Then output the incrementing time to the display.  Then work on the pushbuttons.  I suggest this as an approach as the pushbutton debounce can be a bit tricky for someone that hasn't done a lot of real time programming.

Of course, you could do this all with an ATMEL brand of microcontroller.  I just started out with the PIC and haven't had a need to change.

Last week, I wanted/needed an RS232 to 4 digit LED display. I started the project last week and its finished as of Sunday.

The nice thing about doing the learning curve is that after you have gone through the experience, you have gained such a  usefull tool!

I did not go through the basic stamp route due to cost and prior experience with real time programming on other micros. The cost of my "middle of the road" pics is around $2.00 in quantity 25.  Yep.  I buy them in that price break.  I've got them on hand for little tasks like the one mentioned above.  You don't have to do that of course.  In fact, I think that Microchip will still send you some small number of them for FREE!  I did it but, it took awhile for them to show up.  I had ordered some from Digikey at the same time and the Digikey came in much quicker.  A couple of them at first will get you by.

The other things that I suggest you have are:

1. Programmer. I built my own first one.  Google for them. Even if this is a home project you might want to save yourself the hassle and buy a kit rather than trying to wire  up a protoboard.  Just my experience.

2. One of those little push in prototype boards. I find this useful for whomping up little portions of the project and starting the coding effort quickly.  They have a tendancy to be a little unreliable, but it's very quick for making changes.  I use solid copper wire from phone company cables (the 25 pair type) as interconnect wire.

3. Logic probe. I debugged the enlarger timer with just that. An oscilloscope would be much nicer sometimes.  And a logic analyzer too.  But we're talking some serious bucks here.  Oh, before the logic analyzer, I found a PC parallel port logic analyzer.  It was horrible, but it did give some semblance to the order of things.

4. A colletion of 1/4W resistors in the following values:
330ohms, 470, 1K, 5K, 10K. These usually will get you by for the digital side of things.  Some 0.01 microfarad bypass caps. A collection of LEDs.  These can be used as debugging aids.  If you don't have a fancy single stepping emulator/debugger, you can have the LEDs act as "you are here" printf type debugging aids.

5. Power supply of some sort.  Sometimes you can just find a 5V DC wall wart and you are set!  Other times you might have to put a small linear voltage regulator (with an optional full wave bridge rectifier and filter cap) on a wall wart.  You typically can get by with 100ma or so for the digital portion of it.  Maybe a 1A if you want to drive some relays, etc.  Look around the house for one that went to a discarded  electronic appliance. Honest, I *STILL* use the little linear 1A supply that I made in college 30+ years ago!  It's a little "bud" box with a 7805 in a TO3 package.  A Radio shack transformer and a fuse that if memory serves me well, was sleeved with a plastic soda straw.

6. A digital multimeter or VOM,  makes life easier and they can be had from Harbor Freight for $3.99 on special.

That's about all that you need to get started.  I've prattled on long enough.

Hope this helps to get you started!

 Cheers,

  Rich S.

RE: Need help to make a programmable timer...

Hear! Hear! Just what I wanted to say.

A few quotes:

"You could do it without interrupts.  If your loop timing is within the range of the timer resolution you set, you can just sit there and poll the timer expiration."

"The nice thing about doing the learning curve is that after you have gone through the experience, you have gained such a  usefull tool!"

And. By setting up a simple Finite State Machine, you can do lots and lots of things seemingly simultaneously. Even with a slow and simple processor. The idea is very simple (and the implementation even more so). Draw a stae transition diagram (sounds more compliceted that it is). Number the states and write conditions for changing states. Then just code on. A beautiful and powerful technique. You can even have several FSMs running in parallel in one processor.

PLS for Rich

Gunnar Englund
www.gke.org
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...

RE: Need help to make a programmable timer...

(OP)
Rich, many, MANY thanks for your kind explanation!!
I have most of the stuff from your suggestions (the only one I do not own is the o'scope which is @ work).
The one thing that will make me suffer at least when starting to program those tiny things (I think) are the timers... for most of the other stuff, I've been reading an excellent tutorial made in my mother tongue (spanish) and it helped a lot. It has many examples of how to drive a display, and do the 'strobing' for more than one, so that's more than a nice start.
There's even more. I found a project that "almost" does what I want:
http://www.interq.or.jp/japan/se-inoue/e_pic6_3.htm
Its operation, circuit and code are MORE THAN WELL explained.
I will need to modify it so instead of having it started at the count set by the dip switches, it just ADDS the count set by the dip switches. I can add one more switch to the free leg of the 74HC138, and gain one more input if I need it, by removing one of the displays (I only need to count the minutes, in three digits).
As it is now, it can count to 99 minutes and 59 seconds... so by applying the previous change, I will need to modify the code to allow from 1-999 minutes and make the seconds count internally.
Going back to the timers, if I'm right, each instruction takes 1msec to execute? I see on many examples that there are many NOPs one next to each other, to generate a delay... how do you calculate that stuff? I mean is it THAT critical? I think that if I add too many lines of code, Wouldn't I screw up the 'second' counter?
I guess that's the "tricky" part about the microcontrollers... the instruction set is not 'that' big so it shouldn't be hard to learn how it works...

Many thanks again!!

Marton

RE: Need help to make a programmable timer...

For PICs, the internal instructions run at 1/4 the clock rate.  If you use the internal 4 MHz clock found on most PICs, then yes, one instruction will be 1ms in length.

It can be critical, but not necessarily, it all depends on how you set up your code.  For example, let's say you run a tight loop that needs to use up 20ms to time your minutes out (neglecting interrupts for the moment).  If you mistakenly use only 18 instructions, your timer will be off by 6 seconds for every minute it tries to count, which can add up.  If you use timer interrupts, you set a register value once and forget it, no need to worry (too much, anyway) how much code you write (within reason, of course).

The trickiest part about PICs (or any new micro, for that matter), is getting the part set up correctly.  An incorrect setup can make a fully functional part act like a door stop.  Starting with a known-working program for that particular chip is a good way to get past that stage, then make changes one at a time to the setup to make sure you're not breaking anything.

Dan - Owner
http://www.Hi-TecDesigns.com

RE: Need help to make a programmable timer...

I think there is a mixup. The 4 MHz PIC needs 1 us (microsecond) not ms (millisecond). So it is one thousand times faster than said.

If you saw NOPs to adjust timing, I can only say: Burn that book. That is very bad programming. Either poll a timer or use interrupts. Polling a timer is less critical, if you worry about interrupts.

Gunnar Englund
www.gke.org
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...

RE: Need help to make a programmable timer...

The earliest, slowest BASIC Stamp runs at ~2000 instructions per second.  PICs are much faster.  

Please, do not even try to set program timing with NOPs, loops, and instruction counts; it's a waste of your time, that's what hardware timers are for, and they're not hard to use.

Get a Microchip CD, load the simulator, and work through a few application notes.

Mike Halloran
Pembroke Pines, FL, USA

RE: Need help to make a programmable timer...

Hiya-

O.K. now for the bad side of things.  The 16F84s needs an external timing device to operate.  Some of the newer chips
have internal oscillators that can allow the devices to self clock.  HOWEVER, I have found that the internal oscillator is somewhat temperature dependant.  

I did a "geek clock" (bcd with descrete LEDS) and used the internal oscillator and it lost or gained time depending on the season.  Even in the air conditioned office.

This might not be a problem for you, just something to keep in mind if you want to do a time of day clock in the future.

Now, onto your other questions.  First, might I suggest that you look at one of the newer PIC chips.  The 16F84As have been replaced two generations ago with the counterpart of a 16f648A.  IT DOES TAKE A DIFFERENT PROGRAMMER AND YOU HAVE TO ADD TWO MORE INSTRUCTIONS IN THE STARTUP CODE.  Yes, I did have to shout that (sorry).  The 16F648A has a full 4K of program flash memory, and many more "general purpose" registers (RAM).  It also has another timer or two.

There are 4 digit displays out there and they can be used. They are available in both common anode and common cathode versions.  I believe from the schematic that they use a common anode device.  I might suggest a search for 4 digit (or 3 digit) common anode devices that have only 12 pins on the device.  Will save a LOT of wiring if you are going to do this via the protoboard method described in the web page!

Even doing a home built PCB (Like I do.  4 digits times 8 or  9 pins (with the decimal point), is 36 holes to drill versus the 12 the other displays have.  Tip.  The displays that I am talking about are 0.6 inch width pinouts with 0.1 inch between pins on the same row.  Get like a 24 pin wide socket we use for static ram or old Eproms and cut it half for the socket for the display.  I suggest using machine pin  sockets for this.

Yep, the circuit is a pretty straight forward implementation.

Now, as to using timers.  Well, the simple example of doing a counted delay loop is all well and good if all you are doing is waiting.  But, for this timer, I don't think that you desire to have the display go blank and show up for a brief spurt every second or so.  

You should expect to have to change the display and show each digit about 50 or 60 times each second.  Otherwise you might get flicker in the display.

O.K. that being said, we have to be doing something else while we are timing.  So, we have to have other code executing.  That code (most likely) will have one or two or  (many) more branches in it.  Each one with its own different execution time as the microcontroller goes through it's code.  Therefore, it gets a tad bit complicated trying to figure out the timing variations in each code path.

I strongly suggest that you bite the bullet and learn to use the timers.  You don't have to have them interrupt driven.  The interrupts on the PIC timers can be disabled and one's code can poll the timer rollover bit to determine a fixed length of time.  Please note that these are "up counters" and will "pop" as they roll from FFFF (or FF) to 0000 (or 00).  So for a shorter time, put in a higher integer value into the timer/counter register.

You can also partition the problem.  Try doing a one second timer example bit of code with a simple LED that turns on,
starts the timer and turns off.  Or, better yet, get it to toggle (if it's on, turn it off, if it's off, turn it on) and get the LED to blink at the one hertz rate.  That will get you the confidence of getting the timer operation to work more or less as you expect.

Of course, this is AFTER you get the PIC set up correctly as  macgyvers2000 has said.  Here a little delay loop blink first to get your toolchain and configuration words set up will get you over the first and biggest hurdle.  Sorry, I should have had this paragraph much earlier.

After you get both the delay loop blink program and the timer blink working, then might I suggest that you get the multiplexed display working.  Just put in fixed values for each of the digits.  For example, see if you can get the display to show a 00, then a 01, maybe a 12, then a 34, etc.

After you get the display working the way you want it to, now you have a real good debugging tool in its own right.  You can for example,  read the BCD switches and display them on the leds.

You can check your BCD arithmetic, take a couple of sums and  put that on the display.

Check your timer counting logic and display that.  Start off  at a preset value and count up (or down) once each second.

Put those all together and you have your program!

Oh, and you can keep all 4 digits, if you want.  There is a spare output on th 138 (y3) that you can use like the start button.

And instead of the "point to point" wiring that they used in the project, might I suggest that you look into wire wrap and a resistor netork.  You might also find some diodes in a   16 pin pack.  Or at least descretes soldered onto a 16 pin header that fits in a wire wrap socket.  I think that you will find the assembly much easier. I KNOW that there are some integrated circuits with PNP transistors in a DIP package (I just can't remember them off hand, sorry). Maybe someone else has a part number handy.  Indeed, you can get DIP switches and use them in place of the rotary BCD switches that are used there in the web site.

Just some suggestions.

Well, I see that I've prattled on long enough AGAIN!

I hope that this gives you some food for thought.  Now, with some thought, we might be able to reduce the parts count somewhat, but we can do that after we get this one done.

Best of luck! Keep us posted!

  Cheers,

   Rich S.

RE: Need help to make a programmable timer...

Gawd Rich!! Why don't you just build it and mail it to Marton!lollollol


You could've fixed your geek clock.  You use one more output to a resistor and an input to control the temperature of the CPU.  You just keep it at five degrees more than any expected ambient and Wha-law!  No more drift.  You could even brag about your "oven controlled oscillator" as found on really high end 'reference' stuff.

Keith Cress
Flamin Systems, Inc.- http://www.flaminsystems.com

RE: Need help to make a programmable timer...

To make the timing loops easy, in the mplab simulator,
use the stopwatch. It gives the time and instruction cycles.Its under the debug menu. The logic analyser
is cool too.

RE: Need help to make a programmable timer...

Hi Keith-

Yep.  Well, I had a couple of extra pins on the pic that I didn't use, the crystal inputs. I didn't have a 4MHz rock sitting around.  I think I even put traces on the board for the rock.  I had it taped to the edge of my bookcase at a client's for awhile. It (and it's wall wart power supply is sitting in a box somewhere).

I just picked a little project to try out the cc5x without the pressure of having it perform.

It was/is kinda cute.  You've seen them before I'm sure with each digit represented by 4 leds.

I just wanted to play with the compiler and see how it performs.  And for free, it does quite well!

Anyway, the little geek clock uses the PIC, a 5V linear supply and 4 resistors, and two pushbuttons.

That's half the fun with the PICs.  To see how little else in support hardware that you need to get the job done!

Oven controlled microcontroller. Hummmmmmm, I see a lot of melted plastic DIP packages in that future...... winky smile

I'm glad that Madcow mentioned the simulator and stopwatch. For "determining" the time value, I often times get lazy and just load up a value, fire it off and change the value until the time on the stopwatch says the time period that I want.

In fact most of the design could be simulated.  At least the fussy stuff like the timer operations.

As to mailing it to Marton79.  No, where's the fun in that? How can he learn to use microcontrollers without rolling up his shirt sleeves and getting his hands dirty! The timer is a great "starter" project.  

And gee, guess what? I just finished a little low cost design that takes the serial "rs232" input and outputs it to  one of the 4 digit 7 segment leds I was talking about earlier!  It too only uses a small number of parts.  With 5VDC input, it needs only 7 resistors, one transistor, and a  bypass cap.  AND the hardware will work with either common anode OR common cathode displays!  I'm whomping up an article that I'd like to present to N&Vs.

Yep, it's fun to see how little extra stuff you need to get things done with a PIC.

Enjoy!

  Cheers,

   Rich S.

RE: Need help to make a programmable timer...

Wow!

From the app note:
"The Darlington is connected across the supply and initially draws 140 mA...
At about 90°C the current through Q4 appreciably increases and less drive is applied to Q1 and Q2. Power dissipation decreases to whatever is necessary to hold the chip at the stabilization temperature. In this manner, the chip temperature is regulated to better than 2°C for a 100°C temperature range."

"Temperature Stabilizer Power Dissipation(25°C) 300 mW."

Some serious heat being generated there.

As an aside, on the piclist today, a new (student?) engineer was wondering if his "oscillator block" should be running a "little warm".

Now, I've got some oven controlled crystal oscillators that draw 12W warm up and the spec sheet says that they say the continuous power is right around 2.7W...

So, I guess it's all relative.

  Cheers,

   Rich S.

RE: Need help to make a programmable timer...

(OP)
Hey Rich,

Thanks again for the tips! Those about the displays are really useful because in fact it saves from doing a lot of wiring.
And that of partitioning the project in sections, program them one by one and then put them together is definitely the way to go.
I will see what I come up with...
I think I saw the first "issue to think about":
Instead of a "Start" button, I want there to be two buttons: X adds X minutes and Y adds Y minutes to the count whenever you press them so, will I be able to add minutes when the countdown is in progress? Because the PortB is used as inputs only when the counter is stopped... Or it is possible to do everything at the same time?

Regards,
Marton

RE: Need help to make a programmable timer...

You will be astonished at the complex behaviors you can get from a PIC with trivial changes in programming.

... some of them will be intentional.  winky smile

Mike Halloran
Pembroke Pines, FL, USA

RE: Need help to make a programmable timer...

Hiya-

You can switch between "outputting digits" to reading the switches while the counter is running.   There is nothing to prevent you from doing this.  It's just a matter of programming.  And as MikeHalloran states:

"... some of them will be intentional."

Just do little bits at a time and you will get there.

  Cheers,

   Rich S.

RE: Need help to make a programmable timer...

Quote:

... some of them will be intentional.  


How very true... clown

RE: Need help to make a programmable timer...

What you could do is to put a button commuting between two resistors in the RC network of the 555. One resistor would time 1 second or the interval you use as a base, and the other would time a shorter time in order for the clock to go forward faster.

RE: Need help to make a programmable timer...

The last time I used a 555 was to infer the position of a pot, for a uC (8741) that didn't have an analog input.



Mike Halloran
Pembroke Pines, FL, USA

RE: Need help to make a programmable timer...

Sorry, never caught the "ms" mistake... should have been "us", obviously.



Mike, programming beyond page boundaries without making the code aware is a great way to make small changes have big effects ;)

Dan - Owner
http://www.Hi-TecDesigns.com

RE: Need help to make a programmable timer...

Screwing up the PCLATH is one of my favourite ways to introduce a bug in PIC programs... what a wonderful machine it is... clown

RE: Need help to make a programmable timer...

s'ok, I started a new position this week and my first project is with a high end ARM from Atmel.  Talk about an odd architecture... one register to set bits, one to clear bits, and a third to read the status of those bits.  EVERYTHING is set up like that!  Never used an ARM before, not sure I would want to again if this is what they're like.

Dan - Owner
http://www.Hi-TecDesigns.com

RE: Need help to make a programmable timer...

Dan,

I have been using the ARM architecture for years. The Philips LPC 2106. And I love it.

I had exactly the same reaction as you have. It takes a lot of "debriefing" and some serious studying to get a feeling for the architecture. But when you have that feeling, it is just as efficient (more so, I would say) as other architectures where you toggle or mask bits.



Gunnar Englund
www.gke.org
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...

RE: Need help to make a programmable timer...

I managed to control some LEDs and the LCD backlight earlier today... go me ;)

Dan - Owner
http://www.Hi-TecDesigns.com

RE: Need help to make a programmable timer...



I know the feeling..
 
Happy you landed a spot.  Nice work.

Hey what kind stuff do they produce at your new company?

Keith Cress
Flamin Systems, Inc.- http://www.flaminsystems.com

RE: Need help to make a programmable timer...

You know those cool in-car video shots at NASCAR races, waterline shots at The America's Cup, or most of the on-the-green golf shots?  We make the camera and RF transmission systems.  I was hired on to help with the upgrade to high-def broadcasts.  Cool projects, but I get most easily frustrated when trying to get a new architecture up and running.  Once I have the basics up and running I'm golden and work typically progresses quickly, but I'm still in the "get it running" stage.  Hopefully it won't last too much longer, I don't want to get too frustrated and go postal on the dev board ;)  It seems I have the OS up and running (I see the idle task popping away), but can't get the USART to talk yet.

Dan - Owner
http://www.Hi-TecDesigns.com

RE: Need help to make a programmable timer...

BTDT, not with an ARM.  I wonder if it has Intel-style USARTs, that like to be initialized _real_ _real_ _slow_, because the baud clock is used to carry the initialization codes in to the registers...

Mike Halloran
Pembroke Pines, FL, USA

RE: Need help to make a programmable timer...

Oh yuck!! I didn't know THAT was why they were so slow.. Actually makes sense though now that you've explained it.

OS? So you're running an RTOS huh.. Why isn't it covering the UART initialization?

Do you have the baud clock running or piped into the UART?

Do you have to clear some flag to start things moving?

BTW sounds like a fun project you're into.

Keith Cress
Flamin Systems, Inc.- http://www.flaminsystems.com

RE: Need help to make a programmable timer...

Sorry to be such a bore - go for FORTH. It takes care of so many of the details. And it is a breeze to work with.

Gunnar Englund
www.gke.org
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...

RE: Need help to make a programmable timer...

skogs you should know better!  Only true acolytes of the True Way can utilize the  Language.

Keith Cress
Flamin Systems, Inc.- http://www.flaminsystems.com

RE: Need help to make a programmable timer...

I use FORTH when I can, but I don't tell anyone I'm using it, and I don't tell them that they should.

The _new_ One True Way is an ancient language, older than FORTH, that Bell Labs threw away because it was such a piece of Crap.

That other language has one magical property; full employment.  If you want to pick one small hardware module and become _the_ programming expert for it, that third generation language is definitely the way to go, because after you've finished dividing the source for a 1k executable into 500 tiny files, with diabolically arranged dependencies, you will never get all the bugs out of it, and neither will anyone else, so they _can't_ let you go until they despair of ever fixing the product.

I don't want to even talk about its evil doppelganger- generating offspring.

Mike Halloran
Pembroke Pines, FL, USA

RE: Need help to make a programmable timer...

I C what you meaCn and I knCow of whaCt youC speCak ofCf.

Keith Cress
Flamin Systems, Inc.- http://www.flaminsystems.com

RE: Need help to make a programmable timer...

Anyone met Charles More? Or Elisabeth Rather?

Gunnar Englund
www.gke.org
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...

RE: Need help to make a programmable timer...

In person, no.  

Mike Halloran
Pembroke Pines, FL, USA

RE: Need help to make a programmable timer...

I talked to Chuck over the phone once. I felt religious afterwards.

Gunnar Englund
www.gke.org
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...

RE: Need help to make a programmable timer...

USARTs are talking and listening... got it working yesterday, just in time to be told I need to port it over to a different dev. board ;)  Oy vey!  At least I'm having fun :)

Dan - Owner
http://www.Hi-TecDesigns.com

RE: Need help to make a programmable timer...

Well!!  What was the problem?  You gonna keep us in suspense?

Keith Cress
Flamin Systems, Inc.- http://www.flaminsystems.com

RE: Need help to make a programmable timer...

Hiya Keith and Mike-

O.K. to get serious for just a bit, even though we are going way off topic.  This is a real issue for me that I'm currently investigating.

I'm "filling in" my architecture tools.  I've got a pretty good handle on the microcontrollers and the higher end stuff (big ARMs, uClinux, etc, etc).  My "middle micros" (Z80s and 68Ks) are getting pretty long in the tooth.

Some of the smaller ARMs are a little to small to really run uclinux and require some significant secondary storage.

So, forth is/was an option for me.  Also some of the small o/s stuff in Contiki for example.

I have a forth interpreter for the 68K, but it's written in assembly language. Ugh.  Not too portable.

I'm starting to turn my attention to tiny TCL, avaliable at sourceforge.  The claim is the interpreter is rommable to less than 60K. That would allow some of the small single chip ARM solutions to have it in their flash complete and still have room left over for other stuff.  A simple serial interface to a usart can usually provide quite a bit of usefull information for a developer to diagnose problems.  You don't need to have a tcl/tk package to run. Shoot I have a little VT100 terminal program on my PDA. That would be enough sometimes.

I too have C'en the light, but the thought of a compiler in an embedded system just doesn't thrill me.  I suppose the laptop, compiling and downloading is an option, however, it seems fraught with peril especially when I want to "freeze" the state of the machine, goto a little interface and gather some data or run a small digester program. Don't want to reset the machine, bootstrap a program over serial, USB, or JTAG and then hope to have usefull information on the current state of the machine.  Just a context switch to the TCL program.

If you've got a better solution, I'd like to hear it.  These are just my thoughts.  Maybe a seperate thread for this.  I think that it shouldn't be in the tech tips section as this is geared for embedded systems, not general purpose computing.  What 'da 'ya think?

  Cheers,

   Rich S.

RE: Need help to make a programmable timer...

Keith,

'twas a couple of problems.  The USARTs were incorrectly set to Tx/Rx MSB first, and the idle task was set to near-maximum priority.  The dev. board uses a 10MHz crystal which divides/multiplies the PLL nicely up to a 180MHz internal clock.  The new board was designed with an 18.43 somethin'-somethin' Mhz crystal, so finding a ratio that gives me exactly 180 again is going to be interesting (if even possible).  If I can't find it, I'll have to change other portions of code, such as the comm stuff :(

Dan - Owner
http://www.Hi-TecDesigns.com

RE: Need help to make a programmable timer...

Thanks Dan.

Richs; you probably should've started a new thread.. This one is pretty beat up.lol

I am also not too sure really what your question is... <sorry> Yah got a bit'o rambling going on there.

I don't really see a lot of need for a 'bunch' of different platforms.  Get good a the right ones and you 'think' in their colors.

So, someone comes to me and sez I need X built. I can immediately start seeing how to implement everything the project needs in the platform/s I'm skilled at.  You know, where potential pit falls lay, where to capitalize, what is a problem, etc., etc.   Focusing on fewer platforms also allows you to perhaps have better tools as your $$ are not spread all over.

I would say knowing one microcontroller family really well and one microprocessor family really well would serve most people the best.  That way jobs not requiring a bunch of storage can use your uC and jobs that need a bunch of storage you use the uP.  All jobs can then be covered with alacrity.

Of course someone may show up and say we want to do Y and we want you to use ColdFire or this specific DSP, then you do your best and get to explore a new realm.

PICs or Atmels(uC) and then ARMS or maybe Rabbits(inexpensive screaming z80s with networking)(uP) would be the sort of course I would sail.

I don't know if this is answering your question..

Keith Cress
Flamin Systems, Inc.- http://www.flaminsystems.com

RE: Need help to make a programmable timer...

Dan,

As you know, there is a 4+ percent tolerance allowed in UART speed before communication has any real problems. So, if you get within 1 percent, you should not have any problems at all. Exact timing may be the difficult part. Especially if you are measuring speed and things like that.

Gunnar Englund
www.gke.org
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...

RE: Need help to make a programmable timer...

I'll be a monkey's uncle, a ratio does exist for that frequency.  I wrote a snippet of code to run through all possible ratios of clock dividers and multiplers for the PLL, saving the one with the smallest error.  No way I would have found it by hand, but it exists.

Dan - Owner
http://www.Hi-TecDesigns.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources