Drugari,
da li neko zna u čemu je ovde greška da ovaj NCO oscilator ne radi?
Svašta sam probao i ne znam šta je tu sporno, probam GPIO togle na RA2 nararvno radi, NCO nema ništa 0.
Ovaj code sam iskopirao iz aplikacione note, to bi trebalo da radi ...
//------------------------ PIC16F15313 ------------------------------------------------
#include "xc.h"
void setup_nco(void) {
// Set the oscillator frequency to 16 MHz
OSCCON1bits.NOSC = 0b110; // Select HFINTOSC as the oscillator source
OSCFRQbits.HFFRQ = 0b110; // Set the HFINTOSC frequency to 16 MHz
NCO1CONbits.N1EN = 1; // Enable NCO module
NCO1CONbits.N1PFM = 0; // Fixed Duty Cycle mode
NCO1CONbits.N1POL = 0; // NCO output is active high
NCO1CLKbits.N1CKS = 0b01; // Clock source is FOSC = 16 MHz
NCO1INCL = 0x33; // Increment value low byte
NCO1INCH = 0x34; // Increment value high byte
RA2PPS = 0x13; // NCO output on RA2
}
void main(void) {
// Setup RA2 as output for NCO
TRISA2 = 0;
setup_nco(); // Initialize NCO
while (1) {
// Main loop (NCO will generate the frequency on RA2)
}
}
da li neko zna u čemu je ovde greška da ovaj NCO oscilator ne radi?
Svašta sam probao i ne znam šta je tu sporno, probam GPIO togle na RA2 nararvno radi, NCO nema ništa 0.
Ovaj code sam iskopirao iz aplikacione note, to bi trebalo da radi ...
//------------------------ PIC16F15313 ------------------------------------------------
#include "xc.h"
void setup_nco(void) {
// Set the oscillator frequency to 16 MHz
OSCCON1bits.NOSC = 0b110; // Select HFINTOSC as the oscillator source
OSCFRQbits.HFFRQ = 0b110; // Set the HFINTOSC frequency to 16 MHz
NCO1CONbits.N1EN = 1; // Enable NCO module
NCO1CONbits.N1PFM = 0; // Fixed Duty Cycle mode
NCO1CONbits.N1POL = 0; // NCO output is active high
NCO1CLKbits.N1CKS = 0b01; // Clock source is FOSC = 16 MHz
NCO1INCL = 0x33; // Increment value low byte
NCO1INCH = 0x34; // Increment value high byte
RA2PPS = 0x13; // NCO output on RA2
}
void main(void) {
// Setup RA2 as output for NCO
TRISA2 = 0;
setup_nco(); // Initialize NCO
while (1) {
// Main loop (NCO will generate the frequency on RA2)
}
}