What PIC compiler does Silicon chip use for their 8bit PIC projects? - Page 1
Forum section: electronics / beginners

author: digitalnomadjc
author_rank: Contributor
timestamp: March 07, 2016, 01:20:06 pm
content: I've bought some PIC code off the Silicon Chip Website for the USB Power Monitor.Does anyone have any idea what compiler they used? I can't get it to compile withe XC8 or C18 v3.47.Thanks.

author: Ian.M
author_rank: Super Contributor
timestamp: March 07, 2016, 01:46:40 pm
content: What do the #include lines say, and how have they set the CONFIG (aka 'FUSES')? That's normally enough to recognise the compiler but isn't a large enough snippet to cause copyright issues if posted.

author: digitalnomadjc
author_rank: Contributor
timestamp: March 07, 2016, 10:33:57 pm
content: Hi Ian,This is what I have.#include "p18F45K80.h"#include <string.h>#pragma config RETEN = ON //VREG Sleep Enable bit#pragma config INTOSCSEL = LOW //LF-INTOSC Low-power Enable bit#pragma config SOSCSEL = DIG //SOSC Power Selection and mode Configuration bits#pragma config XINST = OFF //Extended Instruction Set#pragma config FOSC = INTIO2 //Oscillator#pragma config PLLCFG = OFF //PLL x4 Enable bit#pragma config FCMEN = ON //Fail-Safe Clock Monitor#pragma config IESO = OFF //Internal External Oscillator Switch Over Mode#pragma config PWRTEN = OFF //Power Up Timer#pragma config BOREN = OFF //Brown Out Detect#pragma config BORV = 3 //Brown-out Reset Voltage bits#pragma config BORPWR = HIGH //BORMV Power level#pragma config WDTEN = OFF //Watchdog Timer#pragma config WDTPS = 16384 //Watchdog Postscaler#pragma config CANMX = PORTB //ECAN Mux bit//#pragma config MSSPMSK = MSK7 //MSSP address masking#pragma config MCLRE = OFF //Master Clear Enable#pragma config STVREN = ON //Stack Overflow Reset//#pragma config BBSIZ0 = BB2K //Boot Block Size#pragma config CP0 = OFF //Code Protect 00800-03FFF#pragma config CP1 = OFF //Code Protect 04000-07FFF#pragma config CP2 = OFF //Code Protect 08000-0BFFF#pragma config CP3 = OFF //Code Protect 0C000-0FFFF#pragma config CPB = OFF //Code Protect Boot#pragma config CPD = OFF //Data EE Read Protect#pragma config WRT0 = OFF //Table Write Protect 00800-03FFF#pragma config WRT1 = OFF //Table Write Protect 04000-07FFF#pragma config WRT2 = OFF //Table Write Protect 08000-0BFFF#pragma config WRT3 = OFF //Table Write Protect 0C000-0FFFF#pragma config WRTC = OFF //Config. Write Protect#pragma config WRTB = OFF //Table Write Protect Boot#pragma config WRTD = OFF //Data EE Write Protect

author: Agent24
author_rank: Regular Contributor
timestamp: March 07, 2016, 11:13:06 pm
content: They still supply compiled HEX files don't they? Just burn that to the correct PIC. That's what I did last time I built a PIC based project from them. No reason to bother compiling it yourself.

author: MSO
author_rank: Contributor
timestamp: March 07, 2016, 11:50:32 pm
content: Have you tried replacing #include "p18F45K80.h" with #include <xc.h>? I'm new to the PIC family, so I've used MPLAB X and xc8 only. The help files recommend using only the <xc.h> instead of the include for the specific chip. I assume they are passing info in the make files/environment that ends up selecting the correct chip.

author: Ian.M
author_rank: Super Contributor
timestamp: March 08, 2016, 12:12:02 am
content: Microchip C18.http://www.microchip.com/c18

author: ade
author_rank: Unknown
timestamp: March 08, 2016, 12:41:53 am
content: QuoteWhat compile error(s) are you getting? Different versions of the tools came with different header over the years... so maybe a version conflict.

author: digitalnomadjc
author_rank: Contributor
timestamp: March 08, 2016, 12:03:47 pm
content: Quote from: Agent24 on March 07, 2016, 11:13:06 pmI assembled the project but it isn't working. I wanted to write a program to run a diagnostic test on the LCD.

author: digitalnomadjc
author_rank: Contributor
timestamp: March 08, 2016, 12:06:12 pm
content: Quote from: MSO on March 07, 2016, 11:50:32 pmThanks I'll try that.

author: digitalnomadjc
author_rank: Contributor
timestamp: March 08, 2016, 12:07:16 pm
content: Quote from: Ian.M on March 08, 2016, 12:12:02 amThanks so I'm on the right track with my complier.

author: Ian.M
author_rank: Super Contributor
timestamp: March 08, 2016, 01:52:33 pm
content: C18 code doesn't port well to XC8 so the best option is to tackle the compilation errors one by one. If you post the error messages we'll have some idea what's going wrong. You may need to post a snippet of the code from the lines around each error, but let's not do that unless we have to.

author: digitalnomadjc
author_rank: Contributor
timestamp: March 08, 2016, 10:41:28 pm
content: Quote from: ade on March 08, 2016, 12:41:53 amThis is what I get:Executing: "C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin\mcc18.exe" -p=18F45K20 "main.c" -fo="main.o" -D__DEBUG -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-MPLAB C18 3.47 (evaluation)Copyright 2000-2011 Microchip Technology Inc.Days remaining until evaluation becomes feature limited: 58WARNING: Running the compiler in extended mode will not be supported when the evaluation becomes feature limited.C:\code\PIC\USB Power Monitor\main.c:45:Error  configuration setting 'RETEN' not recognizedC:\code\PIC\USB Power Monitor\main.c:46:Error  configuration setting 'INTOSCSEL' not recognizedC:\code\PIC\USB Power Monitor\main.c:47:Error  configuration setting 'SOSCSEL' not recognizedC:\code\PIC\USB Power Monitor\main.c:49:Error  configuration value 'INTIO2' not recognized for configuration setting 'FOSC'C:\code\PIC\USB Power Monitor\main.c:50:Error  configuration setting 'PLLCFG' not recognizedC:\code\PIC\USB Power Monitor\main.c:53:Error  configuration setting 'PWRTEN' not recognizedC:\code\PIC\USB Power Monitor\main.c:55:Error  configuration value '3' not recognized for configuration setting 'BORV'C:\code\PIC\USB Power Monitor\main.c:56:Error  configuration setting 'BORPWR' not recognizedC:\code\PIC\USB Power Monitor\main.c:59:Error  configuration setting 'CANMX' not recognized

author: Ian.M
author_rank: Super Contributor
timestamp: March 08, 2016, 10:48:51 pm
content: You've got the wrong device selected for the project in MPLAB X:Quote

author: Agent24
author_rank: Regular Contributor
timestamp: March 08, 2016, 11:04:43 pm
content: Quote from: digitalnomadjc onTodayat 01:03:47 AMHave you looked for hardware errors first?

author: Agent24
author_rank: Regular Contributor
timestamp: March 09, 2016, 01:52:10 am
content: I found that kit online, someone showing how they assembled it:http://tronixstuff.com/2013/01/16/kit-review-scjaycar-usb-power-monitor/The SMD parts are all done for you, apparently, so assuming you bought the kit then that shouldn't be a problem. If you just bought a bare board then you will need to check everything. If you made your own board.. check everything three times.The LCD isn't likely to be bad, but it can go both ways and isn't marked. They said hold it up to the light to see the segments before you solder it in. Maybe you got it backwards? I hope not, because desoldering 42 PTH leads on a bare LCD won't be fun unless you have a good desoldering gun.

author: Ian.M
author_rank: Super Contributor
timestamp: March 09, 2016, 02:04:38 am
content: Quote from: Agent24 on March 09, 2016, 01:52:10 amIf it is that, getChipQuik! Used after braid or a sucker, it gets the melting point down low enough for any cheap hot-air gun, to keep the joints liquid. without overheating the board.However I think we need a better description of the symptoms than "doesn't work" before deciding its been assembled wrong.

author: digitalnomadjc
author_rank: Contributor
timestamp: March 09, 2016, 06:08:47 am
content: I bought the kit from Jaycar and yes all the SMD work was already done. I was worried about soldering in the LCD backwards but noticed that one end had a 'bump' in the plastic housing. I then studied the picture in the Magazine to work out which way the bump was. Also there is a black line border and where the bump is the line has two gaps in it. figures come up on the screen but it looks 'wrong' (I'll post a picture later on today).Also I used MPLAB IDE v8.46 as the project file was in this format.Good point about hardware debugging first. I just thought testing the LCD might be the place to start so I could use my ICD3 to step through the code.

author: digitalnomadjc
author_rank: Contributor
timestamp: March 09, 2016, 06:13:06 am
content: Quote from: Ian.M on March 09, 2016, 02:04:38 amAgreed the symptom isn't very specific. I'll get out my Multimeter and DSO to start some basic tests.

author: digitalnomadjc
author_rank: Contributor
timestamp: March 09, 2016, 06:14:21 am
content: Quote from: wilfred on March 09, 2016, 12:57:50 amCheers. will do.

author: Agent24
author_rank: Regular Contributor
timestamp: March 09, 2016, 06:52:37 am
content: Which way did you align the bump? The datasheet fromhttp://www.jaycar.co.nz/Active-Components/Display-%26-Embedded/LCD-Displays/4-Digit-Field-Effect-LCD/p/ZD1886implies (but does not explicitly state) that the bump is at Pin 1 end.