SPI clock speed 18F4620 Oshonsoft

ericgibbs

Joined Jan 29, 2010
21,463
1/ I included OSCTUNE.PLLEN = 1 'OSCx4 No difference in the reading. I've been finding that PLLEN X4 hasn't worked!
hi C,
Your scope shots, which I superimposed in post #18, show a clear increase in frequency, by a factor 4.

No difference in the reading

Which Reading.??

E
 

Thread Starter

camerart

Joined Feb 25, 2013
3,842
Define clock_frequency = tells to basic compiler what the real frequency is, which is set in oscillator settings.
The compiler uses this information at least in software delays WaitUs, WaitMs, maybe in other software based timings.
Hi J,
1/ Do all of these settings:
Define CLOCK_FREQUENCY =
HFINTOSC
OSCCON
OSCTUNE
affect both the Oshonsoft SIM and the PIC when running LIVE?

2/ Why is Define CLOCK_FREQUENCY =, and the frequency setting in OSCCON both needed?
C.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,842
Hi,
Here is a snippet from another forum, where I think the program is 'C' and not Oshonsoft, where the conversations are exactly parallel to these.

This may account for the two different speeds in #18, and could be a characteristic of the 18F46K20 PIC.

Hopefully once the settings have been accepted by the compiler, the program will stay with correct timing?
C.
 

Attachments

jjw

Joined Dec 24, 2013
823
1/ Yes

2/ OSCCON sets the clock frequency.
The compiler does not understand what the bits in Osccon mean. You have to set the right bits.
Define clock_frequency says what frequency you have set in Osccon.
The compiler needs to know the frequency to make the software delays waitus, waitms correct.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,842
hi C,
Your scope shots, which I superimposed in post #18, show a clear increase in frequency, by a factor 4.

No difference in the reading

Which Reading.??

E
Hi E,
Just spotted this post!

See #23 for a possible change in frequency, which wasn't replicated in the tests.

Which reading? The oscilloscope reading didn't change when PLL was introduced, also see #23 for a similar experience.
C.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,842
1/ Yes

2/ OSCCON sets the clock frequency.
The compiler does not understand what the bits in Osccon mean. You have to set the right bits.
Define clock_frequency says what frequency you have set in Osccon.
The compiler needs to know the frequency to make the software delays waitus, waitms correct.
Hi I,
Sorry for repeating my past questions.

Is this correct:
OSCCON set to 8MHz
PLL set to X4
Define clock_frequency set to 32MHz
(Now I see it written down it's obvious :) )
C.
 

ericgibbs

Joined Jan 29, 2010
21,463
hi,
If you are confident the compiler is at fault, contact Vlad at Oshonsoft.
I have SPI projects working with int osc = 8MHz and *4 PLL == 32MHz and I have no problems.

Lets know what Vlad replies.
E
 

ericgibbs

Joined Jan 29, 2010
21,463
hi C,
I have a written a short test program for the PIC18F4620.
Using the real time counter in the Oshonsoft IDE, the Waitms command always gives the correct delay period 8MHz PLL in or out.
Could you summarise on exactly what you are saying the fault is that you are reporting.?

E
 

Thread Starter

camerart

Joined Feb 25, 2013
3,842
hi,
If you are confident the compiler is at fault, contact Vlad at Oshonsoft.
I have SPI projects working with int osc = 8MHz and *4 PLL == 32MHz and I have no problems.

Lets know what Vlad replies.
E
Hi E,
I'm not confident yet.

FROM #23: I also have projects working ok, until I changed to 18F46'K'20. This 'K' PIC isn't fully supported by Oshonsoft, but the TXT in #23, shows that it isn't only OSH. Is your PIC a 'K' variety?

I'm now getting the 'rules' for setting timings, and will do some tests, later. (Got to make a Tortoise hibernation box today)

( A note from distant memory: I have had compiler failings with series16 PICs, but after copying and pasting them into a TXT file, then re-opening them in OSH, seemed to clear the problem!?.)
C.
 
Last edited:

ericgibbs

Joined Jan 29, 2010
21,463
hi,
Knowing your project, I don't understand why you are trying use a 'K' version with all the limitations is has with Oshonsoft.?
E
AA1 18-Oct-18 12.29.gif
 
Top