|
|
View previous topic :: View next topic |
Author |
Message |
buttlumpy
Joined: 23 Aug 2006 Posts: 1
|
Help with I/O on A6 & A7 on 18F4580 |
Posted: Wed Aug 23, 2006 4:19 pm |
|
|
I need to use all of port A on the 18F4580 for output, and want to use the internal oscillator.
I've been trying to get the fuses and settings right to do this, but I always have trouble when setting the A6 pin. In the data sheet, it lists the oscillator configuration I want as INTIO2, but the only fuses listed for the device in PICC that seem germane are INTRC_IO. I currently have this fuse set.
It really seems that I am stuck in the INTIO1 mode as described in the datasheet. I'm not sure what to do to get full I/O functionality on both A6 and A7. I'm not sure how to manually set the OSCCON register, or even what to set it too.
Any help would be greatly appreciated. Thanks! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Aug 23, 2006 4:39 pm |
|
|
What is your compiler version ? For PCH vs. 3.249, If I compile the
program shown below, I get these fuse settings at the end of the .LST file:
Code: |
Configuration Fuses:
Word 1: 0800 NOIESO NOFCMEN INTRC_IO RESERVED
|
This shows that the Config 1H byte is set to 0x08. The 18F4580 data
sheet shows this setting allows digital i/o on RA6 and RA7:
Quote: |
CONFIG1H: CONFIGURATION REGISTER 1 HIGH (BYTE ADDRESS 300001h)
bit 3-0 FOSC3:FOSC0: Oscillator Selection bits
11xx = External RC oscillator, CLKO function on RA6
101x = External RC oscillator, CLKO function on RA6
1001 = Internal oscillator block, CLKO function on RA6, port function on RA7
1000 = Internal oscillator block, port function on RA6 and RA7
0111 = External RC oscillator, port function on RA6
0110 = HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1)
0101 = EC oscillator, port function on RA6
0100 = EC oscillator, CLKO function on RA6
0011 = External RC oscillator, CLKO function on RA6
0010 = HS oscillator
0001 = XT oscillator
0000 = LP oscillator |
Code: |
#include <18F4580.h>
#fuses INTRC_IO,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=8000000)
//===========================
void main()
{
while(1)
{
output_high(PIN_A6);
output_high(PIN_A7);
delay_ms(500);
output_low(PIN_A6);
output_low(PIN_A7);
delay_ms(500);
}
} |
|
|
|
|
|
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
|