PIC16F15355 Uart and ADC problem

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

patrick schoon
Posts: 51
Joined: Mon Aug 23, 2010 7:07 pm
Location: Amsterdam
Has thanked: 4 times
Been thanked: 9 times
Contact:

PIC16F15355 Uart and ADC problem

Postby patrick schoon » Thu Dec 20, 2018 7:54 pm

Hi,

My project with PIC16F15355 has a problem with the Hardware uart.
I get an undefined identifier error at compiling the project.


Title:
Description:
Device: PIC.16F.16F15355
Generated by: Flowcode v7.3.0.5
Date: Thursday, December 20, 2018 19:34:08
Users: 1
Registered to: ps
Licence key: X7--
http://www.matrixtsl.com
Launching the compiler...
Microchip MPLAB XC8 C Compiler (Free Mode) V1.41
Build date: Jan 24 2017
Part Support Version: 1.41
Copyright (C) 2017 Microchip Technology Inc.
License type: Node Configuration

366: RX1PPS = 15;
^ (192) undefined identifier "RX1PPS"
(908) exit status = 1
(908) exit status = 1

FINISHED


Uart in software setting works.

Second i tried to use the ADC.
Also here several undefined identifiers.

C:\Program Files (x86)\Flowcode 7\CAL\PIC\PIC_CAL_ADC.c: FC_CAL_ADC_Enable()
4756: ADREF = 0x00;
^ (192) undefined identifier "ADREF"
4771: ADPCH = 0x01;
^ (192) undefined identifier "ADPCH"
5008: ADCLK = Conv_Speed & 0x3F;
^ (192) undefined identifier "ADCLK"
5019: ADCON0bits.ADGO = 1;
^ (255) not a member of the struct/union ""
^ (182) illegal conversion between types
int -> volatile union S53
C:\Program Files (x86)\Flowcode 7\CAL\PIC\PIC_CAL_ADC.c: FC_CAL_ADC_Sample()
5027: while (ADCON0bits.ADGO);
^ (255) not a member of the struct/union ""
^ (199) logical type required
(908) exit status = 1
(908) exit status = 1

C:\Program Files (x86)\Flowcode 7\compilers\pic\bin\xc8.exe reported error code 1

FINISHED

Also PWM only uses Timer2 and only PWM 1 and 2 do compile but no working results
PWM 3-6 do give compiling mesages..

Testfile.fcfx
(12.76 KiB) Downloaded 31 times


Please check, and thanks.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8334
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2382 times
Been thanked: 3393 times
Contact:

Re: PIC16F15355 Uart and ADC problem

Postby medelec35 » Thu Dec 20, 2018 9:43 pm

Hi patrick,
If you update to the latest version (7.3.0.7),
then that will eliminate UART bug and just leave ADC bug.
I can fix it for you, but it means replacing two files.
Would you like me to produce updated files,
or would you rather wait for MM staff to produce official update?
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

patrick schoon
Posts: 51
Joined: Mon Aug 23, 2010 7:07 pm
Location: Amsterdam
Has thanked: 4 times
Been thanked: 9 times
Contact:

Re: PIC16F15355 Uart and ADC problem

Postby patrick schoon » Sun Dec 23, 2018 5:36 pm

Hi Martin,

Thanks for the quick support.

I Can't find the latest 7.3.0.7 online!
But you may send me the two patch files.
I know how it works.

Thanks.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8334
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2382 times
Been thanked: 3393 times
Contact:

Re: PIC16F15355 Uart and ADC problem

Postby medelec35 » Sun Dec 23, 2018 5:49 pm

You're welcome,
Have you tried here?
These users thanked the author medelec35 for the post:
patrick schoon (Mon Dec 24, 2018 11:32 am)
Rating: 5.56%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8334
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2382 times
Been thanked: 3393 times
Contact:

Re: PIC16F15355 Uart and ADC problem

Postby medelec35 » Mon Dec 24, 2018 12:25 pm

Hi Patrick,
Attached are the two updated files:

16F15355.fcdx goes in C:\Program Files (x86)\Flowcode 7\FCD (if 64bit windows) or C:\Program Files\Flowcode 7\FCD (if 32bit windows)

PIC_CAL_ADC.c goes in C:\Program Files (x86)\Flowcode 7\CAL\PIC (if 64bit windows) or C:\Program Files\Flowcode 7\CAL\PIC (if 32bit windows)
Attachments
16F15355.fcdx
(28.33 KiB) Downloaded 28 times
PIC_CAL_ADC.c
(138.35 KiB) Downloaded 30 times
These users thanked the author medelec35 for the post (total 2):
LeighM (Tue Dec 25, 2018 4:49 pm) • patrick schoon (Wed Dec 26, 2018 3:12 pm)
Rating: 11.11%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

patrick schoon
Posts: 51
Joined: Mon Aug 23, 2010 7:07 pm
Location: Amsterdam
Has thanked: 4 times
Been thanked: 9 times
Contact:

Re: PIC16F15355 Uart and ADC problem

Postby patrick schoon » Wed Dec 26, 2018 3:09 pm

Hi Martin,

All thumbs up. :D

The ADC and both hardware uarts are working now.

I still get compiling errors when using timer 1 and 2, timer 0 is working well.
Proberly this is also the issue why the pwm is not working. Pwm is only using timer2.
Pwm ch 1 and 2 can be compiled but no working results, 3-6 also give compiling errors.

Many thanks for now.

Patrick

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8334
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2382 times
Been thanked: 3393 times
Contact:

Re: PIC16F15355 Uart and ADC problem

Postby medelec35 » Wed Dec 26, 2018 3:31 pm

Hi Patrick,
patrick schoon wrote:The ADC and both hardware uarts are working now.

I'm glad it's working, thanks for letting me know.
patrick schoon wrote:I still get compiling errors when using timer 1 and 2
I did not know there is an issue with timers and PWM.
I can't make any promises,
but I will see if I can get those working as well?
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8334
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2382 times
Been thanked: 3393 times
Contact:

Re: PIC16F15355 Uart and ADC problem

Postby medelec35 » Wed Dec 26, 2018 8:01 pm

Hi Patrick,
Can you see if the attached solves your issues?
Attachments
16F15355.fcdx
(32.2 KiB) Downloaded 25 times
These users thanked the author medelec35 for the post:
patrick schoon (Thu Dec 27, 2018 4:48 pm)
Rating: 5.56%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

patrick schoon
Posts: 51
Joined: Mon Aug 23, 2010 7:07 pm
Location: Amsterdam
Has thanked: 4 times
Been thanked: 9 times
Contact:

Re: PIC16F15355 Uart and ADC problem

Postby patrick schoon » Thu Dec 27, 2018 4:56 pm

Hi Martin,

Many thanks in such short notice. :D

Both timers do compile and work on their own.
When used both (TMR1 and 2) they disturb each other, I get interupted pulses.. Proberly swatped some code...
Timer0 is ok.


Simple example in the attachment.
Test.fcfx
(22.84 KiB) Downloaded 42 times


Great help, thanks.

Patrick

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8334
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2382 times
Been thanked: 3393 times
Contact:

Re: PIC16F15355 Uart and ADC problem

Postby medelec35 » Thu Dec 27, 2018 5:38 pm

You're welcome.
Does the PWM work now?
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

patrick schoon
Posts: 51
Joined: Mon Aug 23, 2010 7:07 pm
Location: Amsterdam
Has thanked: 4 times
Been thanked: 9 times
Contact:

Re: PIC16F15355 Uart and ADC problem

Postby patrick schoon » Thu Dec 27, 2018 8:40 pm

Hi Martin,

I did a quick test but no working results.
To be sure i deleted all timer2 components and reselected a new pwm component.
But no working output. Compiling does work..

Regards,

Patrick

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8334
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2382 times
Been thanked: 3393 times
Contact:

Re: PIC16F15355 Uart and ADC problem

Postby medelec35 » Thu Dec 27, 2018 8:57 pm

Try adding a c code block at the start with

Code: Select all

T2CLKCON = 1;
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8334
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2382 times
Been thanked: 3393 times
Contact:

Re: PIC16F15355 Uart and ADC problem

Postby medelec35 » Thu Dec 27, 2018 9:17 pm

medelec35 wrote:Try adding a c code block at the start with

Code: Select all

T2CLKCON = 1;

You will need the above code for timer 2 to work, including PWM
These users thanked the author medelec35 for the post:
patrick schoon (Thu Dec 27, 2018 9:58 pm)
Rating: 5.56%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

patrick schoon
Posts: 51
Joined: Mon Aug 23, 2010 7:07 pm
Location: Amsterdam
Has thanked: 4 times
Been thanked: 9 times
Contact:

Re: PIC16F15355 Uart and ADC problem

Postby patrick schoon » Thu Dec 27, 2018 9:58 pm

Sorry,

No results.

Attached my test file for check.
Test.fcfx
(24.23 KiB) Downloaded 40 times


Regards,

Patrick