Fabri
Joined: 22 Aug 2005 Posts: 275
|
PIC18F66K22 PORTC doesn't change state some bits |
Posted: Tue Mar 25, 2014 2:51 pm |
|
|
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. |
|