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

Help with I/O on A6 & A7 on 18F4580

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



Joined: 23 Aug 2006
Posts: 1

View user's profile Send private message

Help with I/O on A6 & A7 on 18F4580
PostPosted: Wed Aug 23, 2006 4:19 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Aug 23, 2006 4:39 pm     Reply with quote

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);
  }

}
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