Electronics > Electronics

Help for PIC

(1/2) > >>

sambhav:
hi..
i am using PIC 16f877 1st time for my project n i need sum help:

1. wat is the i/p voltage range that pic recognizes as logic 0 n logic 1..??

2. i want the pic to drive relays to control switching of ckts... since the max o/p voltage which pic gives is 5v.. i will require relays which switch at less then 5v..
r relays with switching voltage less then 5v readily available..?? if not is der any other option..??

3. is it possible to generate a 40khz continuous square wave of amplitude 5v using a pic ..??if yes... how ?? the pic runs on a 4mhz crystal..

Admin:
you can always check the pic16F87X datasheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/30292c.pdf


--- Quote ---wat is the i/p voltage range that pic recognizes as logic 0 n logic 1..??
--- End quote ---

below 2.5V is logic 0, and above is logic 1. this gets a little fickle as you approach 2.5V, so if thats a problem I recommend testing under the expected conditions.


--- Quote ---i want the pic to drive relays to control switching of ckts
--- End quote ---

you cannot drive relays directly from a PIC . . . check out this post:
http://www.societyofrobots.com/robotforum/index.php?topic=513.0


--- Quote ---is it possible to generate a 40khz continuous square wave of amplitude 5v using a pic ..??
--- End quote ---

yeap, its possible. just pulse a digital out line on and off with the proper timing. if you need it to be exact, use an oscope to measure out the frequency.

Hal9000:
Just some words I want to throw in:

1. 2.5V would be called the grey area. Try not to fiddle around with stuff in these areas. Go for safe levels (0V or 5V for off or on respectively)

2. I have heard you can drive smaller relays directly from PICs. PICs are very sturdy!

3. You will need to do some calculations to get this frequency spot on. As said, it's all to do with the crystal you use.

dunk:

--- Quote ---is it possible to generate a 40khz continuous square wave of amplitude 5v using a pic ..??
--- End quote ---
when i first started playing with PICs i didn't have an oscilloscope for tuning timing routines.
the best way i found of getting accurate timing pulses was to programme in machine code and manually count the number of instructions.
PICs usually process one instruction per 4 clock cycles. (unlike AVRs which process one instruction per cycle. you AVR freaks can get on your soap boxes now...)
some instructions take more than 4 clock cycles (but always a multiple of 4). the data sheets should be able to tell you which ones.

so, simply count how many instructions the program passes through, multiply by 4 and that's how many clock ticks the programme has gone through.
NOP commands can be used to add further delay. (i think it stands for No OPeration or something like that.)

i think the other posts answer your other 2 questions.

dunk.

JesseWelling:
What about the PMW hardware on the 16f877?
I've used 16f877 PWM for motors but you should be able to just set up the 40khrz square wave and let it go if that all you need.

Navigation

[0] Message Index

[#] Next page

Go to full version