Page 1 of 1

downloaded code running at 500Khz

Posted: Tue Jan 15, 2019 5:48 pm
by gavin mack
Flowcode program runs fine on simulator, and when code is downloaded to 16f1937 using the 19Mhz external oscillator on eb-006.
modified the code to include the osccon code of 0x78 using intosc helper tool for 16Mhz, changed oscillator to internal in configuration and typed 16Mhz frequency in general options. moved clock jumper on eb-006 to ra6and7. see attached images for screen shots of settings. When revised code is downloaded to 16f1937 it runs as if the clock is set to 500Khz. flowcode program also attached.

Re: downloaded code running at 500Khz

Posted: Tue Jan 15, 2019 6:18 pm
by medelec35
Hi Gavin,
Have you tried the one second flash test to determine actual speed as there could be an issue affecting your results?
E.g issue with inputs as that is setting the delay time.

Re: downloaded code running at 500Khz

Posted: Tue Jan 15, 2019 6:39 pm
by medelec35
Ok I have worked out your issue.
You have placed

Code: Select all

OSCCON=0x78;
within commented out section.
So you need to use

Code: Select all

/*
  Enter C code below this comment
*/
 OSCCON = 0x78;
instead of

Code: Select all

/*
  Enter C code below this comment
 OSCCON = 0x78;
*/
As you are correct.
Since OSCCON=0x78; is within commented out section, Hardware is running at the default 500KHz internal osc speed, since OSCCON code is being ignored.
Move it out and you should be ok.

Re: downloaded code running at 500Khz

Posted: Wed Jan 16, 2019 10:11 am
by gavin mack
Thanks for that Martin, it works fine

Re: downloaded code running at 500Khz

Posted: Wed Jan 16, 2019 2:07 pm
by medelec35
That's great,
Thanks for letting me know.