Haphazard
Newbie level 3
Hi, I am a beginner in PIC programming and I found a problem while trying out my PIC18f4550, I am using MPLAB C18,
The PORTD7 and PORTC7 is unable to be placed on high, I would like to ask if there's anything wrong with my code initialization. I have simulated in MPLAB simulator (the output on the simulator appeared normal,but failed in hardware for D7 and C7) and also redeclared some of the SFRs that I fear might be causing this problem. The output in hardware for RC7 & RD7 is always 0V.
Thanks in advance
The PORTD7 and PORTC7 is unable to be placed on high, I would like to ask if there's anything wrong with my code initialization. I have simulated in MPLAB simulator (the output on the simulator appeared normal,but failed in hardware for D7 and C7) and also redeclared some of the SFRs that I fear might be causing this problem. The output in hardware for RC7 & RD7 is always 0V.
Code:
#include <p18f4550.h>
#include "delays.h"
#pragma config FOSC = HS
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRT = OFF
#pragma config BOR = OFF
#pragma config WDT = OFF
#pragma config MCLRE = ON
#pragma config PBADEN = OFF
#pragma config CCP2MX = ON
#pragma config LVP = OFF
#pragma config XINST = OFF
void main()
{
SPPCON=0x00;
CCP1CON=0x00;
CCP2CON=0x00;
UCON=0x00;
UCFG=0x00;
TRISD = 0x00;
TRISC = 0x00;
PORTD=0;
PORTC=0;
while(1)
{
PORTC=0X7F;
PORTD=0X7F;
}
}