Pic16f1947 portd input problem

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
darrynenig22
Posts: 11
Joined: Mon Oct 06, 2014 12:55 pm
Location: Somerset, UK
Been thanked: 1 time
Contact:

Pic16f1947 portd input problem

Post by darrynenig22 »

Hi All,

This is the first time posting for advice on the forum as normally flowcode projects have been a breeze to complete. Have moved from V5 to V6 and need some help with what should be a simple input from
switch and then turn on an output - lamp.

I have used this code and built circuit pcb a few times before on similar projects with out any problems using other pic`s but for this project the Pic16F1947 was needed for the larger program memory.

My circuit uses 240v ac inputs on various port inputs and steps down circuit to a smoothed 5v for logic input. There is a ripple on the half way rectification but does not affect the
continuous input from inputs on portb and porta that work correctly and code runs as expected. All good so far.

portd 1,2,3,4,5,6,7 though has unexpected drop out and delay reacting on the reading of the port pins 5v .seems to be a random on/off of the input even though the switch is held on.
Checking the datasheet shows that the portd has ccp and other peripheral. I'm assuming that flowcode will set this port as normal digital I/O and the icons will set the direction of the TRIS
register correctly. Though in the c. file I am unsure ware the compiled code for setting the config for this port are.

Testing with my older v5 flowcode also has the same problems with the inputs on portd.

Portb 0,1,2,3,4,5 "working"
Porta 6 "working"
Portd 1,2,3,4,5,6,7 "erratic"


I have attached a simplified switch flowcode with a few of the I/O for testing and checking the generated files.
Any advice for the behaviour on portd not reading a solid stable input would be very appreciated.

Thanks
Attachments
portd inputs pic16f1947 - 1 .fcfx
(37.72 KiB) Downloaded 173 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: Pic16f1947 portd input problem

Post by Benj »

Hello,

How is your switch circuit wired? Can you send us a schematic for your board?

darrynenig22
Posts: 11
Joined: Mon Oct 06, 2014 12:55 pm
Location: Somerset, UK
Been thanked: 1 time
Contact:

Re: Pic16f1947 portd input problem

Post by darrynenig22 »

Hi Benj,

I have attached the input circuit that is used for Portb 0,1,2,3,4,5 and Porta 6 all working as expected, Portd has the problems when reading the input as 4.8v ~ 5v derived from this input method, seems to reed the port a little different, on and off at random when the input switch or switches are held on.

I'm wondering if there is something special about this port on the Pic16F1947 or perhaps flowcodes configuration when defining the port.

Thanks
Attachments
input to portd.jpg
input to portd.jpg (23.91 KiB) Viewed 2317 times

Post Reply