Using a 18F4455 PIC
hooked every thing up for the programmer, have one LED on port D7, nothing else connected yet.
Expecting port D7 to provide the HIGH to turn on the led. (Removed the PIC and put +5 to the socket pin LED lights)
Flowcode written and simulated no problems.
Compiled and programmed (Pickit3) no problems.
Program will not run.
I know I am missing a simple basic step some where.
Please have a look.
Bob
Off to a bad start
Moderator: Benj
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Off to a bad start
Hi Bob,
Configuration settings were not set in your flowchart.
I have set your flowchart up to run at 19.66MHz. Give that a try and see how you get on with it.
Did you know that using the 19.66MHz xtal that comes with EB006, you can run the OSC at 48MHz using the PLL function?
If it still don't work, I will break out my 18F4455 and carry out some tests.
Martin
Configuration settings were not set in your flowchart.
I have set your flowchart up to run at 19.66MHz. Give that a try and see how you get on with it.
Did you know that using the 19.66MHz xtal that comes with EB006, you can run the OSC at 48MHz using the PLL function?
If it still don't work, I will break out my 18F4455 and carry out some tests.
Martin
- Attachments
-
- testLED4455 Modified.fcf
- (11 KiB) Downloaded 220 times
Martin
-
- Posts: 157
- Joined: Sat Jan 22, 2011 10:39 pm
- Location: Michigan
- Has thanked: 6 times
- Been thanked: 27 times
- Contact:
Re: Off to a bad start
Knew there was something I was over looking.
Right now I am only using the internal oscillator.
I now get this for an error:
Building CASM file
Memory Usage Report
===================
RAM available:2048 bytes, used:37 bytes (1.9%), free:2011 bytes (98.1%),
Heap size:2011 bytes, Heap max single alloc:127 bytes
ROM available:24576 bytes, used:278 bytes (1.2%), free:24298 bytes (98.8%)
success
Return code = 0
Launching the linker/assembler...
C:\Program Files\Flowcode\v5\Tools\PICkit3\PK3CMD.exe -P18F4455 -FtestLED4455 Modified.hex -E -M -Y
HEX File not foundReturn code = 1
Flowcode was unable to transfer the flowchart to the microcontroller. Check the programmer options and physical connections.
FINISHED
Double checking my connections:
Pickit3 PIN PIC PIN
1 1 MCLR
2 11 VDD Same as pin 32
3 12 VSS Same as pin 31
4 40 PGD
5 39 PGC
6 NO Connection
I have tried it on internal power as well as letting the pickit3 power the circuit.
I used MPLAB to program it and it appears to program fine, just flashing on and off every 12 seconds.
Wrong oscillator setting?
Bob
Right now I am only using the internal oscillator.
I now get this for an error:
Building CASM file
Memory Usage Report
===================
RAM available:2048 bytes, used:37 bytes (1.9%), free:2011 bytes (98.1%),
Heap size:2011 bytes, Heap max single alloc:127 bytes
ROM available:24576 bytes, used:278 bytes (1.2%), free:24298 bytes (98.8%)
success
Return code = 0
Launching the linker/assembler...
C:\Program Files\Flowcode\v5\Tools\PICkit3\PK3CMD.exe -P18F4455 -FtestLED4455 Modified.hex -E -M -Y
HEX File not foundReturn code = 1
Flowcode was unable to transfer the flowchart to the microcontroller. Check the programmer options and physical connections.
FINISHED
Double checking my connections:
Pickit3 PIN PIC PIN
1 1 MCLR
2 11 VDD Same as pin 32
3 12 VSS Same as pin 31
4 40 PGD
5 39 PGC
6 NO Connection
I have tried it on internal power as well as letting the pickit3 power the circuit.
I used MPLAB to program it and it appears to program fine, just flashing on and off every 12 seconds.
Wrong oscillator setting?
Bob
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Off to a bad start
I could be wrong here, but to me it looks like Flowcode is not correctly configured for retrieving the name of your flowchart, and nothing to do with internal osc.
You can see there is a -Ffilename
Have you looked here?:
http://www.matrixmultimedia.com/support ... f=68&t=786
it states
If file names have spaces then speech marks are usually required.
That could be why you not got the error before I changed the name of the Flowchart?
You can also confirm his is the case by changing name to: testLED4455_Modified.fcf
I.e replacing space with an underscore.
Martin
You can see there is a -Ffilename
Have you looked here?:
http://www.matrixmultimedia.com/support ... f=68&t=786
it states
Maybe that will help?Some users have reported problems when using the settings listed above. They get the error "hex file not found".
Changing the programmer parameters to this seems to fix this problem.
Code:
-P%p -F"%f.hex" -E -M -Y"%f.hex"
If file names have spaces then speech marks are usually required.
That could be why you not got the error before I changed the name of the Flowchart?
You can also confirm his is the case by changing name to: testLED4455_Modified.fcf
I.e replacing space with an underscore.
Martin
Martin
-
- Posts: 157
- Joined: Sat Jan 22, 2011 10:39 pm
- Location: Michigan
- Has thanked: 6 times
- Been thanked: 27 times
- Contact:
Re: Off to a bad start
Martin,
I found that help file before I read your post.
I will recheck my config settings.
Do I need to define the oscillator setting at the start with the OSCON setting?
I remember having to do that when I was using a 16f1827 pic.
Just glad I took every ones advice and hooked up an LED to get the bugs out with first.
Thank you for the help.
Bob
I found that help file before I read your post.
I will recheck my config settings.
Do I need to define the oscillator setting at the start with the OSCON setting?
I remember having to do that when I was using a 16f1827 pic.
Just glad I took every ones advice and hooked up an LED to get the bugs out with first.
Thank you for the help.
Bob
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Off to a bad start
Yes its the same as 16f1827.
I used this method to determine correct osccon value:
http://www.matrixmultimedia.com/mmforum ... 29&#p28829
If you do not use osccon then the internal osc will run at 1MHz by default.
With these devices, PLL is not available for using with internal osc, so maximum internal speed will be 8MHz.
Martin
I used this method to determine correct osccon value:
http://www.matrixmultimedia.com/mmforum ... 29&#p28829
If you do not use osccon then the internal osc will run at 1MHz by default.
With these devices, PLL is not available for using with internal osc, so maximum internal speed will be 8MHz.
Martin
Martin
-
- Posts: 157
- Joined: Sat Jan 22, 2011 10:39 pm
- Location: Michigan
- Has thanked: 6 times
- Been thanked: 27 times
- Contact:
Re: Off to a bad start
Ok,
Problem with the programmer was the space in the file name.
used osccon = 0x70; I know it is not the correct setting but it did speed things up, flashes ON/OFF about every 2 seconds now.
Will print out the data sheet sections for the oscillator for this PIC, need to clock this thing faster than 8Mhz. Was looking for 32Mhz.
Guess I will learn about external oscillators now.
Thanks Martin
Bob
Problem with the programmer was the space in the file name.
used osccon = 0x70; I know it is not the correct setting but it did speed things up, flashes ON/OFF about every 2 seconds now.
Will print out the data sheet sections for the oscillator for this PIC, need to clock this thing faster than 8Mhz. Was looking for 32Mhz.
Guess I will learn about external oscillators now.
Thanks Martin
Bob
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Off to a bad start
I believe changing settings to:Bobw wrote:Ok,
Problem with the programmer was the space in the file name.
Code: Select all
-P%p -F"%f.hex" -E -M -Y"%f.hex"
You could try 0x72 although it may not make a difference if divide by or osc settings are wrong.Bobw wrote: used osccon = 0x70; I know it is not the correct setting but it did speed things up, flashes ON/OFF about every 2 seconds now.
Would you like a flowchart posted with correct settings for 8MHz internal osc?
Bobw wrote: Was looking for 32Mhz.
Guess I will learn about external oscillators now.
There are a couple of options I can think of.
1) Use a 3 pin resonator. still more accurate than internal oscillators, but not as accurate as crystals.
You do not need any other components with then e.g low value caps just the resonator and that's it.
2) There are other devices that allow you to set oscillator speed to 32MHz using internal oscillator.
E.g PIC18F2221/2321/4221/4321 family. There will be a few more to choose from but you will need to look at the datasheets since product selector does not work well with internal oscillators and PLL
Martin
-
- Posts: 157
- Joined: Sat Jan 22, 2011 10:39 pm
- Location: Michigan
- Has thanked: 6 times
- Been thanked: 27 times
- Contact:
Re: Off to a bad start
Martin,
My next step is to get the pulse disc on the motor working. I may just use a simple IR set up.
I do not need to know direction, just distance. Once I know how many motor pulses per one revolution of the output shaft, I can calculate if 8Mhz would be fast enough. The OSC pins were NOT to be used in this project so I can always add an external oscillator later if needed.
I would like to use a GLCD as opposed to a 4x20 LCD but from what I have read they can slow things down a bit.
I really like the RGB GLCD that Matrix has but may be a bit expensive and not sure I can fit it in the box opening I have with out doing some modification to it.
Working on getting all the switches and output hooked up in the simulator so I can start messing with the real program.
Just glad to know my programmer works and my electrical connections to the PIC were correct for now.
Bob
My next step is to get the pulse disc on the motor working. I may just use a simple IR set up.
I do not need to know direction, just distance. Once I know how many motor pulses per one revolution of the output shaft, I can calculate if 8Mhz would be fast enough. The OSC pins were NOT to be used in this project so I can always add an external oscillator later if needed.
I would like to use a GLCD as opposed to a 4x20 LCD but from what I have read they can slow things down a bit.
I really like the RGB GLCD that Matrix has but may be a bit expensive and not sure I can fit it in the box opening I have with out doing some modification to it.
Working on getting all the switches and output hooked up in the simulator so I can start messing with the real program.
Just glad to know my programmer works and my electrical connections to the PIC were correct for now.
Bob