PiC18F1220 problems whit WD and INT

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

Post Reply
castabob
Posts: 25
Joined: Sun May 20, 2018 10:41 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

PiC18F1220 problems whit WD and INT

Post by castabob »

Goodmorning everyone,
since several days I try to get out of a problem with numerous attempts but I can not, if someone could help me I would be grateful.
I am using a PIC18F1220 and in simulation with flowcode6 my program works very well but when I load it in my target the program, (compiled in HEX) resets every 2 minutes approximately and moreover the INT does not work. I tried to compile in HEX with Flowcode7 but I get a series of errors that I can not fix. I attach both the CHIP setting and the error text I receive. Grateful to those who help me solve the problem.

Regards
castabob
Attachments
Errors.txt
(1.94 KiB) Downloaded 212 times
Options.png
(46.04 KiB) Downloaded 3130 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: PiC18F1220 problems whit WD and INT

Post by LeighM »

The V7 error log indicates that you are using SPI, but in hardware mode that the device does not support.
So for V7 please check the SPI properties and ensure "Software" channel is selected.

castabob
Posts: 25
Joined: Sun May 20, 2018 10:41 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: PiC18F1220 problems whit WD and INT

Post by castabob »

Hi LeighM,

thanks for the reply, but in the properties is set "software". Unless you're referring to anything else that I do not know. Sorry but I'm not very experienced.
Attachments
spi_legacy.png
(27.03 KiB) Downloaded 3127 times

castabob
Posts: 25
Joined: Sun May 20, 2018 10:41 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: PiC18F1220 problems whit WD and INT

Post by castabob »

Hi, is there anyone who can give me advice on how to solve mistakes?
I compile my program with Flowcode6 and the compilation is OK without errors, I load the .Hex file in my target and everything works properly. When I try to compile the same program with Flowcode7 I receive many error reports that even if I understood them, I would not know how to intervene since I do not know the "C" language (for that I bought Flowcode). The result is that despite having purchased several months ago Flowcode7 I never managed to compile with it.
I hope my poor English is understandable ...

Regards
castarob
Attachments
Compilations errors.txt
(1.94 KiB) Downloaded 217 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: PiC18F1220 problems whit WD and INT

Post by medelec35 »

Hi castarob,
It would help a lot if you can post the flowchart that has all the errors when you try to compile.
I added the SPI Master (EB013), changed to software mode :

Code: Select all

Device:        PIC.18F.18F2220
Generated by:  Flowcode v7.3.0.7
Date:          Wednesday, June 27, 2018 21:04:25
Users:         1
Registered to: Martin
Licence key:   BA48R5
http://www.matrixtsl.com
Launching the compiler...
D:\Flowcode 7\compilers\pic\bin\xc8.exe  --chip=18F2220 "Flowcode1.c" --MSGDISABLE=359,1273,1388 --FLOAT=32 --DOUBLE=32
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

Employing 18F2220 errata work-arounds:
 * Peripherals can misbehave if BSR = 15
 * DAW instruction may improperly clear CARRY bit
using updated 32-bit floating-point libraries; improved accuracy might increase code size

Memory Summary:
    Program space        used    DFh (   223) of  1000h bytes   (  5.4%)
    Data space           used    2Ch (    44) of   200h bytes   (  8.6%)
    Configuration bits   used     7h (     7) of     7h words   (100.0%)
    EEPROM space         used     0h (     0) of   100h bytes   (  0.0%)
    ID Location space    used     0h (     0) of     8h bytes   (  0.0%)
    Data stack space     used     0h (     0) of   180h bytes   (  0.0%)


You have compiled in FREE mode.
Using Omniscient Code Generation that is available in PRO mode,
you could have produced up to 60% smaller and 400% faster code.
See http://www.microchip.com/MPLABXCcompilers for more information.


Launching the linker/assembler...
D:\Flowcode 7\tools\DoNothing\DoNothing.exe  


FINISHED
Martin
Martin

castabob
Posts: 25
Joined: Sun May 20, 2018 10:41 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: PiC18F1220 problems whit WD and INT

Post by castabob »

Hi Martin

thanks for your help,
attached I send you the program that, as I said, with Flowcode6 is compiled without problems but gives errors with compilation in Flowcode7. You will find in "main" a disabled icon that calls INT2 that I have masked because although it works in simulation, it does not work in the target (I do not understand why and in any case I have masked it).
Attachments
Visu_eggs 5x7 in 5x7.fcfx
(82.18 KiB) Downloaded 211 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: PiC18F1220 problems whit WD and INT

Post by LeighM »

Hi,
The SPI CAL properties have got lost in the transfer from v6 to v7.
To fix this, please first enable the "Expose full component tree.." in the Component Debugger window...
debug.jpg
debug.jpg (75.14 KiB) Viewed 7763 times
Then in the Properties window select the cal_spi component...
cal_spi.jpg
cal_spi.jpg (24.65 KiB) Viewed 7763 times
Now correct the Channel to the required "Software" option...
software.jpg
software.jpg (39.36 KiB) Viewed 7763 times
Also please note that for V7 you will need to change the osccon word in the main C icon, to upper case OSCCON

Save the project and re-build

castabob
Posts: 25
Joined: Sun May 20, 2018 10:41 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: PiC18F1220 problems whit WD and INT

Post by castabob »

Good morning,
I thank you for the suggestion, at the time I had made the correction and it worked. Since I was not able to run the INT and fell into frustration and had to deliver the project to the client, I had the software made by a third person in C language.
Now I have made a new project that is partly working but that, like the previous one, does not work in the part that calls INT TMR0 (the thing that sends me out of the reasoning is that in simulation, like that of the previous time, it works!) . Another thing that baffles me is that if I compile (HEX) the project with Flowcode7 the first clear thing happens that the output of port B3 remains active (I have not investigated further and returned to fill in flowcode6 without forget to change from uppercase to lowercase "posccon" (I honestly do not understand why I have to enter this instruction if I already defined the clock speed in the settings ...)). In this regard, I ask you where I can find the syntax differences between version 6 and 7.
I would be grateful if you could give me a suggestion to go through with my new project.
Sorry for my approximate inlese but I'm writing with the support of "Google translator".
I am attaching my software, please see what the defect is.
Best Regards
castarob
Attachments
TX_RX_Segnapasso 18F1220.fcfx
(44.39 KiB) Downloaded 223 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: PiC18F1220 problems whit WD and INT

Post by LeighM »

For the TMR0 input you have selected the external pin, not the internal clock, is that intended?
clockpin.jpg
clockpin.jpg (37.51 KiB) Viewed 7617 times

castabob
Posts: 25
Joined: Sun May 20, 2018 10:41 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: PiC18F1220 problems whit WD and INT

Post by castabob »

Hi LeighM,

thanks so much! I get it. I made a mistake but why did it work in the simulation? It confused me a lot. Now it works even if I had to move the output, which I was flickering to check if the INT worked, from RA4 to RA3 as R4 did not flicker, I still do not know why but I will understand ... I hope).
As soon as you have a moment, could you answer the other questions I asked in my first message?
Thank you so much

castarob

Post Reply