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

PIC18F66K22 PORTC doesn't change state some bits

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



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PIC18F66K22 PORTC doesn't change state some bits
PostPosted: Tue Mar 25, 2014 2:51 pm     Reply with quote

Hi to all,

I'm in trouble with PIC18F66K22. PORTC pin C0 and C1 doesn't change state after drive in firmware. Same firmware work fine with PIC18F46K22.

This is test program:
Code:

#define PIC_66K22      // PICC4H

   #include "18F66K22.h"

   #if defined(debug)
   #fuses HSM,DEBUG,NOWDT,NOPROTECT,NOPUT,NOBROWNOUT,NOCPD,BORV18,NODEBUG,NOCPB,STVREN,NOPLLEN,NOFCMEN
   #device ADC=12 icd=true

   #else
   #fuses HSM,NODEBUG,WDT,PROTECT,PUT,CPD,BORV18,CPB,STVREN,NOPLLEN,NOFCMEN
   #device  ADC=12
   #endif

#device *=16

#BYTE   PORTA   = 0x0F80
#BYTE   PORTB   = 0x0F81
#BYTE   PORTC   = 0x0F82
#BYTE   PORTD   = 0x0F83
#BYTE   PORTE   = 0x0F84
#BYTE   PORTF   = 0x0F85
#BYTE   PORTG   = 0x0F86

#byte   ODCON1= 0xF29
#byte   ODCON2= 0xF28
#byte   ODCON3= 0xF27

#byte   LATC = 0xF8B

#fill_rom 0x00

#use delay(clock=16000000,RESTART_WDT)

void main() {

//Definisci I/0 in base allo schema
restart_wdt();

set_tris_a(0x00);
set_tris_b(0x00);
set_tris_c(0x00);
set_tris_d(0x00);
set_tris_e(0x00);
set_tris_e(0x00);
set_tris_f(0x00);

PORTA = (0x00);
PORTB = (0x00);
PORTC = (0x00);
PORTD = (0x00);
PORTE = (0x00);
PORTF = (0x00);
PORTG = (0x00);

LATC=0xff;

ODCON1=0;
ODCON2=0;
ODCON3=0;
SETUP_CCP1(CCP_OFF);
SETUP_CCP2(CCP_OFF);
SETUP_CCP3(CCP_OFF);


   while(true) {
      output_high(PIN_C2);
      output_high(PIN_C1);
      output_high(PIN_C0);
      output_high(PIN_D7);
      delay_ms(10);
      output_low(PIN_C1);
      output_low(PIN_C0); 
      output_low(PIN_D7);
      output_low(PIN_C2);
      delay_ms(10);
   }
}

When I drive on PIN_C2 and PIN_D7 they change state without problem but when I drive on PIN_C1 and PIN_C0 I can see the bit change state in LATC register but not in PORTC. I tested in debug with ICD2, ICD3 and run in hardware.

What is wrong ?

I use CCS V4.135.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Mar 25, 2014 2:58 pm     Reply with quote

See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=51950
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Tue Mar 25, 2014 3:34 pm     Reply with quote

Opss...
I replied to the wrong thread.... Embarassed

Thanks PCM. Now it's work.
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