Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

cpld programming rpm tricker

Status
Not open for further replies.

nomadaz666

New Member
cpld programming rpm tricker (answered/done)

I'm new to cpld's (VERY new, as in I just started reading up on them the other day) but it looks as if it may be the answer I'm looking for.

I want to measure (count) an input shaft rpm, which pulses 8 times per revolution.
so I figured count for 250ms, divide by 2. (I know 125ms would give correct reading but I want the half rpm resolution)
I then want to display this rpm on 3 7 segment led's.
I also want a 4bit binary switch as an input (0-15) as I want to manipulate the output signal by lowering the rpm reported.
so I need to subtract this input from the measured rpm.
now to give back the correct signal I multiply this result by 8 for my new frequency.
I then send it out using the pwm 50%duty cycle at the new frequency.

If I'm understanding this correctly, CPLD's allow schematic AND vhdl code (where I can put the simple math) both to the fitter. I'd like to know what programs I need to accomplish this, how long one would guestimate the learning curve is to accomplish this. as far as the programmer goes I intend to build my own using the jtag programming method. seems simple enough.

I have drawings to maybe clear up any of my ramblings here:
**broken link removed**
**broken link removed**
 
Last edited:
Nomadaz666, I think Nigel Goodwin is right that a micro computer can do this better.

I find that large CPLDs cost more than small FPGAs.
If you are using 95% of a CPLD and need one more function you are in trouble.
If you are using the smallest FPGA and you need more functions there are larger versions.

Is this a work project or a home project?
 
it's a home project. I was liking the ability to enter schematics and math. So a pic would be better? I'm a total newbie to any of the programable devices (other than an eprom lol ), and happened upon an article about entering both schematic information and vhdl, and the jtag programming meant I don't have to purchase an expensive programmer.. my other option was to use a pll to multiply the signal by say 100, then a set of programable counters/dividers with switches to get the lowered count out. , but I lose the the display, and it's not precise nor very attractive, just seems a cludgy way of doing it.

<---wondering how hard it is to program pics.. lol

Edit: ok, so pic programming is even easier than cpld.. lol back to reading..
 
Last edited:
If you choose the CPLD option you will need a printed circuit board. You might need to do surface mount soldering.

If you choose to do this with a micro computer then:
Search for BASIC STAMP. There are many on the market. The cost covers all software and hardware. Down load the manual and example programs. See if you think you can program in BASIC. There is a function for measuring the time (pulsein) 1/700hz. Do the math. Output to the LEDs and use the PWM command. The BASIC STAMP Dx is only $30 and includes a PCB with a bread board area.

If you want to do many projects then PicBasic Pro or PicBasic is a better deal. You need to get the software and programmer. You start out with a $200 investment then each computer is only a few dollars. This option, the computer runs 100x faster.
 
ronsimpson said:
then PicBasic Pro or PicBasic is a better deal. You need to get the software and programmer. You start out with a $200 investment then each computer is only a few dollars. This option, the computer runs 100x faster.

Or just use plain PIC's and the free MicroChip assembler, no investment cost (apart from a low cost programmer - which you can build yourself), and a dollar or two per PIC.
 
Thanks guys I appreciate the feedback. might just go with the basic stamp for this one off thing, but think I probably need to learn assembly and learn pics for future projects, (or the many scribbled in notebooks years ago) lol.

your input helped me decide the cpld's were definately the wrong way to go. cost and upgradability etc as ron pointed out.

Ron - I had ruled out basic stamps on cost, but I didn't know about pulsin. that's very usefull info. Thanks!

Nigel - thanks for the info on pics, they look extremely more capable than I thought they were. Thanks!

Guess I've got some learning to do, lots have changed since I went to school for electronics 18years ago..

edit: just noticed the site and tutorials, very promising.
 
Last edited:
Can't believe how cool these pics are. Thanks for the suggestion, didn't know what I was missing. it's been forever since I've dealt with electronics.

Been having a field day with these the last couple months!
 
Status
Not open for further replies.

Latest threads

Back
Top