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.

Binary counter

Status
Not open for further replies.

Slashdot

New Member
I am hoping for a little guidance , I may be taking on a project a little beyond that of a beginner to microcontrolers but let me outline what I am trying to do.
I have a CB radio I am modifying for 10 meter ham use. what I want to do is remove the 40 position channel selector and program the PLL directly off a PIC set up to run as a binary counter , that seems to be the easy part , where it gets complicated is I want to interpret the binary count being delivered to the PLL and display the coresponding frequency on a display , either LCD or LED , the PLL is programed via 8 bit binary and I need the count to run n:101 - n:255 (1100101 -111111 ) and reset , be selectable as a down counter or up and be able to halt the count when the desired frequncy is reached.
I was originaly going to do this with a bank of 74192's on the pll end a a bank of 74192's and 74247's drining a 7 segment display but I think the microprocessor woud do the job better
any help would be greatly appreciated , I am eager to learn and not unfamiliar with electronic theory , just new to PICs
 
So, basically what you want is a counter that can count upwards from 101 to 255 or backwards from 255 to 101, and wrap back. And the current value needs to be displayed? Do i understand it correctly or not ?
 
Yes , exactly , however , I want the display to show the true operating frequency , 101 being equivalent to 27.995 the 2 and 5 are hardwired and 7.99 are the only displays being changed , 7.99 , 7.98 , 7.97 etc...
 
I also am aware that I will probably have to use 2 pics for this project , one for the display and 1 for the counter , but it will still be alot better than using 10 TTL chips LOL
 
Nope 1 pic can handle it with ease... writing a litte example as we speak...
But if you know absolutely nothing about pics it might be worthwhile to take a look around on the net to get to know the basics.
 
Doing that as you type Exo , I am quite excited about learning the ins and outs , I am a Ham Radio operator and have been an Electronics hobbiest for a long time , I am totaly new to Microprocessors but have been looking at the basic ASM code , it doesnt look too bad , should be able to pick it up , even if I am an old Dog learning new tricks LOL , I havent picked up a soldering iron for 10 yrs and the last project I built was a tube RF amplifier , just a little diffrent than what I am attempting now :D
 
What is the frequency of the PLL divider will have to handle? If you plan to use the PIC's internal counters, you will be limited by the maximum frequency it can handle. Otherwise, a single PIC will handle the task easy.
 
here you go; i tried to add some understandable comment, but like i said
if you're a complete newbie to pics it still may be hard to understand
 

Attachments

  • Example.zip
    2.7 KB · Views: 421
PLL frequency wont be an issue , I am just trying to apply binary programming to the divide counters , it is currently handled by 8 binary inputs connected to a mechanical 40 position switch
 

Attachments

  • pll02a.gif
    pll02a.gif
    3 KB · Views: 1,365
  • pll_1.gif
    pll_1.gif
    2.6 KB · Views: 1,373
Awesome , I think I would preffer to use an LCD display but LED would work for me too , the display was actually an after thought but I felt it would really finish the project off well
 
Question Exo, PORTA is a 4 bit port and being used currently for the up switch and down switch on RA0 and RA1 , PORTB will be dedicated for the programming inputs of the PLL02a, so I am left assuming that if I were to include a display on this pic it would be serial LCD on port RA2 or RA3 ?, I have been looking at the code you sent , I think I am going to enjoy working with pics , very elegant aproach to alot of projects I didnt want to take on , thanks
 
PortA is a 5 bit port RA0 to RA4
So there are 3 pins left on this port

I already succeeded in driving 4 7segment displays using only 3 lines by using a 4094 serial shift register and an 4028 to multiplex them

You only need 3 7segment displays (because the 2 and the 5 can be hard-wired) so its certainly possible...

Another possibility is buying a pic16f628 instead of a 16F84
Bacause it has an internal 4Mhz osc. the 2 pins normally used by the crystal become available as I/O; giving you up to 5 free I/O lines (4 lines in combination with a 4094 is enough to drive a HD44780 LCD module)

best of all... the 16F628 is cheaper then the F84 (here in belgium anyway)
 
LOL , just ordered 6 16f84a's will work with them for a bit , got the data sheets as well and I think I am understanding the programing more every time I read it
 
Well, You can still drive a LCD using only 3 lines from the pic, only a bit harder.

If you want to know more about driving a LCD using only few lines I'll send you a scematic.
 
That would be very helpful Exo , thank you , I am still working on the code sample you sent me , seeing if I can add enough to it so I can make it work , adding the LCD readout will take a bit longer LOL
 
I spotted a few errors i made in the code (it was made in a hurry). If i find time tomorrow i'll edit the code and send it.
 
3 line LCD scematic & little code example
 

Attachments

  • LCD_using_3_lines.zip
    28.9 KB · Views: 663
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top