Page 1 of 1

pic 16f1788

Posted: Wed Jan 01, 2025 4:08 pm
by Philc
i have this problem with this program looping when it shouldn't, i have 12 leds on output B0 to B7 and C4 to C7, now when i turn them on one at a time its fine, if i then turn off all port B and then use port masking to turn off C4 to C7 the program turns off the leds but loops back and turns them all on again one at a time. The only way i can get it to work correctly is if i turn off C4 then C5 then C6 then C7 and it works perfectly. Any ideas and i also put a counter in so i could control it turn on the next level of 12 leds and that wouldn't work unless i turned C port off individually. what i am playing about with is a led tower 12 leds in rows and 12 high, like the ones off ebay but i am only using the first 2 rows until i get the hang of flowcode. Hopefully its just me but i have tried everything and cant get it to work unless port c turned off individually. I even tried turning off all port C and it still looped when i have no loops or connection point in to make it do that. By turning off i mean output 0. Thanks

Re: pic 16f1788

Posted: Wed Jan 01, 2025 5:26 pm
by chipfryer27
Hi

If you post your chart we can have a look. Without it we have no way of knowing what is going on.

Regards

Re: pic 16f1788

Posted: Sat Jan 04, 2025 9:00 pm
by Philc
how do i attach the chart ? i have tried and cant get it to attach. thanks

Re: pic 16f1788

Posted: Sun Jan 05, 2025 11:15 am
by chipfryer27
Hi

I you click the "Full Editor & Preview" button, you can then either drag and drop or select files to attach.

Regards

Re: pic 16f1788

Posted: Sun Jan 05, 2025 8:27 pm
by Philc
i have attahed it but dont know where its gone, the bit of the code is the port c oof bit, it runs fine in the debug but doesnt on the chip unless prot c is turned off individually then its fine..



Declare Connection PointDeclare Connection Point: : B
----------------------------------------

----------------------------------------
Output:

off -> C3
----------------------------------------

----------------------------------------
Declare Connection PointDeclare Connection Point: [A]: A
----------------------------------------

----------------------------------------
Calculation:

count = count + 1
----------------------------------------

----------------------------------------
Delay:

10 ms
----------------------------------------

----------------------------------------
Output:

on -> C4
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

on -> C5
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

on -> C6
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

on -> C7
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

on -> B0
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

on -> B0
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

on -> B1
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

on -> B2
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

on -> B3
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

on -> B4
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

on -> B5
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

on -> B6
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

on -> B7
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

off -> PORTB
----------------------------------------

----------------------------------------
Output:

off & 0xF0 -> PORTC
----------------------------------------

----------------------------------------
Delay:

100 ms
----------------------------------------

----------------------------------------
Output:

off -> C2
----------------------------------------

----------------------------------------
Decision:

If count > 1 ?
<TRUE BRANCH>

----------------------------------------
Decision:

If count = 3 ?
<TRUE BRANCH>

----------------------------------------
Input:

C3 -> off
----------------------------------------

----------------------------------------
Input:

C2 -> off
----------------------------------------

----------------------------------------
Input:

C1 -> off
----------------------------------------

----------------------------------------
Delay:

10 ms
----------------------------------------

----------------------------------------
counter reset:

count = 0
----------------------------------------

----------------------------------------
Goto Connection PointGoto Connection Point: : B
----------------------------------------

</TRUE BRANCH>


<FALSE BRANCH>

----------------------------------------
Input:

C2 -> off
----------------------------------------

----------------------------------------
Delay:

10 ms
----------------------------------------

----------------------------------------
Output:

off -> C1
----------------------------------------

</FALSE BRANCH>
----------------------------------------

</TRUE BRANCH>


<FALSE BRANCH>

</FALSE BRANCH>
----------------------------------------

----------------------------------------
Goto Connection PointGoto Connection Point: [A]: A
----------------------------------------

run fine on the chip unless i turn port c off individually.. thanks

Re: pic 16f1788

Posted: Sun Jan 05, 2025 8:47 pm
by chipfryer27
Hi

When you save your chart you get a file with a .fcfx extension (for example, test.fcfx).

This is the file you need to attach. If you click on Full Editor & Preview you will see an option to attach the file (you may need to scroll down) or you can just drag-n-drop into the reply window.

We really do need to see the chart to help.

Regards