This is regarding PIC16F1508
I wrote a simple program to switch on and off ports
Originally it was a large program filling almost 93% of the capacity. Since I found some strange behavior I decided to bare minimum for testing and understanding the system.
It runs at 16Mhz internal
#pragma config FOSC = INTOSC
#define _XTAL_FREQ 16000000
inside main()
OSCCON = 0b01111000;
TRISAbits.TRISA5=0;
TRISAbits.TRISA4=0;
TRISCbits.TRISC5=0;
TRISCbits.TRISC4=0;
TRISCbits.TRISC3=0;
TRISCbits.TRISC7=0;
inside while(1)
I just switched the ports to high
RA5=1; // pin -2 4.90v
RA4=1; //PIN 3 2.62v
RC5=1; // PIN 5 4.90v
RC4=1; // PIN 6 4.90V
RC3=1; // PIN 7 0.33V
RC7=1; // PIN 9 1.64V
The output voltage at the pins are different.
Why the difference ? I have checked it with another same microcontroller too. the result is same.
Some of these pins have priorities. for ex :
RA4 has CLKOUT-SOSCO-RA4
RC3 has PWM2- RC3
will such priorities determine the output ?
How can change / surpass those if it is relevant ?
what should be set to get full output voltages.
Is the __XTAL_FREQ not enough ?
Am I missing something here - looking at the wrong place?
any suggestions are greatly appreciated.
I wrote a simple program to switch on and off ports
Originally it was a large program filling almost 93% of the capacity. Since I found some strange behavior I decided to bare minimum for testing and understanding the system.
It runs at 16Mhz internal
#pragma config FOSC = INTOSC
#define _XTAL_FREQ 16000000
inside main()
OSCCON = 0b01111000;
TRISAbits.TRISA5=0;
TRISAbits.TRISA4=0;
TRISCbits.TRISC5=0;
TRISCbits.TRISC4=0;
TRISCbits.TRISC3=0;
TRISCbits.TRISC7=0;
inside while(1)
I just switched the ports to high
RA5=1; // pin -2 4.90v
RA4=1; //PIN 3 2.62v
RC5=1; // PIN 5 4.90v
RC4=1; // PIN 6 4.90V
RC3=1; // PIN 7 0.33V
RC7=1; // PIN 9 1.64V
The output voltage at the pins are different.
Why the difference ? I have checked it with another same microcontroller too. the result is same.
Some of these pins have priorities. for ex :
RA4 has CLKOUT-SOSCO-RA4
RC3 has PWM2- RC3
will such priorities determine the output ?
How can change / surpass those if it is relevant ?
what should be set to get full output voltages.
Is the __XTAL_FREQ not enough ?
Am I missing something here - looking at the wrong place?
any suggestions are greatly appreciated.
Attachments
-
80.8 KB Views: 4
