-->
Page 8 of 14

Re: High Frequency pwm?!

PostPosted: Fri Jun 23, 2017 9:27 am
by urbanze
Dakota wrote:Thank a lot for your answer. I make this piece of code , it seems to work in a ESP8266 (Lolin nodemcu v3)
It give a 77.5 khz signal ( a lot of noise at least in my radio receiver XDD , I have not any oscilloscope :? )
but my clock does not syncronize, it does not work :cry: :cry: :cry:

Antenna is pin D8
-----------------------------------------------------------
#define Antenna D8
unsigned long frec = 80000000L / 77500 ;
volatile unsigned long next;

boolean TickTock = false;

void inline radioISR(void){

TickTock = !TickTock;
digitalWrite(Antenna,TickTock);
timer0_write(ESP.getCycleCount()+frec);

}

void setup()
{

noInterrupts();
timer0_isr_init();
timer0_attachInterrupt(radioISR);
timer0_write(ESP.getCycleCount()+frec);
interrupts();

}
----------------------------------------------------------------


try to use OS_TIMER_US, i tested and works! find in google how to active OS_TIMER_US, because is default "disable".. if you can't do this, tell me. i help you!

Re: High Frequency pwm?!

PostPosted: Fri Jun 23, 2017 3:24 pm
by schufti
with the wifi not disabled, there will be no stable frequency.
without knowing the accurate crystal frequency you will most likely be way off the correct frequency for the receiver to detect.
with only an unmodulated carrier, what do you expect the clock to do?

Re: High Frequency pwm?!

PostPosted: Sat Jun 24, 2017 6:32 am
by Dakota
Do you really think that I expec to to syncronize a radio clock with only this code ?
:D
Crystal freq is 80 Mhz , isn't ?

Thanks for your answer.



Code: Select allvoid modulate(byte b)
{
 
   if (b == 0)
   {
     digitalWrite(LedPin,LOW);

     delay(100);

     digitalWrite(LedPin,HIGH);
   }
   else
   {
     digitalWrite(LedPin,LOW);

     delay(200);

     digitalWrite(LedPin,HIGH);
   }
 
}



schufti wrote:with the wifi not disabled, there will be no stable frequency.
without knowing the accurate crystal frequency you will most likely be way off the correct frequency for the receiver to detect.
with only an unmodulated carrier, what do you expect the clock to do?

Re: High Frequency pwm?!

PostPosted: Sat Jun 24, 2017 6:43 am
by Dakota
Thanks a lot. Any help wil be great.
This is my code right know.

https://pastebin.com/Yi2UepfX

The original program is for arduino ... I just change it a bit :)


[/quote]

try to use OS_TIMER_US, i tested and works! find in google how to active OS_TIMER_US, because is default "disable".. if you can't do this, tell me. i help you![/quote]