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.

Connect 10 multiplexed led to PIC16F819

Status
Not open for further replies.

zanor

Member level 4
Joined
Feb 17, 2006
Messages
79
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Norway
Activity points
2,039
Hi!

Could anyone please tell me how to connect **broken link removed** to a PIC16F819.

I want to be able to control all the LED's by software.

Any help would be great!
 

Connect pins 1-5 to a general purpose I/O pin, and pins 6-9 to a current limiting resistor and the other end of current limiting resistor to a general purpose I/O pin on the processor. Now when you apply a 1 (or high) to pins 6-9 and a 0 (or low) to pins 1-5 the appropriate led will light. To light all of them simultaneously you will have to multiplex them. Since you have 5 banks of 4 LED's you will have to set the LED's you want on in each bank in sequence, and leave each bank lit for a fixed amount of time. A good rule of thumb is to sequnce such that all LED's are scanned in around 16 mS so with 5 banks each bank should be lit for 3-4 mS.
 

hi,
try following code.
you can see complette project in
attached file
Regards
Ali Asker


//Ali Asker
//2006
//is is designed for edaboard
#include<16f74.h>
#fuses XT,PUT,NOWDT
#use delay(clock=4000000 )
#byte port_a=5
#byte port_b=6
byte const table[4]={0b00000001,
0b00000010,
0b00000100,
0b00001000
};
byte const table2[5]={
0b00011110,
0b00011101,
0b00011011,
0b00010111,
0b00001111
};
main()
{
int i,j=0;
set_tris_a(0x00);
set_tris_b(0x00);

port_a=0;
port_b=0x1f;
for(;;)
{
for(i=0;i<4;i++)
{
port_a=table;
for(j=0;j<5;j++)
{

port_b=table2[j];
delay_ms(500);

}

}
i=j=1;
port_a=0,
port_b=0;


}

}
 

sorry,there is a mistake in my code
cahnge
#include<16f74.h>
with
#include<16f84a.h>
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top