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 support@ccsinfo.com

using seven segment led but want to use pin C7 for adc

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



Joined: 08 Mar 2008
Posts: 17

View user's profile Send private message

using seven segment led but want to use pin C7 for adc
PostPosted: Sun Oct 26, 2008 1:45 pm     Reply with quote

Using a 16f690 PIC.


I am using a 4 digit seven segment display to show the readings from 3 adcs but I want to add a fourth and the only pin I have left is pin_c7 which sAN9.

When I write the byte for the number to each digit (c0 thru c7) it of course is touching pin_c7 and monkeying with my ADC reading.

how can I write the desired number to the seven segment but only pass the first 6 bits (0 thru 6) and leave c7 alone so that it can be my 4th ADC.

I could also use C7 to strobe the digits.


An example would be great.

Thanks

Brian
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Sun Oct 26, 2008 8:54 pm     Reply with quote

Brian,

Maybe you could tell us a little more about the circuit. That would help. RA4 happens to be AN3, so maybe if that pin is not being used for a critical function, you could shuffle it about. RB4 and RB5 are AN10 and AN11 respectively.

Quote:
When I write the byte for the number to each digit (c0 thru c7)
I agree that byte-wise writing of data is most efficient; but if it is messing with the other functions of the device, you could create a struct which assigns a pin to each bit across different ports. Keep in mind though, that this approach will be much slower, since the controller will be setting/clearing each pin individually. Preferably use fast IO switching (#use fast_io()) in this case and set the TRIS registers accordingly.

Another option is not to use the decimal point on the 7 segment display at all. Connect the seven 'number segment' pins to PORTC. Set AN9 as an analog input, and then just write bytes to PORTC. Nothing will be output on AN9 since it has been declared as an analog input.

Rohit
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