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

PIC18F8722 PORT H I/O "squashes" PIN C5 signal

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



Joined: 16 Jun 2009
Posts: 2

View user's profile Send private message

PIC18F8722 PORT H I/O "squashes" PIN C5 signal
PostPosted: Tue Jun 16, 2009 4:39 pm     Reply with quote

PCH V4.079

I have a stubborn issue with PORTH I/O effecting pin C5 on a PIC18F8722. C5 works fine unless any I/O on PORTH comes first. I thought it was an SPI issue, but I finally cut the code down to the following.

Code:
#include <18F8722.h>
#device ICD=TRUE
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPROTECT                //Code not protected from reading
#FUSES IESO                     //Internal External Switch Over mode enabled
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BORV25                   //Brownout reset at 2.5V
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOCPD                    //No EE protection
#FUSES STVREN                   //Stack full/underflow will cause reset
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOCPB                    //No Boot Block code protection
#FUSES NOEBTRB                  //Boot block not protected from table reads
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOWRTD                   //Data EEPROM not write protected
#FUSES NOWRTC                   //configuration not registers write protected
#FUSES NOWRTB                   //Boot block not write protected
#FUSES FCMEN                    //Fail-safe clock monitor enabled
#FUSES LPT1OSC                  //Timer1 configured for low-power operation
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES MCU                      //Microcontroller Mode
#FUSES NOWAIT                   //Wait selections unavailable for Table Reads or Table Writes
#FUSES BW16                     //16-bit external bus mode
#FUSES ABW20                    //20-bit Address bus
#FUSES ECCPE                    //Enhanced CCP PWM outpts multiplexed with RE6 thorugh RE3

#use delay(clock=10000000)
#use rs232(baud=19200,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)


and ....

Code:
#include "main.h"

void main()
{
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF|ADC_TAD_MUL_0);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_spi2(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   setup_timer_4(T4_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);

   // PIN_C5 toggles (below) if this line is commented-out
   // Any INPUT or OUTPUT on a PORTH pin "squashes" C5
   output_high(PIN_H0);
   
   while(1){
      output_bit(PIN_C3, 1);
      output_bit(PIN_C5, 1);
      output_bit(PIN_B3, 1);
      delay_ms(500);
      output_bit(PIN_C3, 0);
      output_bit(PIN_C5, 0);
      output_bit(PIN_B3, 0);
      delay_ms(500);
   }
}


I have checked several boards. There are no shorts or tracking problems. In the example above C3 and B3 toggle just fine. But C5 is high at ~0.7 volts and low at 0.

Any suggestions would be very welcome (deadline looming / project stuck).

Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jun 16, 2009 5:05 pm     Reply with quote

Quote:
setup_spi(SPI_SS_DISABLED);
setup_spi2(SPI_SS_DISABLED);

Get rid of these two lines and see what happens.

If that doesn't fix it, then try a striped down program, like this:
Code:
#include <18F8722.h>
#fuses HS,NOWDT,PUT,NOBROWNOUT,NOLVP
#use delay(clock=10000000)

//=================================
void main()
{
output_high(PIN_H0);
   
while(1)
  {
   output_bit(PIN_C5, 1);
   delay_ms(500);
   output_bit(PIN_C5, 0);
   delay_ms(500);
   }
 
}
PIC_evolution



Joined: 16 Jun 2009
Posts: 2

View user's profile Send private message

PostPosted: Tue Jun 16, 2009 8:48 pm     Reply with quote

Thanks PCM programmer. It turned out to be a short after all.
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