12F1840 ports A1 and A2 does not work properly
Moderator: Benj
- 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
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
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.
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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
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
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
- 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
Hi Ben
I tried Flowcode 6 and that one works correctly.
With kind regards
Jan Lichtenbelt
I tried Flowcode 6 and that one works correctly.
With kind regards
Jan Lichtenbelt
- 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
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,
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,
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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
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
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
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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
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
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
- 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
Hi Jan,
In v7 you can program assembler like this.
or like this.
Still investigating the problem...
In v7 you can program assembler like this.
Code: Select all
#asm
BSF 3,5
CLRF 5
BCF 3,5
MOVLW 7
MOVWF 5
#endasmCode: Select all
asm("BSF 3,5");
asm("CLRF 5");
asm("BCF 3,5");
asm("MOVLW 7");
asm("MOVWF 5");Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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
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
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
- 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
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.
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;Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel