Off to a bad start

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Bobw
Posts: 157
Joined: Sat Jan 22, 2011 10:39 pm
Location: Michigan
Has thanked: 6 times
Been thanked: 27 times
Contact:

Off to a bad start

Post by Bobw »

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
Attachments
testLED4455.fcf
(6.5 KiB) Downloaded 215 times

medelec35
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

Post by medelec35 »

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
Attachments
testLED4455 Modified.fcf
(11 KiB) Downloaded 220 times
Martin

Bobw
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

Post by Bobw »

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

medelec35
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

Post by medelec35 »

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
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"
Maybe that will help?

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

Bobw
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

Post by Bobw »

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

medelec35
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

Post by medelec35 »

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
Martin

Bobw
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

Post by Bobw »

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

medelec35
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

Post by medelec35 »

Bobw wrote:Ok,
Problem with the programmer was the space in the file name.
I believe changing settings to:

Code: Select all

-P%p -F"%f.hex" -E -M -Y"%f.hex" 
will allow you to use spaces within file name
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.
You could try 0x72 although it may not make a difference if divide by or osc settings are wrong.

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

Bobw
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

Post by Bobw »

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

Post Reply