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.

Input For PIC uC

Status
Not open for further replies.
mesamune80 said:
ya i am using a red and a green LED,so you what you mean is 680 and 330 .And check the voltage output whether it is enough or not if not replace 330 with 270R right?hope there is no problem after this.
ya one question here,what PIC programmer do all of you using?
i need a USB programmer now,and dunno which one to choose >_<"
Any recommendation?

hi,
No, you replace the 270R with a 330R, the higher value of the bottom resistor the greater the voltage will be at the junction of the two resistors.

Use Ohms law to calculate the voltages on the divider.:)

EDIT: I use PIC Start Plus.. with MPLAB
 
Thanks for all the replies, i am currently using EPIC Programmer which is using parallel port. It seem to not program sometimes.This is the reason why i need to find a new programmer.i'll take a look at above link and see which one is suitable for me,thanks guy! =)
 
ericgibbs i had tried your method which is using 680 and 330 it gave me 4.x V for the output to uC but my LED not lit at all. why is the course for this i wonder? not enough current to drive the LED? or what?
 
mesamune80 said:
ericgibbs i had tried your method which is using 680 and 330 it gave me 4.x V for the output to uC but my LED not lit at all. why is the course for this i wonder? not enough current to drive the LED? or what?

Hi mesamune,
The supply to the LM393 is +12V, I am assuming you are using a RED LED. which should have a forward voltage drop of about 2V.

So that leaves about 10V across the 680R and 330R divider, the current thru the divider will be 10V/1010R = 10mA,
so across the 330R there will 0.01*330R= 3.25V + the LED Vfwd = 5.25V.

The LM393 has an open collector output, so as the output transistor in the LM393 is OFF, it will not sink any current and load the divider.
Also the input impedance[resistance] of the PIC input is a fairly high impedance it will not load the divider.

So ALL the current flowing in the resistors 680R and 330R in series will flow thru the LED, as the current is about 10mA
the LED should glow.!

Could you post the diagram with voltages marked at the top of the 680R, the junction of the 680R and 330R ,
also the voltage across the LED.

You must have a fault elsewhere, are you sure that the PIC pin is set as an Input.?

Lets know.:)

EDIT: checking your figures that gave you +4V.... I suspect that the LED is blown short circuit.
Assume that the LED is blown s/c... so 12V/1010 = 11.8mA... 11.8mA * 680R = 3.9V. [You measure 4V.!]
 
Last edited:
I am using EWB 8.0 to do this circuit simulation,but afer i configure the circuit to what you mentioned earlier it gave me this result:
i am using LM339N for comparator in my circuit (quad type )
Anything wrong with my circuit?
 

Attachments

  • windows comp,jpeg.JPG
    windows comp,jpeg.JPG
    125 KB · Views: 147
Hi Mister E ,my EPIC keep on promp me "code verify error at 0000" 3FFF should be 118A,continue verifying?
i duuno why suddently become like this i already used it long time ago,no problem. ;(
 
mesamune80 said:
I am using EWB 8.0 to do this circuit simulation,but afer i configure the circuit to what you mentioned earlier it gave me this result:
i am using LM339N for comparator in my circuit (quad type )
Anything wrong with my circuit?

hi,
I'll look thru the circuit.
 
ya i had just tried out with my hardware.....hehe it works! but the voltage i measure to my uC is 5.25V when out of the Low lmt window =)
i wonder why the simulation cannot show the lit LED =.=''
 
Last edited:
mesamune80 said:
ya i had just tried out with my hardware.....hehe it works! but the voltage i measure to my uC is 5.25V when out of the Low lmt window =)
i wonder why the simulation cannot show the lit LED =.=''

Hi,
Checked the circuit looks ok, refer this attachment.

I would suggest that you increase the 680R to about 750R or 820R, so that the input voltage to the PIC is just under +5V.

EDIT: If you plan to use a second input pin on the PIC for the other LM output, change the 1K0 to 750R and 330R .. OK?
 
Last edited:
okay,ya i need my uC to monitor this two limit ,when the input just out from the windows then the corresponding upper and lower lmt pin will act accordingly. :) actually i am using it for stepper motor.i will send pulse to the motor driver and move my motor up or down precisely. ('',)
 
mesamune80 said:
okay,ya i need my uC to monitor this two limit ,when the input just out from the windows then the corresponding upper and lower lmt pin will act accordingly. :) actually i am using it for stepper motor.i will send pulse to the motor driver and move my motor up or down precisely. ('',)

hi,
Lets know how the project goes..:)
 
eric, there is one problem i encounter when i disconnect the uC the LED lit but when i connect to one of the I/O pin RC.6 the LED goes off. can i add anything to prevent this? Thanks
 
mesamune80 said:
eric, there is one problem i encounter when i disconnect the uC the LED lit but when i connect to one of the I/O pin RC.6 the LED goes off. can i add anything to prevent this? Thanks
hi,
It sounds as though you have configured PORTC.6 has an Output which is set low.
Post your code and we will advise.:)
 
This is just the test code i used:

'*********************************************************
'Declarations of variables
'*********************************************************

Dim an4 As Word 'analog input RA5
Dim an5 As Word
Dim an6 As Word
Dim a4 As Byte
Dim a5 As Byte
Dim a6 As Byte
'Dim dir1 As Bit 'direction for motor1
'Dim dir2 As Bit 'direction for motor2
Dim i As Byte
Dim n As Byte
Dim n2 As Byte

a4 = an4.LB
a5 = an5.LB
a6 = an6.LB
Symbol dir1 = PORTC.1
Symbol dir2 = PORTC.2

TRISC = %00001111

loop:


If PORTC.6 = 1 Then

dir1 = 0
High PORTC.0
WaitUs 500
Low PORTC.0
WaitUs 500



Endif
Goto loop
 
hi,
TRISC = %00001111

loop:
Code:
If PORTC.6 = 1 Then

dir1 = 0
High PORTC.0
WaitUs 500
Low PORTC.0
WaitUs 500
Endif

Look at the TRISC..... 0 = 0utput... 1 = 1nput
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top