PIC16F15355 Uart and ADC problem

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

Moderator: Benj

Post Reply
patrick schoon
Posts: 64
Joined: Mon Aug 23, 2010 7:07 pm
Location: Amsterdam
Contact:

PIC16F15355 Uart and ADC problem

Post by patrick schoon »

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 69 times
Please check, and thanks.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8874
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: PIC16F15355 Uart and ADC problem

Post by medelec35 »

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: 64
Joined: Mon Aug 23, 2010 7:07 pm
Location: Amsterdam
Contact:

Re: PIC16F15355 Uart and ADC problem

Post by patrick schoon »

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: 8874
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: PIC16F15355 Uart and ADC problem

Post by medelec35 »

You're welcome,
Have you tried here?
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: 8874
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: PIC16F15355 Uart and ADC problem

Post by medelec35 »

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
(27.91 KiB) Downloaded 69 times
PIC_CAL_ADC.c
(132.17 KiB) Downloaded 67 times
Martin

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

patrick schoon
Posts: 64
Joined: Mon Aug 23, 2010 7:07 pm
Location: Amsterdam
Contact:

Re: PIC16F15355 Uart and ADC problem

Post by patrick schoon »

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: 8874
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: PIC16F15355 Uart and ADC problem

Post by medelec35 »

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: 8874
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: PIC16F15355 Uart and ADC problem

Post by medelec35 »

Hi Patrick,
Can you see if the attached solves your issues?
Attachments
16F15355.fcdx
(31.75 KiB) Downloaded 62 times
Martin

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

patrick schoon
Posts: 64
Joined: Mon Aug 23, 2010 7:07 pm
Location: Amsterdam
Contact:

Re: PIC16F15355 Uart and ADC problem

Post by patrick schoon »

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 99 times
Great help, thanks.

Patrick

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8874
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: PIC16F15355 Uart and ADC problem

Post by medelec35 »

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: 64
Joined: Mon Aug 23, 2010 7:07 pm
Location: Amsterdam
Contact:

Re: PIC16F15355 Uart and ADC problem

Post by patrick schoon »

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: 8874
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: PIC16F15355 Uart and ADC problem

Post by medelec35 »

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: 8874
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: PIC16F15355 Uart and ADC problem

Post by medelec35 »

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
Martin

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

patrick schoon
Posts: 64
Joined: Mon Aug 23, 2010 7:07 pm
Location: Amsterdam
Contact:

Re: PIC16F15355 Uart and ADC problem

Post by patrick schoon »

Sorry,

No results.

Attached my test file for check.
Test.fcfx
(24.23 KiB) Downloaded 85 times
Regards,

Patrick

Post Reply