• 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.

Hello....

just angel

New Member
Good afternoon everybody... How are you all?

I have a question... so if anyone can answer it I will be so grateful.. (I am an electrical Engineering Student)

I am working on a project that needs the use of a microcontroller..

I chose PIC 16F877, and the program language is assembly...

in my project I have some relays that needs to controlled with the MC..

can anyone give hint about how to write the program which will do that.. :oops:

Thanks alot... :)
 

kinjalgp

Active Member
Ths depends on what ondition you want to drive the relays. If you simply want to turn them on with PIC, just make the port pins at logic 1. The relay should be connected in cllector loop of any medium power NPN transistor (like BC547) and its base should be connected to port pin of PIC through 4.7k resistor.
 

just angel

New Member
Thanks alot...kinjalgp :p

But I know all of these...

My question was about the program that should I write...

oh.. yes .. I will change the program language to BASICpro.

so ... can anyone provide with some hint...

this is the first time I am dealing with microcontrollers :shock: ..
 

Chippie

Member
the program for the pic is structured on what you want to happen....

what instructs the pic to operate a relay?
what instructs the pic to operate all the relays?

these are just examples...

a little more information would help......
 

pebe

Member
just angel said:
Thanks alot...kinjalgp :p

But I know all of these...

My question was about the program that should I write...

oh.. yes .. I will change the program language to BASICpro.

so ... can anyone provide with some hint...

this is the first time I am dealing with microcontrollers :shock: ..
Re. chngibg to Basicpro. Stay with assembly. In may be a bit more difficult to start with. But once you have learned the instruction set, you will find it easy.

Assembly usually gives a more compact code than basic.
 

just angel

New Member
Hello everybody

O.K ... my project is about measuring the beta of the transistor..

first of all the program should identify the type of the transistor (PNP or NPN) okay..

so when i put the BJT on its place in the circuit the microcontroller should change the polarity of the input voltage...according to the type of the BJT..
 

kinjalgp

Active Member
This is what you can try for testing whether the transistor is NPN or PNP
1) Apply 5V to collector through a 10k Resistor
2) Apply 5V to base through 10k resistor
3) Ground the Emitter
4) Check voltage at collector
5) If it is 0 (in digital sense) then make base voltage 0.
6) Now again check for collector voltage. If it is 5V (or high) then the transistor is NPN
OR
7) Ground collector through a 10k Resistor
8) Apply 0V to base through 10k resistor
9) Connect Emitter to 5V
10) Check voltage at collector
11) If it is at ~5V then make base voltage = 5V.
12) Now again check for collector voltage. If it is 0V (or high) then the transistor is PNP
 

Attachments

just angel

New Member
Thank alot...kinjalgp...

Yuor explanation is very good...

but.. can you provide me some help on how to write the program that will do that... using the PIC BASIC with PIC 16F877...

:roll:
 

Latest threads

EE World Online Articles

Loading

 
Top