PIC16F690 Settings

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
JanB
Posts: 34
Joined: Thu Feb 23, 2012 7:33 pm
Contact:

PIC16F690 Settings

Post by JanB »

Please can someone tell me what are the correct settings for a PIC16F690?

I made a program that works very well in simulation in FlowCode and Proteus. But not in hardware. This is a simple program to test: it flashes a LED and write some text on a LCD 16x2. Nothing else more.

I use no crystal.

I get no text in the hardware LCD and the LED stay’s on while it should flicker. Very strange.

Thanks for your answers.

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: PIC16F690 Settings

Post by medelec35 »

That sounds like a configuration setting.
What version of Flowcode are you using?
What frequency would you like internal oscillator?
4 or 8MHz?
Also have you got anything connected to pin4 like a pull-up resistor and swich, or using it as an i/p or nothing connected?
If you would like to post your flowchart, I can take a look at it, and make adjustments for you.

Martin
Martin

JanB
Posts: 34
Joined: Thu Feb 23, 2012 7:33 pm
Contact:

Re: PIC16F690 Settings

Post by JanB »

Hi Martin,

The LED is flasing now as it should be. But still no text on the LCD 16x2. In sumilation it works perfectly.

We use on my job now version 5 of flowcode. If no one needs this computer than I can use it for my projects for a school with "handicap" childeren. Just to make them happy with flashing LED's and so on:-)

Attached is this simple file, I hope you can take take a look to it.

Thanks and a happy new year :-)

Jan
Attachments
Test LED and LCD 16x2.fcf
(12 KiB) Downloaded 645 times
Last edited by JanB on Fri Dec 28, 2012 8:13 pm, edited 1 time in total.

JanB
Posts: 34
Joined: Thu Feb 23, 2012 7:33 pm
Contact:

Re: PIC16F690 Settings

Post by JanB »

medelec35 wrote: What frequency would you like internal oscillator?
4 or 8MHz?
Also have you got anything connected to pin4 like a pull-up resistor and swich, or using it as an i/p or nothing connected?
Martin
Hi Martin,

In FlowCode the cofiguration is set to 4000000 hz.

There is nothing connected to pin4, should it be ?

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: PIC16F690 Settings

Post by medelec35 »

Thanks and Happy new year to you and all the handicapped children
JanB wrote: There is nothing connected to pin4, should it be ?
That depends if you want to use this pin to reset microcontroller or as an i.p or left unconnected.
If the latter then in configuration settings, if you change 'Master Clear Enable' from External to internal then your LCD should work.

If it does not then you have a hardware issue.

Can you let me know if changing Master Clear Enable please?

If it does not work then we need to do some hardware fault finding.
Martin

JanB
Posts: 34
Joined: Thu Feb 23, 2012 7:33 pm
Contact:

Re: PIC16F690 Settings

Post by JanB »

I have chanced the Master Clear Enable to Internal and have still the same problem. LED is flashing but no text on the display. I think it is now a hardware problem, I follow this picture: http://www.google.com/imgres?num=10&hl= ... 3,s:0,i:97

VSS is to -negative 5V
RW is to negative 5V
VDD is to positive 5V


(OT: thanks for your wishes, I hope they understand it. You know :-) With a flasing LED or Display on their four wheel bicycle, they are more happy than "some words" :-) But Again , THANKS.

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: PIC16F690 Settings

Post by medelec35 »

What about contrast control.
I can't see that on your circuit diagram.

Normally each end of a pot is connected to +5V and 0V.
Center connection is connected to the bias.
Take a look at:
http://www.matrixmultimedia.com/resourc ... 5-30-4.pdf

Perhaps you can post a link to the datasheet for your LCD.

If the LCD contrast is going to be ok, you should see a series of black squares, if LCD is uninitialised.

You could just connect LCD to a +%V supply to check this.

If you can't see the top row of black squares, then its a contrast or supply issue.

If you can see squares along the top row then problem could be the data lines are connected wrong, open circuit or short circuit.
Or a microcontroller or software issue.
if you have set MCLR as internal, then I don't believe it's a software issue.
Martin

JanB
Posts: 34
Joined: Thu Feb 23, 2012 7:33 pm
Contact:

Re: PIC16F690 Settings

Post by JanB »

medelec35 wrote:What about contrast control.
I can't see that on your circuit diagram.

Normally each end of a pot is connected to +5V and 0V.
Center connection is connected to the bias.
Hi Martin,

It works now. It was indeed a hardware issue, I didn´t connect pin3 (contrast pin) to Vss via a 1K resistor. I wil buy a 5K pot and install it.

Thanks for helping me out.

One question:

I have set the pic16f690 to 4000000Hz. Can I set this also to 20000000Hz ?

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: PIC16F690 Settings

Post by medelec35 »

Hi Jan,
To change frequency of the internal oscillator so its a different value to the default 4MHz, you will need to do two things.

1) Change Clock speed within 'Build', Project options to desired frequency. This clock speed does not alter the physical oscillator frequency of the microcontroller, it only alters delays, Component macros that have built in delays like LCD and any formulas involving clock frequency like software baud rate.

2) Add or change a C code block in the form of

Code: Select all

osccon=0xhh;

For 8MHz you would use

Code: Select all

 osccon=0x70;
at the very start of your flowchart before the main loop.
0x just means expect value in hex and hh being correct hex value for desired frequency.
it does not have to be hex, you can use osccon=0bBinaryValue;
Again using 8MHz as an example:

Code: Select all

osccon=0b1110000;
If you look at page 48 of the data sheet you will see:
Osccon1.png
(62.77 KiB) Downloaded 9406 times
As you can see the highest frequency available using internal oscillator is 8MHz.

If you want a much higher internal oscillator then a newer type of microcontroller can run with PLL enabled, which is usually (not always) x 4 so osc speed could be 8MHz x 4 =32MHz
This is not the highest as PIC18F25K22 for example can have an internal oscillator running at 64MHz

To determine correct osccon value in hex (as it's easier to remember) after looking at the data sheet see:
http://www.matrixmultimedia.com/mmforum ... 29&#p28829
Example used is with a microcontroller that has PLL, so you will need to ignore that part.

I have altered your Flowchart so it should now work at 8MHz

Flowcode is very powerful indeed.
Your only scratching the surface.

My advice you be to visit the learning center:
http://www.matrixmultimedia.com/lc_index.php

Try the free course and look at example flowcharts.

Martin
Attachments
Test LED and LCD 16x2 8MHz.fcf
(8 KiB) Downloaded 621 times
Martin

JanB
Posts: 34
Joined: Thu Feb 23, 2012 7:33 pm
Contact:

Re: PIC16F690 Settings

Post by JanB »

Thanks Martin for your answer. It will cost me some time to "study" this answer, but I like to do it.

Thanks agian.

Post Reply