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.

Need help in multiplexing 7-segments LEDs

Status
Not open for further replies.

ericmar

Full Member level 5
Joined
Apr 14, 2004
Messages
278
Helped
3
Reputation
6
Reaction score
4
Trophy points
1,298
Location
Singapore
Activity points
2,928
Hi guys,
I'm a newbie in PIC and I just started to learn it. So I need some helps from u all. I hv succeeded in flashing LEDs on my Millennium Demo board and would like to build a counter now using 4 7-segments LEDs on the board. However, I'm not quite sure where to start this. I cant find anything helpful from the web after doing a search. BTW, I'm using Hi-tech PIC C compiler and PIC16F877 at the moment.

So could anyone please help me with this? Besides, I would like to find out how to define the inputs on PORTA, for example. How should I program my c code so that few bits on PORTA are defined as inputs while all others are defined as outputs? Can anyone show me this?

Thanks a lot! :)

Regards,
Eric Mar
 

assemply code for setting ports as input and output is explained in the manual attached to the demo board or you can just open the pic homepage and looking for your PIC part number and down load the pdf file. all instruction to set the port is state there.

good luck
 

I don't know Hi-TECH C.

But this is what I will do to set a TRIS.

TRISA = 0xff; // All bit set as input
TRISA &= 0b11100100; // bit 0, 1, 3, 4 output, the rest input.

For PORTA, don't forget about the ADCON1 setting if you device has A/D converter.
 

ericmar,

If you're a newbie with PICs, as a general rule, you should keep the compiler manual and the MCU datasheets at hand. Almost all the answers are in these documents, trust me.

Load TRISx registers for PORTx configuration (just setting the bits you want to use as inputs, and resetting the bits you want to use as outputs).

I don't know anything about Millenium Demo Board, so I can't help you so much about it, but PM me if you want some reference code for multiplexed-display handling.

Regards
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top