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

bercioiu
Posts: 141
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Has thanked: 77 times
Been thanked: 29 times
Contact:

16F88 configuration, please help!

Postby bercioiu » Tue Nov 02, 2010 6:30 pm

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 4243 times
teleruptor.fcf
(24.72 KiB) Downloaded 105 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8323
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2380 times
Been thanked: 3391 times
Contact:

Re: 16F88 configuration, please help!

Postby medelec35 » Tue Nov 02, 2010 9:21 pm

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 150 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

bercioiu
Posts: 141
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Has thanked: 77 times
Been thanked: 29 times
Contact:

Re: 16F88 configuration, please help!

Postby bercioiu » Wed Nov 03, 2010 6:02 am

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: 8323
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2380 times
Been thanked: 3391 times
Contact:

Re: 16F88 configuration, please help!

Postby medelec35 » Wed Nov 03, 2010 7:20 am

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

bercioiu
Posts: 141
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Has thanked: 77 times
Been thanked: 29 times
Contact:

Re: 16F88 configuration, please help!

Postby bercioiu » Thu Nov 04, 2010 4:33 pm

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 127 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8323
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2380 times
Been thanked: 3391 times
Contact:

Re: 16F88 configuration, please help!

Postby medelec35 » Thu Nov 04, 2010 10:07 pm

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 156 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

bercioiu
Posts: 141
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Has thanked: 77 times
Been thanked: 29 times
Contact:

Re: 16F88 configuration, please help!

Postby bercioiu » Fri Nov 05, 2010 6:43 am

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: 8323
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2380 times
Been thanked: 3391 times
Contact:

Re: 16F88 configuration, please help!

Postby medelec35 » Fri Nov 05, 2010 7:22 am

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 4181 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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

bercioiu
Posts: 141
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Has thanked: 77 times
Been thanked: 29 times
Contact:

Re: 16F88 configuration, please help!

Postby bercioiu » Fri Nov 05, 2010 5:54 pm

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: 8323
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2380 times
Been thanked: 3391 times
Contact:

Re: 16F88 configuration, please help!

Postby medelec35 » Fri Nov 05, 2010 6:09 pm

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.
These users thanked the author medelec35 for the post:
bercioiu (Fri Nov 05, 2010 7:34 pm)
Rating: 5.56%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

bercioiu
Posts: 141
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Has thanked: 77 times
Been thanked: 29 times
Contact:

Re: 16F88 configuration, please help!

Postby bercioiu » Fri Oct 21, 2011 5:54 pm

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: 8323
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2380 times
Been thanked: 3391 times
Contact:

Re: 16F88 configuration, please help!

Postby medelec35 » Thu Dec 22, 2011 9:30 pm

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
These users thanked the author medelec35 for the post:
bercioiu (Fri Dec 23, 2011 12:32 am)
Rating: 5.56%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

bercioiu
Posts: 141
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Has thanked: 77 times
Been thanked: 29 times
Contact:

Re: 16F88 configuration, please help!

Postby bercioiu » Fri Dec 23, 2011 12:29 am

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