Page 1 of 1

PIC16F15355 Uart and ADC problem

Posted: Thu Dec 20, 2018 7:54 pm
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 246 times
Please check, and thanks.

Re: PIC16F15355 Uart and ADC problem

Posted: Thu Dec 20, 2018 9:43 pm
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?

Re: PIC16F15355 Uart and ADC problem

Posted: Sun Dec 23, 2018 5:36 pm
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.

Re: PIC16F15355 Uart and ADC problem

Posted: Sun Dec 23, 2018 5:49 pm
by medelec35
You're welcome,
Have you tried here?

Re: PIC16F15355 Uart and ADC problem

Posted: Mon Dec 24, 2018 12:25 pm
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)

Re: PIC16F15355 Uart and ADC problem

Posted: Wed Dec 26, 2018 3:09 pm
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

Re: PIC16F15355 Uart and ADC problem

Posted: Wed Dec 26, 2018 3:31 pm
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?

Re: PIC16F15355 Uart and ADC problem

Posted: Wed Dec 26, 2018 8:01 pm
by medelec35
Hi Patrick,
Can you see if the attached solves your issues?

Re: PIC16F15355 Uart and ADC problem

Posted: Thu Dec 27, 2018 4:56 pm
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 279 times
Great help, thanks.

Patrick

Re: PIC16F15355 Uart and ADC problem

Posted: Thu Dec 27, 2018 5:38 pm
by medelec35
You're welcome.
Does the PWM work now?

Re: PIC16F15355 Uart and ADC problem

Posted: Thu Dec 27, 2018 8:40 pm
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

Re: PIC16F15355 Uart and ADC problem

Posted: Thu Dec 27, 2018 8:57 pm
by medelec35
Try adding a c code block at the start with

Code: Select all

T2CLKCON = 1;

Re: PIC16F15355 Uart and ADC problem

Posted: Thu Dec 27, 2018 9:17 pm
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

Re: PIC16F15355 Uart and ADC problem

Posted: Thu Dec 27, 2018 9:58 pm
by patrick schoon
Sorry,

No results.

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

Patrick