Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need square wave generation with PIC16F84 please urgently!!

Not open for further replies.


Advanced Member level 4
Apr 12, 2005
Reaction score
Trophy points
San Jose, California, USA
Activity points
square wave generator using pic

Hello all
I am not a prfect PIC user, I used it one year ago in a project, but it took long time..

Now I want to do approximately simpler thing, but have no time indeed to waste in it.. I want to make a random number generator of variable bit rate

I can discribe it in brief as follows:

- It generates any random set of bits at one pin of any port.
- I can change (or select) between different bit rates via external thing (e.g. push button, I think it will be good and easy, each push should switch to the next range),
- bits on output are normal NRZ pulses of variable widthes depending on selected rate.
- Ranges: 3kb/s through 13kb/s with step kb/s (10 ranges i.e. to scan over the full range, you should press the push button 10 times)
- I prefer if i can display anything that tell me at which range i am working even on leds (for example: using 4 LEDs to display number of selected range in binary)
- I need it to be using PIC 16F84A, as I don't have another PIC insteed of it.
- I need it very urgent! and very fast! It's not a project itself, but i need it to run an RF digital data-link, and I got tired from 555, XOR, D-FF, and Registers Random number generators!! very tiring and difficult to build and adjust, so I thought that PIC will be easier!

Note that, I don't have any C or BASIC compilers, I wrote my last project in assembly,

Please, if you can't undertand anything, then do ask me about it and i will clarify, but don't leave the post w/o replying! any reply may help me so much!!

If anyone can help me in that problem even in making it for me i will be very thankful!

Thanks alot in advance,

pic16f84 square generator

i think your biggest problem is in generating random numbers and u can use another controller also PIC to produce a variable frequency like PIC 16F877
for random number generation try to revise your course in statics and propability
god help u

square wave generation, pic

To clarify, My aim isn't exactly to make a one bit width random number generation, but to generate even a prepeated signal of non-uniform bits configuration, e.g. 101101011010001010100100101110101001010101100 (any long enough length), then repeat this stream again infinite time.. I will accet that as random number

hence, I think 16F84 is absolutely enough to perform such task..

and It's not important to know anything about statistics and probability..

I hope that's it's now more clear..
Thanks for help, but i still didn't solve it!
Still need help please,

need for wave generation

The first thing to do to make this easier on yourself is to get hold
of a C compiler like the free F84 version that you'll find here:


It seems like you really need a repeating binary bit stream with variable period.
If this is true, you can just define a suitable variable(s) - eg: 32 bit integer,
fill it (or them) with the pattern that you want, and shift it out on a port pin, based on the currently selected bit period. There is example code in C all over the
Internet showing how to shift and test, write to ports, etc.

Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to