CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

creating new port

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ssaakmnt



Joined: 03 Dec 2011
Posts: 27

View user's profile Send private message

creating new port
PostPosted: Mon Mar 18, 2013 12:57 pm     Reply with quote

I am trying to run 4 7segment displays directly from pic16f877 , 3 displays for port b,c and d , port a has not enough pins to drive the 4th display so the idea is to build new port consist of port a pins and port e pins can we do that ? , I tried this code but didn't work:
Code:
byte newport;
#bit aa=newport.0;#bit bb=newport.1;#bit cc=newport.2;
#bit dd=newport.3;#bit ee=newport.4;#bit ff=newport.5;#bit gg=newport.6;
#define aa  PIN_A1
#define bb  PIN_A2
#define cc  PIN_A3
#define dd  PIN_A4
#define ee  PIN_A5
#define ff  PIN_E0
#define gg  PIN_E1
.
.
.
output_newport(255);// for example
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Mon Mar 18, 2013 1:25 pm     Reply with quote

Yes you can.

But I feel it's simpler to multiplex.
Frees up loads of pins.
I'm assuming you're using LED displays.
And you've included current limit resistors in each segment lead.

So:-

1) Connect all 4 segments a together to say C0
2) Same for b,c,d,e,f,g,dp to C1,,,,,,C7.
3) Common of display 0 to D0
4) Same for commons 1,2,3 to D1,D2,D3.

Then:-

Turn each display on in turn for say 1ms each.

Can't help further until we know if you're using CA or CK displays.

Mike
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Mar 18, 2013 2:23 pm     Reply with quote

aw Mike , he's sooooo close to doing it, no need to mux !!
I did the same thing about 20 years ago when the 877 was new.

Do not use RA4 as it's 'open collector'. Instead use RE2.

Be sure to disable any analog pins though!

There is a thread or two here that explains using combining bits from different ports to become a 'byte' wide 'new' port.
As well it is covered in the CCS C manual,' somewhere'...

hth
jay
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Mon Mar 18, 2013 2:46 pm     Reply with quote

OK. I'm not going to argue.

Though he could use A4 with CA displays.

Been caught out with that one more than once (wondering why it never goes high).

Mike
ssaakmnt



Joined: 03 Dec 2011
Posts: 27

View user's profile Send private message

PostPosted: Tue Mar 19, 2013 12:07 pm     Reply with quote

very good idea to operate all displays from one port each one alone for short period of time..i will try that ,
but also important to know how to combine different port bits to create new port ? I will chick the manual.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Mar 19, 2013 8:01 pm     Reply with quote

Quote:

There is a thread or two here that explains using combining bits
from different ports to become a 'byte' wide 'new' port.

This is it:
http://www.ccsinfo.com/forum/viewtopic.php?t=18949
ssaakmnt



Joined: 03 Dec 2011
Posts: 27

View user's profile Send private message

PostPosted: Wed Mar 20, 2013 4:35 am     Reply with quote

Thank you.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group