16F88 configuration, please help!

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
bercioiu
Posts: 153
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Contact:

16F88 configuration, please help!

Post by bercioiu »

Hello everyone!I'm working on a project for my house.I have to build a board with 8 latching relays witch command 8 lights to my house... relays are controlled from several points in my house.I chose for this project 16F88 because i have one of these. The problem is that I need 16 I/O and to make room for all 16 I/o, I have to use the internal osc. and no MCLR.I simulated the program in Flowcode and it work well but when I upload the Hex into MCU something is wrong. I upload here the file for flowcode 4. I need help for configuration when I comiple the cip. The last configuration is in the attachment
Attachments
config.jpg
config.jpg (208.35 KiB) Viewed 5306 times
teleruptor.fcf
(24.72 KiB) Downloaded 139 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8922
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 16F88 configuration, please help!

Post by medelec35 »

Hello bercioiu
The reason your project is not working is because the default frequency for internal osc is 31.25 KHz
If you want to run internal osc at a different frequency then you will need to add a C code box at the beginning of your program with an osccon value within it.
E.g for 8MHz
osccon=0x70;
for 4MHz:
osccon=0x60;
I have modified your flowchart to run at 8MHz.
Can you please let me know if flowchart works OK for you.
Thanks.
Attachments
teleruptor Modified.fcf
(25.22 KiB) Downloaded 181 times
Martin

bercioiu
Posts: 153
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Contact:

Re: 16F88 configuration, please help!

Post by bercioiu »

Sorry modelec35 but it did not work either with the C code box added. I still have the same problem. The configuration words that I`m using are: Config1 0x3F18 and Config2 0x3FFC. Where I`m wrong?

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8922
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 16F88 configuration, please help!

Post by medelec35 »

What is the problem you are experiencing?
I believe only problem I can see is ports staying on once activated. That is because the code is activated so fast after switch is released it would be always read as 0 and not what the flowcode simulator shows. I could be wrong. Not got time to test. If no one else answers I will test a bit later.
Is this the problem, or ports not activated at all?

Have you toggled a pin at 1Hz to see if configuration is correct?
Config settings look fine to me.
Martin

bercioiu
Posts: 153
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Contact:

Re: 16F88 configuration, please help!

Post by bercioiu »

I made some adjustments to the program in Flowcode (I removed the macros) and now I have the following situation: ports b0, b1, b2, b3, b6, b7 works well but at ports b4 and b5 are still the same problem: ports staying on once activated. I put here the last file from flowcode.
Attachments
teleruptor_1.fcf
(22.33 KiB) Downloaded 159 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8922
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 16F88 configuration, please help!

Post by medelec35 »

Try this. It only uses three bytes and is a very short code to toggle the whole of port B individually. Ive not done this before, so I can't guarantee it' will work 100%.
Also I have changed your osccon value to match your target speed setting. Since you have set your clock speed at 4MHz and not 8MHz. osccon should be = 0x60....not 0x70
Can you let me know if it works the way you would want it to please.
Attachments
teleruptor_modifiedV2.fcf
(8.5 KiB) Downloaded 190 times
Martin

bercioiu
Posts: 153
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Contact:

Re: 16F88 configuration, please help!

Post by bercioiu »

This version works fine.I have only one question: port B inputs are debounced ( or wait until low) ? I ask this because the buttons are a bit instable (blurry).

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8922
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 16F88 configuration, please help!

Post by medelec35 »

Hmmm. Should be an easy fix (hopfully). How about placing a short delay just below input_portA=0 loop.
antibounce.jpg
antibounce.jpg (166.84 KiB) Viewed 5244 times
Or instead of input_portA=0 loop, you can use waituntilllow in its place.
Assuming de-bounce part of waituntilllow is ok?

So two things to try.
Martin

bercioiu
Posts: 153
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Contact:

Re: 16F88 configuration, please help!

Post by bercioiu »

It works very well now. I used both solutions. Thank you very much for your help! How can I give you thanks in the forum because I did not handle.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8922
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 16F88 configuration, please help!

Post by medelec35 »

That's great! Glad its working for you. Thanks for letting us know.
bercioiu wrote:It works very well now. I used both solutions.
Its up to you of course, but either method should work on there own.
bercioiu wrote: How can I give you thanks in the forum because I did not handle.
To give thanks, just click on the thumbs up (next to "quote icon) In the post you wish to say thanks in.
bercioiu wrote:It works very well now. I used both solutions.
Its up to you of course, but either method should work on there own.
Martin

bercioiu
Posts: 153
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Contact:

Re: 16F88 configuration, please help!

Post by bercioiu »

Hello again!

Meanwhile I completed that project. Today, unfortunately, 16f88 was fried.
I have a 16F628A available. What changes should be made ​​for that MCU?
The C code box at the beginning of the program with "osccon=0x60;" for 4MHz
is the same?
Thanks again!

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8922
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 16F88 configuration, please help!

Post by medelec35 »

Hi bercioiu,
No I don't believe you need to add osccon=0x60; because 628A does not have an osccon register
So just try setting target speed to 4MHz, and in configuration settings set for internal osc, watchdog and Low voltage programming disabled etc.
It should then work.

Martin
Martin

bercioiu
Posts: 153
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Contact:

Re: 16F88 configuration, please help!

Post by bercioiu »

Ok! Thanks for quick response! I'll try and return with the result.

Post Reply