Pic 18F87J94 clock timing problem
Pic 18F87J94 clock timing problem
Hello, I've been using your basic compiler pro and have several development boards for a few years now and I love it. I'd post it on the forum, it is critical to my project to resolve this. It may be all my fault also.
I'm using the Microchip PicDem 18 board and a 18F87J94 PIM (plug in module ) since the easyPic 7 pro board does not support this chip yet. The compiler is MikroEmBasic pro 6.4. I have replaced the primary OSC on the PicDem board with a 20mhz crystal and I do have 20mhz at the 18f87j94 osc1 pin.
My problem is with the 18f87j94 configured for a 20mhz primary osc it should be running at 64mhz internal clock with 96mhz pll as I have it configured. As you can see with the attached code when running a loop of bcf, bsf at 4 cycles per instruction and 64mhz /8 = 8mhz at portd.0 and that is what I see on a o-scope. This is correct.
When I run a setbit, clearbit loop the timing is way off. To see this please run and check with a o-scope with the ASM code. Then comment out the ASM code and uncomment the setbit - clearbit code and you should see that the timing is way off.
I thank you very much for looking at this. It is a very important project for me and my client is beating me up to get this to work.
I am going to try to set the chip up to use the internal clock and pll and see if that makes a difference.
It may be all my fault but can you please take a look.
I am using MPLAB 8.92 and a IDC3 to program the chip. I import the .HEX created by MikroE basic pro then program.
Thank you
Doug McDonald
dougm@unicorpok.com
dmtulsa@cox.net
Please see attached file, zipped source code
I'm using the Microchip PicDem 18 board and a 18F87J94 PIM (plug in module ) since the easyPic 7 pro board does not support this chip yet. The compiler is MikroEmBasic pro 6.4. I have replaced the primary OSC on the PicDem board with a 20mhz crystal and I do have 20mhz at the 18f87j94 osc1 pin.
My problem is with the 18f87j94 configured for a 20mhz primary osc it should be running at 64mhz internal clock with 96mhz pll as I have it configured. As you can see with the attached code when running a loop of bcf, bsf at 4 cycles per instruction and 64mhz /8 = 8mhz at portd.0 and that is what I see on a o-scope. This is correct.
When I run a setbit, clearbit loop the timing is way off. To see this please run and check with a o-scope with the ASM code. Then comment out the ASM code and uncomment the setbit - clearbit code and you should see that the timing is way off.
I thank you very much for looking at this. It is a very important project for me and my client is beating me up to get this to work.
I am going to try to set the chip up to use the internal clock and pll and see if that makes a difference.
It may be all my fault but can you please take a look.
I am using MPLAB 8.92 and a IDC3 to program the chip. I import the .HEX created by MikroE basic pro then program.
Thank you
Doug McDonald
dougm@unicorpok.com
dmtulsa@cox.net
Please see attached file, zipped source code
- Attachments
-
- SIG Caliper Tool j94.zip
- (62.46 KiB) Downloaded 148 times
Doug
KD5NWK
KD5NWK
Re: Pic 18F87J94 clock timing problem
My Agilent scope will not do screen shots. But after the weekend when I get back to work I' show that using ASM the clocks are correct but when using mBasic code the timing is off by around 20% with my Tek-mso scope. Using an external osc or the internal FRCPLL the asm code is correct and the mBasic code is not. I have attached the code in a prior post. Please some one at mikroE take a look at this. Code in MPLAB works fine so I can only guess there is something wrong with a setting in Mbasic for this chip. I may be wrong, if so I'm sorry.
Thank you
Thank you
Doug
KD5NWK
KD5NWK
Re: Pic 18F87J94 clock timing problem
Please see attached document that shows 0-scope screen shots of the timing problems. Also attached is the projects for both 20mhz and FRC clocks
Doug
KD5NWK
KD5NWK
Re: Pic 18F87J94 clock timing problem
Hi,
I have tested today this very chip on 64 MHz and it works OK.
The project attached is for mikroC, but it will give you enough information.
Try this and inform me of the results.
Regards,
Filip.
I have tested today this very chip on 64 MHz and it works OK.
The project attached is for mikroC, but it will give you enough information.
Try this and inform me of the results.
Regards,
Filip.
- Attachments
-
- Led Blinking.rar
- (1.84 KiB) Downloaded 155 times
Re: Pic 18F87J94 clock timing problem
Filp, I tried the program you posted. I used my ICD3 and MPLAB to download the .hex file. It doesn't do anything. It should toggle ports A-E every second but nothing happens. I reloaded the programs I posted and they work but for the timing issue.
I do not have the C compiler so there's not much I can do to see whats wrong. I did notice that your .cgf is very different than the one's I posted with my project.
I have down loaded some .hex files from microchip and everything seems to work fine.
Again I'm using the PICdem 18 board with the 18f87j94 PIM for it. This should not make any difference.
Any more ideas
I do not have the C compiler so there's not much I can do to see whats wrong. I did notice that your .cgf is very different than the one's I posted with my project.
I have down loaded some .hex files from microchip and everything seems to work fine.
Again I'm using the PICdem 18 board with the 18f87j94 PIM for it. This should not make any difference.
Any more ideas
Doug
KD5NWK
KD5NWK
Re: Pic 18F87J94 clock timing problem
Flip, I think I see the problem. The project you sent is set up for 8 mhz primary osc. As I said in an earlier post I'm using a 20mhz osc. on the PicDem-18 board. I can also use FRC for testing purposes.
Can you please change the config and re-build the project and send it to me again.
Thank you
Doug
Can you please change the config and re-build the project and send it to me again.
Thank you
Doug
Doug
KD5NWK
KD5NWK
Re: Pic 18F87J94 clock timing problem
Hi,
Please find the project in the attachment.
Regards,
Filip.
Please find the project in the attachment.
Regards,
Filip.
- Attachments
-
- LedBlinking.rar
- (1.79 KiB) Downloaded 157 times
Re: Pic 18F87J94 clock timing problem
Flip, with the change to the config the C program works correctly. I can only assume that there is an error in the basic compiler or support files having to do with the 18Fx7J94 chips.
Thank you
Doug
Thank you
Doug
Doug
KD5NWK
KD5NWK
Re: Pic 18F87J94 clock timing problem
Iam following this with some interest since we are also using this chip with the same external oscillator.
I assume it is probably an oversight but in the last project attached, the Primary oscillator select config has been set to MS ie 3.5 to 10MHz, which I assume should be set to HS.
CS
I assume it is probably an oversight but in the last project attached, the Primary oscillator select config has been set to MS ie 3.5 to 10MHz, which I assume should be set to HS.
CS
Re: Pic 18F87J94 clock timing problem
Which project exactly where you talking about? Of the two I posted the 20mhz was set to HS w/PLL and the other was set to FRC MS with PLL. The last Flip sent your correct it was set at config2H 20mhz /5 pll but in config3L it was set as MS. I didn't catch that but it worked okay as far as the timing went.
I think it is pretty clear there is an issue with basic pro 6.4.0 This chip family was just added with this version.
Thanks
Doug
I think it is pretty clear there is an issue with basic pro 6.4.0 This chip family was just added with this version.
Thanks
Doug
Doug
KD5NWK
KD5NWK
Re: Pic 18F87J94 clock timing problem
Hi,
The only thing that was an issue here is the incorrect setting of the configuration bits in the Edit Project.
I have attached an example program to demonstrate this.
Regards,
Filip.
I think there is no issue with this version regarding the reported problem.I think it is pretty clear there is an issue with basic pro 6.4.0 This chip family was just added with this version.
The only thing that was an issue here is the incorrect setting of the configuration bits in the Edit Project.
I have attached an example program to demonstrate this.
Yes, this is an oversight, but it worked out anyway.I assume it is probably an oversight but in the last project attached, the Primary oscillator select config has been set to MS ie 3.5 to 10MHz, which I assume should be set to HS.
Regards,
Filip.
Re: Pic 18F87J94 clock timing problem
Flip, Did you forget to attach the project. I hope your correct that it is only a config issue. I assume that your going to attach has the proper config showing me my error
Thank you
Thank you
Doug
KD5NWK
KD5NWK
Re: Pic 18F87J94 clock timing problem
I think there is some confusion. The config HS / MS error was in your C example not in my project. I still have the same issue. If it was in my project can you please tell me what the error is. As per the data sheet everything is correct unless I made a stupid mistake.I think there is no issue with this version regarding the reported problem.
The only thing that was an issue here is the incorrect setting of the configuration bits in the Edit Project.
Your last post suggested your posting another "working" project I assume in basic. I have not seen that posted yet.
Thank you
Doug
KD5NWK
KD5NWK
Re: Pic 18F87J94 clock timing problem
Hi,
I forgot to attach the project, please find it attached now.
It is set for 20 MHz input clock source and 64 MHz MCU clock.
Regards,
Filip
I forgot to attach the project, please find it attached now.
It is set for 20 MHz input clock source and 64 MHz MCU clock.
Regards,
Filip
- Attachments
-
- LedBlinking.rar
- (1.37 KiB) Downloaded 126 times
Re: Pic 18F87J94 clock timing problem
Flip, Sorry to say this but the file you uploaded would not run. You had the clock source set to 64mhz when it should have been set to 20mhz. When I set it to 20 it ran but the timing is still off by the same amount. Each 1 second pulse in code shows 400ms on the scope. I really need to get this fixed or I'm going to loose this contract work.
Thank you
Thank you
Doug
KD5NWK
KD5NWK