What frequency are you expecting to output?? With 255 byte sine wave, and doing absolutely nothing else, with A 20Mhz crystal, it will yield 19Khz if you're lucky..
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
What frequency are you expecting to output?? With 255 byte sine wave, and doing absolutely nothing else, with A 20Mhz crystal, it will yield 19Khz if you're lucky..
What frequency are you expecting to output?? With 255 byte sine wave, and doing absolutely nothing else, with A 20Mhz crystal, it will yield 19Khz if you're lucky..
I want to make inverter so, required freq from output should be 50hz but at uC it should be 100hz i think...
Hi, check out this page, these is already PIC code there for making sine waves for push-pull inverters, at 50 Hz;
https://www.romanblack.com/one_sec.htm
Converting 50Hz to 60Hz (12 : 10);
#include <htc.h>
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);
#define _XTAL_FREQ 20000000
unsigned char sin_array[39]={128,137,146,154,163,171,179,187,194
,200, 206,212,216,220,224,227,228,229,230,229,228,227,224,220,
216,212,206,200,194,187,179,171,163,154,146,137,128 };
void main (void) {
TRISB=0X00;
TRISA = 0xff ;
PEIE=1;
TRISC = 0 ;
PR2 = 0b11111001 ;
T2CON = 0b00000100 ;
CCP1CON = 0b00111100;
PORTC = 0 ;
while(1){
for(int i=0;i<=40;i++) {
CCPR1L = sin_array[i] ;
}
}
}
...
I'm going troll.
Please stop feeding the troll.
...
#include <htc.h>
#include <math.h>
#include <stdio.h>
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);
#define _XTAL_FREQ 20000000
unsigned char sin_array[38]={128,137,146,154,163,171,179,187,194
,200, 206,212,216,220,224,227,228,229,230,229,228,227,224,220,
216,212,206,200,194,187,179,171,163,154,146,137,128 };
void main (void) {
TRISB=0X00;
TRISA = 0xff ;
PEIE=1;
TRISC = 0 ;
PR2 = 0b11111001 ;
T2CON = 0b00000100 ;
CCP1CON = 0b00111100;
PORTC = 0 ;
while(1){
for(int i=0;i<=38;i++) {
__delay_ms(10);
CCPR1L = sin_array[i] ;
}
}
}
hi guys,
Please stop abusive posts about Ritesh, some of your remarks have crossed the line, any further abusive posts will be Moderated.
Let the members who want to help an OP do so, without cluttering up a Thread with unhelpful comments.
Repeating again, whats been posted a number of times, you are under no obligation to help an OP with his project.
Eric
Moderation