|
|
View previous topic :: View next topic |
Author |
Message |
Ben Dinsdale
Joined: 10 Aug 2007 Posts: 6 Location: East Yorkshire, UK
|
PIC16F913 Port_C issues |
Posted: Fri Aug 10, 2007 5:30 am |
|
|
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
|
|
Posted: Fri Aug 10, 2007 8:36 am |
|
|
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
|
|
Posted: Mon Aug 13, 2007 1:43 am |
|
|
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
|
|
Posted: Mon Aug 13, 2007 2:10 am |
|
|
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
|
|
Posted: Tue Aug 14, 2007 5:06 am |
|
|
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
|
|
Posted: Tue Aug 14, 2007 5:15 am |
|
|
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
|
|
Posted: Tue Aug 14, 2007 5:50 am |
|
|
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 |
|
|
|
|
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
|