Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 1st October 2004, 01:20 PM   (permalink)
Default characteristics and apps: PIC16F870

I am plannint to turn on 3 leds of 2.1v@15mA by using 3 pins from any port of the micro (AB or C)

Does any pin from the pic16F870 can support that leds.

I will use a resistor of 330ohm in series with the output of the pin and in serie with the led, the led will end at GND.

the manual says source sink 25mA, I think it can support my leds, but one or all leds?

what does high sink mean?

Does anyone know a tutorial where I can see EXAMPLES of how to initialize timers and interrupts and how to use them. I have already read tutorials but i need examples.
sardineta is offline   Reply With Quote
Old 1st October 2004, 01:50 PM   (permalink)
Default Re: characteristics and apps: PIC16F870

Quote:
Originally Posted by sardineta
I am plannint to turn on 3 leds of 2.1v@15mA by using 3 pins from any port of the micro (AB or C)

Does any pin from the pic16F870 can support that leds.

I will use a resistor of 330ohm in series with the output of the pin and in serie with the led, the led will end at GND.

the manual says source sink 25mA, I think it can support my leds, but one or all leds?

what does high sink mean?

Does anyone know a tutorial where I can see EXAMPLES of how to initialize timers and interrupts and how to use them. I have already read tutorials but i need examples.
The PIC can feed LED's no problem, check my PIC tutorials where I have examples.

The hardware extras sections also explains 'sink' and 'source', with the LED to GND the PIC is working in 'source' mode - with current coming out of the PIC to the LED.

One of the tutorials also uses a timer and interrupts to multiplex a double seven segment LED display.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 2nd October 2004, 05:47 PM   (permalink)
Default

Nigel

the pull-ups resistors, what advatages can gave me?
because they are automatically disable when the port is configured as output, but when the port is configured as input? I know that it is software configurable.

The open drain collector, means that i should put an external resistor, what value is recommended?

if I use this open drain collector pin does the input signal I read is inverted or is as it is; 5v = logic 1, 0v = logic 0

thanks
sardineta is offline   Reply With Quote
Old 2nd October 2004, 06:12 PM   (permalink)
Default

Quote:
Originally Posted by sardineta
Nigel

the pull-ups resistors, what advatages can gave me?
It allows you to use switches to ground, without adding an external pull-up resistor.

Quote:
because they are automatically disable when the port is configured as output, but when the port is configured as input? I know that it is software configurable.

The open drain collector, means that i should put an external resistor, what value is recommended?
It depends entirely what you want to use it for, as far as I'm aware it has the same 25mA maximum current as the rest of the I/O pins - so anything over 200 ohms would be OK.

Quote:
if I use this open drain collector pin does the input signal I read is inverted or is as it is; 5v = logic 1, 0v = logic 0
It's still the same.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 4th October 2004, 04:48 PM   (permalink)
Default impedance

What is the inpedance of any pin port when they are configured as inputs?
sardineta is offline   Reply With Quote
Old 4th October 2004, 05:04 PM   (permalink)
Default Re: impedance

Quote:
Originally Posted by sardineta
What is the inpedance of any pin port when they are configured as inputs?
Have a look at the datasheet, it may well tell you, but it's a CMOS logic input and is pretty high - I've never really seen any reason to try and find out?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 4th October 2004, 06:35 PM   (permalink)
Default

I did an "AND GATE" with two diodes 1N4148, I will connect two push buttons that when any of two is closed will produce an 0 logic, al least.

so this two signals will control the MCLR#, if the two push buttons are normally open as they are then I will have 5 volts, so the reset will be desactivated, if some of the are pressed then the reset is generated.

Hope this is a high impedance, more that 1 Megaohm, because if not, the voltage will drop and I'll never will see any accion

thank you, Nigel
Attached Images
File Type: jpg and.jpg (12.2 KB, 1418 views)
sardineta is offline   Reply With Quote
Old 4th October 2004, 07:26 PM   (permalink)
Exo
Default

You don't need the diodes, Just use 1 pullup resistor on mclr (10K or something), and connect both switches between mclr and ground.
Pressing eighter one will pull mclr low.
Exo is offline   Reply With Quote
Old 4th October 2004, 08:10 PM   (permalink)
Default

Great Idea

I do not believe it, it is a great idea, I was thinking on something robust, because one push button is for a local reset near the uC, and the other one is for a push button is for a remote reset, it will be at a distance of 30 meter.

what do you think about glitches
sardineta is offline   Reply With Quote
Old 4th October 2004, 09:21 PM   (permalink)
Default

Quote:
Originally Posted by sardineta
Great Idea

I do not believe it, it is a great idea, I was thinking on something robust, because one push button is for a local reset near the uC, and the other one is for a push button is for a remote reset, it will be at a distance of 30 meter.

what do you think about glitches
You should certainly put a capacitor from MCLR to GND, I'm rather dubious about having a 30 meter long wire on a reset pin!. An obvious answer to cure any potential problems is to use a relay for the remote switch - good old crude stuff is often more robust!.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 5th October 2004, 04:21 PM   (permalink)
Default

ok, that changes all, the second SW (S2), will be controlled by a relay, I will look for one, if I have one DC relay, it just is fed to for example +5v to gnd, isn' it?.

another question

Is it possible to read and write of the same port at the same time, I mean if I put a 0 or a 1 in PTOB.1 at the same time I can read PTOB.8?
sardineta is offline   Reply With Quote
Old 5th October 2004, 05:07 PM   (permalink)
Default

i believe that writing to the port , actually reads the port then writes to port.
i read that somewhere..

the pic does a read before write , on every write ..
hope this helps
williB is offline   Reply With Quote
Old 5th October 2004, 05:38 PM   (permalink)
Default

thanks I hope what you say be true, because if not it will be painful
(i think because many bcf, bsf to write just one bit, while btfsc and btfss will read just one bit, however this instruccions force me to jump).



The PIC 16F870 has two Vss, I use one for the oscillator, and the other for the circuits or it really does not matther.?

sardineta is offline   Reply With Quote
Old 5th October 2004, 06:07 PM   (permalink)
Default

Quote:
Originally Posted by sardineta
thanks I hope what you say be true, because if not it will be painful
(i think because many bcf, bsf to write just one bit, while btfsc and btfss will read just one bit, however this instruccions force me to jump).
You can't read and write with the same instruction, you can either read OR write a single bit (witht the commands you mentioned above), or you can read OR write the complete port.

A lot depends what you are trying to do.

Quote:


The PIC 16F870 has two Vss, I use one for the oscillator, and the other for the circuits or it really does not matther.?
They just both need connecting to ground, there's no particular distinction between the pins - but you most ground BOTH of them.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 5th October 2004, 09:14 PM   (permalink)
Default

Thanks a lot, The tutorials you have in the site are pretty good,
do you have any example of timers?

I am using the 16F870

Does TIMER0 can be reprogrammed by the user?

I have a dip switch of 4 positions, 3 of them will be used to define by hardware the correspnding TIME DELAY
20 ms................111
100 ms..............110
300 ms..............101
200 ms..............100
1000 ms............011

the other 3 possible positions will not be taken into account.

I'll use it to start a time delay when an event is presented at RB0/INT
and if I have 111, then I know that I will wait just 20ms and if the event persists then I have to stop the system.

And if before an event occurred and have passed 30 minutes, then I will clean my registers where events are counted.

How it can be possible? I still can't imagine!,
does timer0 and timer1 and even timer2 can work simultaneusly without delaying the other process of the microcontroler, as delays do
sardineta is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 11:27 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.