Starting with PIC18Fxxxx
Moderator: Benj
-
MJU
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
Starting with PIC18Fxxxx
Dear Flowcode people.
No coding, no limits. Great stuff Flowcode.
I have the latest version of Flowcode V4.3.7.63 Pro for PIC's with PPP V3 version 3.9.12.26
I always been told that I could start with plugging a PIC in the "E-blocks USB Multiprogrammer" and put the program I've made into the PIC and start using it.
After I tried it with a 18F4685 (and the PIC wouldn't be erased after a few tries) I bought the 18F4550.
My guess was that the chip that is been used in the ECIO would work fine with the rest of the MM material.
But no, the simple chip settings doesn't know the chip.
The expert settings work a few times but then the chip doesn't get erased anymore after a few tries.
All I want is to put a program into the chip and test it.
No advanced settings like USB and so on.
It seems I should read the datasheets for the chip before I can use the chip?
Is there a text by MM that explains how I should set the chip settings for a particular program?
My guess was that Flowcode was for the beginner, or the user that doesn't want to read a few hundred pages of datasheet before making a working program?
Flowcode is great stuff, no doubt about it, but I think some more info for the new PIC users is necessary.
All I want is to use the 18F4550 to read a temperature and write the data onto my Card Reader board.
Some more explanation on how to set the expert settings would be great.
Thanks
No coding, no limits. Great stuff Flowcode.
I have the latest version of Flowcode V4.3.7.63 Pro for PIC's with PPP V3 version 3.9.12.26
I always been told that I could start with plugging a PIC in the "E-blocks USB Multiprogrammer" and put the program I've made into the PIC and start using it.
After I tried it with a 18F4685 (and the PIC wouldn't be erased after a few tries) I bought the 18F4550.
My guess was that the chip that is been used in the ECIO would work fine with the rest of the MM material.
But no, the simple chip settings doesn't know the chip.
The expert settings work a few times but then the chip doesn't get erased anymore after a few tries.
All I want is to put a program into the chip and test it.
No advanced settings like USB and so on.
It seems I should read the datasheets for the chip before I can use the chip?
Is there a text by MM that explains how I should set the chip settings for a particular program?
My guess was that Flowcode was for the beginner, or the user that doesn't want to read a few hundred pages of datasheet before making a working program?
Flowcode is great stuff, no doubt about it, but I think some more info for the new PIC users is necessary.
All I want is to use the 18F4550 to read a temperature and write the data onto my Card Reader board.
Some more explanation on how to set the expert settings would be great.
Thanks
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Starting with PIC18Fxxxx
Hello,
Thats odd I have used the 18F4550 device a lot with the EB006 and never had any erasing problems. Can you tell me what voltage PSU you are using with the board? Also do you have any load connected to pins RB6 and RB7.
No simple config settings for 18F devices as their configurations are a lot more complicated and we would have to guess at the required settings. Eg to use the PLL oscillator multiplier or not. I provide config settings for the 18F USB devices in one of my USB articles.
Are you doing anything different eg wiring up your own hardware or putting excessive voltages onto any of the I/O etc?
Thats odd I have used the 18F4550 device a lot with the EB006 and never had any erasing problems. Can you tell me what voltage PSU you are using with the board? Also do you have any load connected to pins RB6 and RB7.
No simple config settings for 18F devices as their configurations are a lot more complicated and we would have to guess at the required settings. Eg to use the PLL oscillator multiplier or not. I provide config settings for the 18F USB devices in one of my USB articles.
Are you doing anything different eg wiring up your own hardware or putting excessive voltages onto any of the I/O etc?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Steve
- Matrix Staff
- Posts: 3434
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: Starting with PIC18Fxxxx
Flowcode supports almost 300 PICmicro chips now, and often the configuration settings for these devices are complicated - so it is difficult to provide support within Flowcode for each device.
Here are some general tips which may help:
* keep Low Voltage Programming disabled (unless your hardware needs it)
* disable any "Debug" features in the configuration settings
* keep the code/memory protection features disabled
* use an external clock source (and settings) and external MCLR where possible
The other main problem with config settings is the clock and often there are multiple settings that affect the actual clock speed of the chip. To get around this, start with a very simple LED flashing program so you can get the hardware running at the same clock speed as that set within Flowcode.
Once you have got accurate timing sorted, you should be able to create more complex programs without altering the config data.
We are looking at ways of making the config settings easier to use for beginners, but unfortunately there is no substitute for reading and understanding the datasheet configuration options.
Here are some general tips which may help:
* keep Low Voltage Programming disabled (unless your hardware needs it)
* disable any "Debug" features in the configuration settings
* keep the code/memory protection features disabled
* use an external clock source (and settings) and external MCLR where possible
The other main problem with config settings is the clock and often there are multiple settings that affect the actual clock speed of the chip. To get around this, start with a very simple LED flashing program so you can get the hardware running at the same clock speed as that set within Flowcode.
Once you have got accurate timing sorted, you should be able to create more complex programs without altering the config data.
We are looking at ways of making the config settings easier to use for beginners, but unfortunately there is no substitute for reading and understanding the datasheet configuration options.
-
MJU
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
Re: Starting with PIC18Fxxxx
Thank you both for the response.
I have the PSU that was send with the bundle.
I have disabled the features that were described by Steve and I get result.
Last time with the 18F4685 even with help from a friend I didn't get the program to work.
Now (with your comments) I've got a flashing LED program working.
The only thing that doesn't work is the LCD on PortA, it shows strange signs, but that is a timing problem.
I just have to find the right setting for the 19.6608Mhz Xtal on the board. (if you should know the right setting?)..
Thanks again guys, I'm faithful to MM products but sometimes when I'm in a hurry things like this get me annoyed.
THANK YOU!
I have the PSU that was send with the bundle.
I have disabled the features that were described by Steve and I get result.
Last time with the 18F4685 even with help from a friend I didn't get the program to work.
Now (with your comments) I've got a flashing LED program working.
The only thing that doesn't work is the LCD on PortA, it shows strange signs, but that is a timing problem.
I just have to find the right setting for the 19.6608Mhz Xtal on the board. (if you should know the right setting?)..
Thanks again guys, I'm faithful to MM products but sometimes when I'm in a hurry things like this get me annoyed.
THANK YOU!
-
saschech@gmx.de
- Posts: 714
- Joined: Wed Jan 31, 2007 12:41 pm
- Has thanked: 1 time
- Been thanked: 26 times
Re: Starting with PIC18Fxxxx
Hello MJU
I have the same Problem fixed with my one lcd-macro...
http://www.matrixmultimedia.com/mmforum ... 993#p16993
I think also it is a time-problem.
Regards Wolfgang
I have the same Problem fixed with my one lcd-macro...
http://www.matrixmultimedia.com/mmforum ... 993#p16993
I think also it is a time-problem.
Regards Wolfgang
-
MJU
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
Re: Starting with PIC18Fxxxx
I've got a piece of the timing problem solved with the 18F4550.
I have made a flashing LED flow and that does work, but...
When I send the ASCII code via the LCD macro, the sign is printed well on the LCD.
When I use the print string the signs on the LCD are very strange, nothing readable.
Is there a flaw in the LCD macro?
Am I doing something wrong?
Any help is welcome...
I have made a flashing LED flow and that does work, but...
When I send the ASCII code via the LCD macro, the sign is printed well on the LCD.
When I use the print string the signs on the LCD are very strange, nothing readable.
Is there a flaw in the LCD macro?
Am I doing something wrong?
Any help is welcome...
-
MJU
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
Re: Starting with PIC18Fxxxx
Thank you Steve,
Here is my spectacular "everlasting flashing LED flow"
Here is my spectacular "everlasting flashing LED flow"
- Attachments
-
- Test1.fcf
- Problem with the LCD, only send ASCII works
- (7.5 KiB) Downloaded 322 times
-
MJU
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
Re: Starting with PIC18Fxxxx
The macro's that print a ASCII code were in the previous version macro's that printed "strings" to the LCD.
I've changed it back to the version with the "print string" macro.
This version is attached.
I've changed it back to the version with the "print string" macro.
This version is attached.
- Attachments
-
- Test1.fcf
- Another version with print string
- (7.5 KiB) Downloaded 306 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Starting with PIC18Fxxxx
Hello,
I think I see the problem.
In the project options you are specifying a 19.6608 MHz crystal. In the configuration you are specifying a 20MHz crystal to drive the PLL. The PLL will run at 48MHz so you should either update the clock frequency in the project options to 48000000 and use a 20MHz crystal or you should disable the PLL and switch to a HS oscillator in the configuration and use the 19.6608MHz crystal.
I think I see the problem.
In the project options you are specifying a 19.6608 MHz crystal. In the configuration you are specifying a 20MHz crystal to drive the PLL. The PLL will run at 48MHz so you should either update the clock frequency in the project options to 48000000 and use a 20MHz crystal or you should disable the PLL and switch to a HS oscillator in the configuration and use the 19.6608MHz crystal.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
MJU
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
Re: Starting with PIC18Fxxxx
Thank you BenJBenj wrote:Hello,
I think I see the problem.
In the project options you are specifying a 19.6608 MHz crystal. In the configuration you are specifying a 20MHz crystal to drive the PLL. The PLL will run at 48MHz so you should either update the clock frequency in the project options to 48000000 and use a 20MHz crystal or you should disable the PLL and switch to a HS oscillator in the configuration and use the 19.6608MHz crystal.
How can I disable the PLL?
Using another Xtal is difficult because I use the MM multiprogrammer with it's own Xtal.
-
Sean
- Valued Contributor

- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: Starting with PIC18Fxxxx
I have downloaded your program and sent it to several devices. All worked when configured correctly.
1.
One common problem, especially with string functions, is the Extended CPU Enable option available with some devices. This regularly causes problems when enabled and should be disabled unless the the extended features are required and properly supported.
2.
Clock settings are becomming more difficult to define as devices with PLLs and prescaler options are becomming common. The clock frequency seen by the processor may not be the frequency written on the xtal, but needs to be calculated from the configuration options selected.
With the configuration settings used in the program the 20MHz (19.6608MHz) xtal frequency is divided down to a 4MHz reference frequency (the OSC Select: div by 5 option) and multiplied up to 96MHz by the PLL. The CPU and USB susyem are then clocked at this frequency divided by 2 (48MHz).
With the Flowcode clock speed set at 19660800Hz, the LED flash rate was approximately 2.5 times faster than expected. This affects all timer and delay functions, including those used by the LCD macros.
Setting the Flowcode clock speed value (View -> Project Options menu) to 48000000 corrected all the timing problems.
An LED flash program should always flash at the programmed frequency to prove that the clock options have been set correctly.
Some devices with PLLs, especially the ones that also support USB, have a range of preferred xtal frequencies (those that are easy to use to generate the accurate 48MHz required by USB). The 19.6608MHz xtal supplied as standard has been selected to allow accurate generation of UART (RS232) Baud rates. If USB is a requirement, alternative frequencies may be preferred by the PLL (4MHz, 8MHz, 16MHz, 20MHz etc.). The xtals on the programmer boards are in sockets and can easily be changed to match device requirements.
1.
One common problem, especially with string functions, is the Extended CPU Enable option available with some devices. This regularly causes problems when enabled and should be disabled unless the the extended features are required and properly supported.
2.
Clock settings are becomming more difficult to define as devices with PLLs and prescaler options are becomming common. The clock frequency seen by the processor may not be the frequency written on the xtal, but needs to be calculated from the configuration options selected.
With the configuration settings used in the program the 20MHz (19.6608MHz) xtal frequency is divided down to a 4MHz reference frequency (the OSC Select: div by 5 option) and multiplied up to 96MHz by the PLL. The CPU and USB susyem are then clocked at this frequency divided by 2 (48MHz).
With the Flowcode clock speed set at 19660800Hz, the LED flash rate was approximately 2.5 times faster than expected. This affects all timer and delay functions, including those used by the LCD macros.
Setting the Flowcode clock speed value (View -> Project Options menu) to 48000000 corrected all the timing problems.
An LED flash program should always flash at the programmed frequency to prove that the clock options have been set correctly.
Some devices with PLLs, especially the ones that also support USB, have a range of preferred xtal frequencies (those that are easy to use to generate the accurate 48MHz required by USB). The 19.6608MHz xtal supplied as standard has been selected to allow accurate generation of UART (RS232) Baud rates. If USB is a requirement, alternative frequencies may be preferred by the PLL (4MHz, 8MHz, 16MHz, 20MHz etc.). The xtals on the programmer boards are in sockets and can easily be changed to match device requirements.
-
MJU
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
Re: Starting with PIC18Fxxxx
Hey sean,
If you were a girl I would kiss you after this last post!
It seems that the Extended CPU Enable was the setting that caused the problem.
Again: thanks to you all @ MM.
Maybe this posting could be something to spread in datasheets for some hardware?
If you were a girl I would kiss you after this last post!
It seems that the Extended CPU Enable was the setting that caused the problem.
Again: thanks to you all @ MM.
Maybe this posting could be something to spread in datasheets for some hardware?