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

PIC16F913 Port_C issues

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



Joined: 10 Aug 2007
Posts: 6
Location: East Yorkshire, UK

View user's profile Send private message

PIC16F913 Port_C issues
PostPosted: Fri Aug 10, 2007 5:30 am     Reply with quote

PIC16F913 Port_C issues
Hello can any one help me?

I've made a simple dev. board for the chip which is simply 7 switch inputs and 18 LED outputs.

Basicly everything works with the exeception of port_C which is 7 LED outputs. RC0, RC1, and RC4 will provide an output but the rest won't.

I have disabled the LCD unit, spi and CCP in a bid to free the port_C for use an an I/O.

setup_lcd(LCD_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_ccp1(CCP_OFF);

any ideas why the some of the outputs will not work?

I have seen a post that says about clearing the VLCDEN bit, however according to the datasheet this is disabled on power up. does CCS enable it?

how would I go about disabling it?

I'm using MPLAB-7.5 and PIC_C 2004
Thanks

Ben
Ttelmah
Guest







PostPosted: Fri Aug 10, 2007 8:36 am     Reply with quote

What compiler?.
If you do mean 'PIC-C', this is the wrong forum (this is for CCS-C). However the syntax looks to be CCS syntax, so give us the version number?. The CCS version number will be at the top of the .LST file, and will be a number like '3.249', or '4.042'.
For the higher port bits, remember that the USART is also multiplexed onto these. VLCDEN, could disable RC2 (whether it affects RC0, and 1, depends on the values in LMUX). The LCD_DISABLED command, should be turning this off, but there might be a fault with your compiler version (hence why we need to see what it is...).
SPI_SS_DISABLED, doesn't turn off the SPI (the wizard puts this in by mistake...). It is the bit to turn off the slave select bit, but will configure the SPI to an 'impossible' mode (slave select only works in 'slave' mode), so normally does work to turn the peripheral off. I prefer to use 'FALSE' instead.
To access VLCDEN, have:

#byte LCDCON=0x107
#bit VLCDEN=LCDCON.4

Then just use:

VLCDEN=FALSE;

To turn it off.

This bit _is_ set on power-on (data sheet page 106, 'note' on the right hand side), and page 19, 'value on POR/BOR', so will need disabling. CCS is not turning it on, but is failing to clear it, when the LCD peripheral is disabled.

Best Wishes
Ben Dinsdale



Joined: 10 Aug 2007
Posts: 6
Location: East Yorkshire, UK

View user's profile Send private message

PostPosted: Mon Aug 13, 2007 1:43 am     Reply with quote

Thanks I'll try that and let you know how I get on. The CCS complier I'm using is 3.6.0.97

Regards

Ben
Ttelmah
Guest







PostPosted: Mon Aug 13, 2007 2:10 am     Reply with quote

There is no such compiler number....
The format for CCS compilers, is major version (one digit), full stop, and a three digit 'minor' version number.

Best Wishes
Ben Dinsdale



Joined: 10 Aug 2007
Posts: 6
Location: East Yorkshire, UK

View user's profile Send private message

PostPosted: Tue Aug 14, 2007 5:06 am     Reply with quote

Sorry I gave you the file version number. The complier version is 3.219.

I tried the code that you provided but only got a flood of errors as it didn't recogise LCDCON or VLCDEN.
Do I need to do define something to make it work? or is ther another way of doing it?

Would somthing along the lines of setup_spi (0x40); work for instance.

Thanks for your help

Regards

Ben
Ttelmah
Guest







PostPosted: Tue Aug 14, 2007 5:15 am     Reply with quote

Er. The byte, and bit lines, declare these. You need these in your code.
3.219, is pretty old, and may have other problems, but these should work. Compiles and runs OK in 3.191.

Best Wishes
Ben Dinsdale



Joined: 10 Aug 2007
Posts: 6
Location: East Yorkshire, UK

View user's profile Send private message

PostPosted: Tue Aug 14, 2007 5:50 am     Reply with quote

I've mangaged to get it working, by uninstalling and reinstalling MPLAB and CCS.
It must of been a disc error on my PC.
I've got all the ports doing what I want now.

Thanks very much

Regards

Ben
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