Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com 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.

voltage level sent to a pin port on PIC18F

Status
Not open for further replies.

uomwolverine32

Newbie level 2
Joined
Jan 25, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,295
Hi guys, I am currently working on a project. I am using a PICF18 microcontroller, in addition I am using mikroC Pro to code. I need a bit of help with the coding.....i want to be able to turn on/off a BJT that will be connected to one of my pin ports. How can I send the needed dc voltage level to this pin port?? I am going to be using a keypad (i already wrote this code), so I would just need a function that sends this needed voltage to the pin when the user wants to activate the switch (send 1.5 Vots) and a function that will deactivate the BJT(send 0 volts to the pin port). Any ideas??
 

If you need to send a voltage different from VCC through io port, then you should need a da.
I think there is one more simpler way to implent you function then using da.

First, devide pin port output voltage, like this:
48_1264652886.jpg
 

I was thinking of doing that....I actually got the 5 volts that the PIC can supply....so i was thinking of just using voltage divider to get it to close to 1.5 V
 

If you are driving the output pin high and low (writing to the pin without changing TRIS) you can omit R2 in most cases. The transistor will always hold about 0.65V between base and emitter so all you have to do is choose R1 so the current through it is adequate. Choose R1 with the formula (Vpin - 0.65) / Ib. You can decide Ib by dividing the BJT collector current by its Hfe parameter which is on the data sheet.

For example, if the BJT collector current was 100mA and it's Hfe is 50, Ib would be (0.1/50) = 0.002A. If you assume the PIC pin is 5V when high, R1 would be (5-0.65)/.002 = 2175Ω. In practice you could use 2.2KΩ.

Your values might be different but you have not specified the real BJT or load current.

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top