Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem sa PIC16F15313 i NCO
#1
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)
    }
}
Reply


Messages In This Thread
Problem sa PIC16F15313 i NCO - by mikikg - 09-28-2024, 10:54 AM
RE: Problem sa PIC16F15313 i NCO - by gorankg - 09-28-2024, 12:30 PM
RE: Problem sa PIC16F15313 i NCO - by mikikg - 09-28-2024, 12:39 PM
RE: Problem sa PIC16F15313 i NCO - by mikikg - 09-28-2024, 12:50 PM
RE: Problem sa PIC16F15313 i NCO - by gorankg - 09-28-2024, 07:07 PM
RE: Problem sa PIC16F15313 i NCO - by mikikg - 09-29-2024, 02:23 PM
RE: Problem sa PIC16F15313 i NCO - by mikikg - 09-29-2024, 08:51 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)