12F1840 ports A1 and A2 does not work properly

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

Moderator: Benj

Post Reply
User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

12F1840 ports A1 and A2 does not work properly

Post by Jan Lichtenbelt »

I tried to use the 8 pins 12F1840 for the first time under Flowcode 7.
The output to A5 works correctly, see flowcode. But as soon as I use the output to A1(data) or A2(Clk), the microchip fails to work correctly. In that case even A5 does not work any more.

The only thing I can find as possiblity is that the config word for low voltage programming is not set correctly. But even that is disabled.

Are there other, better solutions?

With kind regards

Jan Lichtenbelt
Attachments
Test_12F1840_V1.fcfx
(7.4 KiB) Downloaded 312 times
Last edited by Jan Lichtenbelt on Sun Feb 26, 2017 4:59 pm, edited 1 time in total.

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: 12F1840 ports A1 and A2 does work properly

Post by Benj »

Hi Jan,

I can't see anything specifically wrong with the code being generated. What hardware are you using the chip on? Is it your own circuitry or is it the EB006?

For the EB006, A0 and A1 of an 8-pin chip connect to RB7 and RB6 which may be causing confusion.

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: 12F1840 ports A1 and A2 does work properly

Post by Jan Lichtenbelt »

Dear Ben

I used the EB006 board for ICSP programming the chip.

In the configword (0x9A4 and 0x1CFF) the bit 29 (low voltage programming) is indeed 0.
I do not understand this problem.

With kind regards

Jan Lichtenbelt
5-thread with brown=Vpp. The LED is connected to A5
5-thread with brown=Vpp. The LED is connected to A5
P1070193.jpg (63.42 KiB) Viewed 8143 times

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: 12F1840 ports A1 and A2 does work properly

Post by Jan Lichtenbelt »

Hi Ben

I tried Flowcode 6 and that one works correctly.

With kind regards

Jan Lichtenbelt
Test_12F1840_F6.fcfx
(4.25 KiB) Downloaded 368 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: 12F1840 ports A1 and A2 does work properly

Post by Benj »

Hi Jan,

Please can you try the following for me.

First please can you place these updated CAL files into the "Flowcode 7/CAL/PIC" folder.
PIC_CAL_IO.c
(2.48 KiB) Downloaded 357 times
PIC_CAL_IO.h
(10.98 KiB) Downloaded 324 times
Hopefully these should make a difference.

Let me know how you get on,

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: 12F1840 ports A1 and A2 does work properly

Post by Jan Lichtenbelt »

Hi Ben,

Sorry my fault, but it is not a difference between flowcode 6 and 7. Also the original PIC_CAN_IO files are fine.

But I found a very unexpeced solution. The chip does not work if one makes the output A5 high and directly one of the pins A0 and/or A1 also high. If you put a delay of at least 7-10 msec between makeing high A5 and A0/A1, the chip works fine. See flowcode and the "citrical delay". Making the output low is no problem.
I really do not understand this.

Something to thing about the week-end.

With kind regards

Jan Lichtenbelt
Test_12F1840_V2.fcfx
(5.82 KiB) Downloaded 324 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: 12F1840 ports A1 and A2 does work properly

Post by Benj »

Hi Jan,

We've had a report of similar issues on a 12F629 device, port pins not toggling as expected. I'm investigating the compiled assembler file but nothing is jumping out at me yet.

I'll let you know if I make any progress on this.

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: 12F1840 ports A1 and A2 does not work properly

Post by Jan Lichtenbelt »

Hi Ben,

I intended to program the ouput in C or even in assembler. In Flowcode 6 programming in assembler was still possible, but in Flowcode 7 is a total different language for me. I will not start with that.

I stop investigation this problem.

With kind regards

Jan lichtenbelt

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: 12F1840 ports A1 and A2 does not work properly

Post by Benj »

Hi Jan,

In v7 you can program assembler like this.

Code: Select all

#asm
BSF 3,5
CLRF 5
BCF 3,5
MOVLW 7
MOVWF 5
#endasm
or like this.

Code: Select all

asm("BSF 3,5");
asm("CLRF 5");
asm("BCF 3,5");
asm("MOVLW 7");
asm("MOVWF 5");
Still investigating the problem...

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: 12F1840 ports A1 and A2 does not work properly

Post by Jan Lichtenbelt »

Hi Ben,

I'm not sure I understand the assembler codes. I replaced the set A5 by the assembler codes you gave here above. Again it does not work properly. With the delay of 10 msec the other ports A0 and A1 works correctly, but A5 nothing happens.

to be continued?

Jan
Test_12F1840_V3.fcfx
(5.84 KiB) Downloaded 370 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: 12F1840 ports A1 and A2 does not work properly

Post by Benj »

Hi Jan,

Sorry the assembler code was not meant to be for your device, just an example of how Flowcode 7 for PIC requires assembler to be structured.

Your program looks fine in terms of configuration settings so not sure why it is not working. I've even checked the hexadecimal setting going to the chip and the chip errata to make sure nothing is going wrong here.

You could try this C code to set the A5 pin.

Code: Select all

TRISAbits.TRISA5 = 0;
LATAbits.LATA5 = 1;

Post Reply