ERROR IN PIC16F1709 CODE

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
SILVESTROS9
Posts: 115
Joined: Wed Aug 03, 2016 10:45 pm
Has thanked: 24 times
Been thanked: 11 times
Contact:

ERROR IN PIC16F1709 CODE

Post by SILVESTROS9 »

Hello to all....
I was loaded a working code with PIC16F1939 that displays chars on a 4x20LCD, to a smaller pcb using a PIC16F1709....the code runs, but have no chars on LCD and get an error "invalid checksum"....where is the problem? at FC7 code , or at programmer ? my programmer is PICkit2 with modified .dat file (PK2Devicefile-1.62.14), to support PIC16F1709...
Attachments
20190612_132008.jpg
20190612_132008.jpg (92.82 KiB) Viewed 5307 times
20190612_132134.jpg
20190612_132134.jpg (169.26 KiB) Viewed 5307 times
20190612_132457.jpg
20190612_132457.jpg (148.94 KiB) Viewed 5307 times

SILVESTROS9
Posts: 115
Joined: Wed Aug 03, 2016 10:45 pm
Has thanked: 24 times
Been thanked: 11 times
Contact:

ERROR IN PIC16F1709 CODE

Post by SILVESTROS9 »

below are the schematic and the code...the project is to send chars with a Modbus master (a PLC) , to a 4x20 lcd..
Attachments
MB-LCD-4X20-PIC16F1709-01.fcfx
(17.11 KiB) Downloaded 221 times
20190612_140239.jpg
20190612_140239.jpg (91.95 KiB) Viewed 5307 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: ERROR IN PIC16F1709 CODE

Post by LeighM »

Maybe in the conversion from PIC16F1939 to PIC16F1709 you have missed something, clock configs etc?
As often suggested, have you tried a simple LED or output toggle to check the code through to programming of the new PIC16F1709 board is correct?

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: ERROR IN PIC16F1709 CODE

Post by LeighM »

Hi,
In the config settings you have HS Osc and x4 PLL
I presume you have an external 16MHz crystal?
With those settings you will need to set the Clock Speed in the General Options to 64MHz to get the correct UART baud rate

User avatar
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: ERROR IN PIC16F1709 CODE

Post by Benj »

Hello,

I do bang on about the one second flasher but this will help to save yourself from these types of headaches time and time again.
https://www.matrixtsl.com/wiki/index.ph ... ED_flasher

SILVESTROS9
Posts: 115
Joined: Wed Aug 03, 2016 10:45 pm
Has thanked: 24 times
Been thanked: 11 times
Contact:

Re: ERROR IN PIC16F1709 CODE

Post by SILVESTROS9 »

I made the flasher test...not work....Ι would like to use use INTOSC ....what is the proper fosc.? what is the proper config? the test was with HS osc.config and 16MHZ fosc.
Attachments
20190612_210832.jpg
20190612_210832.jpg (146.98 KiB) Viewed 5289 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: ERROR IN PIC16F1709 CODE

Post by medelec35 »

Running with internal osc at 16MHz, you will to:
Disable PLL
Within Build, Project options change the osc type from HS (that is for an external crystal or resonator above 4MHz) to Intosc.
Place a C code icon at the very start,before the main loop.
Within the C code icon add

Code: Select all

OSCCON = 0x78;
Martin

SILVESTROS9
Posts: 115
Joined: Wed Aug 03, 2016 10:45 pm
Has thanked: 24 times
Been thanked: 11 times
Contact:

Re: ERROR IN PIC16F1709 CODE

Post by SILVESTROS9 »

update....after config changes (thanks medelec35), the code runs (flash test ok), but no chars on LCD....The same communication error.."invalid checksum in response "...a hardware damage at SN75176 maybe ? it seems that there is no valid response code....line10 below...response code : no slave address (01d), no function code (16d), no data address of the first register(001d).....very strange..the code works fine with PIC16F1939....NOTE : pickit2 not support PIC16F1709....I use an updated .dat with some extra chip....maybe there is a problem with that ?

01:01:46.626: ===========================[Serial Port Setup]=========================================
01:01:46.629: Com5, Baud Rate: 9600, Data Bits: 8 Bits, Parity: None, Stop Bits: 1 Stop Bit
01:01:46.631: Echoback: Off, RTS Control: Off, Transmit Delay: 5 ms, Response Delay: 600 ms
01:01:46.634: =======================================================================================
01:01:46.644: Write Holding Register(s)
01:01:46.647: Device Address: 1d, Register: 1d, Number of Registers: 10
01:01:46.649: |-> Write Register: 1d, Number of Registers : 10
01:01:46.658: -> [001d] [016d] [000d] [001d] [000d] [010d] [020d] [000d] [127d] [000d] [068d] [000d] [100d] [000d] [051d] [000d] [065d] [000d] [084d] [000d] [083d] [000d] [073d] [000d] [083d] [000d] [032d] [163d] [068d]
01:01:46.681: <- [255d] [255d] [255d] [001d] [255d] [055d] [187d] [125d] [255d] [089d]
01:01:46.683: Error > Invalid checksum in response.

Post Reply