Page 1 of 1
12F1840 ports A1 and A2 does not work properly
Posted: Wed Feb 22, 2017 4:22 pm
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
Re: 12F1840 ports A1 and A2 does work properly
Posted: Wed Feb 22, 2017 5:09 pm
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.
Re: 12F1840 ports A1 and A2 does work properly
Posted: Wed Feb 22, 2017 8:10 pm
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
- P1070193.jpg (63.42 KiB) Viewed 8144 times
Re: 12F1840 ports A1 and A2 does work properly
Posted: Thu Feb 23, 2017 12:02 pm
by Jan Lichtenbelt
Hi Ben
I tried Flowcode 6 and that one works correctly.
With kind regards
Jan Lichtenbelt
Re: 12F1840 ports A1 and A2 does work properly
Posted: Thu Feb 23, 2017 4:02 pm
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.
Hopefully these should make a difference.
Let me know how you get on,
Re: 12F1840 ports A1 and A2 does work properly
Posted: Fri Feb 24, 2017 3:27 pm
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
Re: 12F1840 ports A1 and A2 does work properly
Posted: Fri Feb 24, 2017 5:27 pm
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.
Re: 12F1840 ports A1 and A2 does not work properly
Posted: Sun Feb 26, 2017 5:02 pm
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
Re: 12F1840 ports A1 and A2 does not work properly
Posted: Mon Feb 27, 2017 2:19 pm
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...
Re: 12F1840 ports A1 and A2 does not work properly
Posted: Mon Feb 27, 2017 5:36 pm
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
Re: 12F1840 ports A1 and A2 does not work properly
Posted: Thu Mar 02, 2017 2:00 pm
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;