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

Problem controlling port A pin 6

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







Problem controlling port A pin 6
PostPosted: Mon May 26, 2008 9:48 am     Reply with quote

Hi
I have a problem controlling port RA6 but I can control the rest of PORTA.
I think it comes from the configuration of the oscillator.
I've used the #fuse INTRC_IO and tried also INTRC without success.
I can control individual pin of the port except RA6 !
Processor used PIC18F2525 without an external clock or xtal.


void main(void)
{

setup_oscillator(OSC_4MHZ|OSC_INTRC); // set internal oscillator at 4 Mhz
set_tris_A(0x00); // set pins to output
set_tris_c(PORT_TRISC); // set pins input or output
port_b_pullups(true); //
output_A(0x00);
setup_adc_ports(NO_ANALOGS|VSS_VDD);//
setup_adc(ADC_OFF|ADC_TAD_MUL_0);//

setup_wdt(WDT_OFF);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);

output_high(31749); // port Ra5 adress
output_high(31750); // port Ra6 adress
output_high(31751); // port Ra7 address

...
}

Does anybody knows what I'm doing wrong ?

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 26, 2008 10:25 am     Reply with quote

Are you testing this on a hardware board or in a simulator ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 26, 2008 11:54 am     Reply with quote

You need to use a much more simple test program, and don't use use
magic numbers for the i/o pins. Use CCS pin constants in the .H file.
Example:
Code:

#include <18F2525.h>
#fuses INTRC_IO, NOWDT, PUT, BROWNOUT, NOLVP, NOPBADEN
#use delay(clock=4000000)

//==========================
void main()
{

while(1)
  {
   output_high(PIN_A6);
   delay_ms(500);
   output_low(PIN_A6);
   delay_ms(500);
  }

}
JacquesB
Guest







PostPosted: Mon May 26, 2008 11:55 am     Reply with quote

I'm testing it with the Pickit2.
The rest of the program works fine beside not being able to control RA6
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 26, 2008 12:04 pm     Reply with quote

Here's the Pickit2 web page:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023805
What board do you have (on that page) that has a 18F2525 on it ?

They have a "low pin count" board. But it only has a 16F690 on it.
What board do you have ?
JacquesB
Guest







PostPosted: Mon May 26, 2008 12:20 pm     Reply with quote

The PIC18F2525 is monted on a PICDEM2 Plus board and it is running with the internal oscillator set to 4Mhz.
My program runs fine ( Rs232 interrupts, Timer 0 inetrrupts, SPI, ...) except for RA6 which stays low when I want to turn it ON. All other pins of PORTA can be controlled

I still think that the problem is related to the OSC1 OSC2 pins ( RA6 & RA7) that are normally used for an external cristal but I used the
#fuses INTRC_IO to make RA6&RA7 available as IO pins
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 26, 2008 12:40 pm     Reply with quote

What is your compiler version ? It's given at the start of the .LST file.
The .LST file is in your project directory. The compiler version is in
this format: x.xxx
JacquesB
Guest







PostPosted: Mon May 26, 2008 1:34 pm     Reply with quote

It is :
CCS PCH C Compiler, Version 4.071
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 26, 2008 1:45 pm     Reply with quote

That version should work.

Are you running a bootloader in the 18F2525 ? Are you certain that
the INTRC_IO fuse is really being programmed into the PIC ?
jacquesB
Guest







PostPosted: Wed May 28, 2008 8:51 am     Reply with quote

Sorry for the delay,

No there is no boot loader.
How can I be sure that the INTRC_IO is really being programmed ?
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