18f4550 board

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

18f4550 board

Post by achillis1 »

Hello,

I am trying to send a routine via flowcode to a 18F4550 and then place the PIC into a board that aquired from an other developer. The board is specially made for the 18F4550 and runs with 20Mhz crystal.
The routine I send to the 18F4550 via flowcode just send 255 value to all ports so I can visibly check that the PIC is working. When I operate the PIC in the other board then it does not light up the LEDs.
BUT when I download via the PPP of Matrix a hex file that it was included with the other board then the PIC works and the LED's are flashing.

I will attach my hex file and the hex file of the other board to see if there is something wrong with the configuration.
Maybe I have to put some other options in the expert view in the chip configuration in flowcode?

By the way I have used the 18F4550 options that Ben had listed in the PDF: http://www.matrixmultimedia.com/resourc ... %20PIC.pdf

The hex I used and worked is the test_IO the other one I just attached it for better sampling.


Thank you,

Andreas Achilleos
Attachments
ET-PIC USB 4550_Engreduced.pdf
(215.22 KiB) Downloaded 339 times
Test_IO.hex
(616 Bytes) Downloaded 261 times
LCD_Demo.HEX
(1.12 KiB) Downloaded 252 times

User avatar
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: 18f4550 board

Post by Benj »

Hello,

You can use PPP to look at the configuration settings embedded into the hex files.

Load your hex file into PPP and then click on View -> Hex file to see the contents of the file.

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: 18f4550 board

Post by achillis1 »

Hello Ben,

1. a. In your article you say to set the clock at 48000000, is this the value that always has to have or the value depends on which crystal each person uses?
b. Also in the screenshot at the option: ''OSC select'' you have selected the option:(no divide 4Mhz input) shouldn't this be matching with 20Mhz?

2. I have loaded the hex file and I see the folloing differences:

a. OSC select: divide by 5 (20Mhz input)
b. port B configured as analoque inputs on reset
c. stack overflow reset enabled

The above are listed in the third party's hex file and when downloaded to the PIC via the PPP and EB006 the PIC works on the 3rd party board.

Do the other options on the right pane have a significant role, because there are some small differences there too!

Thank you

User avatar
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: 18f4550 board

Post by Benj »

Hello Achillis,

1a) internal speed of 48000000 is required for USB comms to work correctly. Getting this right in Flowcode means that software delays and baud rates are calculated correctly.

1b) Yes this should match the speed of your crystal. 20MHz in your case, 4MHz in mine.

2a) I may have been using a 20MHz crystal when doing some examples.

2b) Flowcode will take care of this anyway and configure all I/O as digital on startup.

2c) stack overflow reset is sometimes handy to have especially for larger programs. Turning it on or off shouldn't effect your program.

The options in the right pane simply reflect the main config settings as the values that are passed to the device.

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: 18f4550 board

Post by achillis1 »

Hi,

So, with internal speed of any value, should not make any difference in running a simple routine as giving 255 value on all ports?

Because as I see the only difference in the 2 hex files is the internal speed.

Ben, can you think of anything else that might goes wrong?
Probably the hardware architecture of the 3rd party board?

Thank you

User avatar
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: 18f4550 board

Post by Benj »

Hello,

Any chance you can attach your program and I will see if I can spot anything.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 18f4550 board

Post by medelec35 »

I have not got hardware, so loaded test1.hex file in a simulator. It showed all ports excpet portE were set high.
Value loaded into PortA is 7F (since not all of port A is available)
PortB = FF
PortC = F7
PortD = FF
PortE = 00
Looking at the config settings, the only thing I can see is Master Clear is enabled.
So You should have the run/prog switch on your hardware in the run position, or your program will never run.
My suggestion would be to read the target device with your programmer, and save the hex file. I can then look at that for you.
Here is a screenshot of your current configuration settings:
Test1.hex Config.jpg
Test1.hex Config.jpg (140.72 KiB) Viewed 7906 times
I can't see anything wrong with it, perhaps someone else can?

Martin
Martin

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: 18f4550 board

Post by achillis1 »

Thank you all,

Here is the hex from flowcode.
The hex from the routine that works in the 3rd party board is attached above.

The only thing that did not try yet is to set the clock speed within the project options to 40000000 Hz.

DO you thing that this is the case?

Also Martin, the hex test_IO when running on the board the leds were lighted up counting in binary.

Thank you
Attachments
erase test 18f4550.hex
(508 Bytes) Downloaded 240 times

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: 18f4550 board

Post by achillis1 »

Hello,

Also tried with the speed set to 40000000hz but still does not operate!

User avatar
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: 18f4550 board

Post by Benj »

Hello,

Any chance you can post up your Flowcode program and also maybe a schematic of this 3rd party hardware if you can get hold of one.

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: 18f4550 board

Post by achillis1 »

Hello Ben,

The schematic for the 3rd party board is attached at the first post, the pdf document.
I had to delete some photos due to size upload limitations.
Find also the flowcode routine.

Thank you.
Attachments
test 18f4550.fcf
sends 255 on all ports
(4 KiB) Downloaded 232 times

User avatar
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: 18f4550 board

Post by Benj »

Hello Achillis,

Have you tried doing a small program that will flash one of the LEDs? It could be that outputting 1 to every single pin is causing problems as the pins are connected to other hardware which could potentially be sinking a large amount of current and stopping the device from powering up correctly. Looking at the schematic the LEDs are active low anyway which could be why you are not getting them to light. Output a logic 0 to the LED pins and you should get them to light correctly.

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: 18f4550 board

Post by achillis1 »

Interesting :!:

I will try that in the afternoon.

Ben, may I ask what in the schematic made you say that the pins are active low?

Thank you a lot...

User avatar
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: 18f4550 board

Post by Benj »

Hello,

Its just the LEDs. The anodes are connected to the supply voltage rail and the cathodes are connected to the uC pins. Therefore to switch the LED on you need to essentially pull the cathode pin to ground.

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: 18f4550 board

Post by achillis1 »

Yes, you are right(as I learned :) )!!!

I will test that in the afternoon.

One question: if a flowcode routine does not state any port as output nor as input, then what would be the pin status? Neutral(if can be) positive or ground?

Thank you.

User avatar
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: 18f4550 board

Post by Benj »

Hello,

All pins should be in the input high impedance state after a reset, I think mainly to avoid any damage to external circuitry eg if you have pins connected directly to either of the power rails etc.

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: 18f4550 board

Post by achillis1 »

Hello,

Ben, once again life saver!!!!

The LEDs are active low!!!!!!!!!!!!!

I have got to learn how to read diagrams and the logic behind them!

Thanks a lot :D

Post Reply