Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
The only sure way I know of fixing the C018i error is to specify the lib path from PROJECT>BUILD_OPTIONS_PROJECTError - could not find file 'c018i.o'.
#include <p18f1320.h>
#pragma config WDT = OFF, LVP = OFF, OSC = INTIO2
void main(){
char count;
unsigned int temp;
OSCCON=0x60; //Osc=4MHz
ADCON1=0x7f; //All digital
count=0;
temp=0b0000100000000000;
while((temp&(1<<count))==0){
count++;
}
while(1);
}
unsigned int temp=10*60;
unsigned int temp=600;
Mike.
and
Sure, add it to that thread. It's not really a bug but can cause some nasty bugs.
Who would have thought that writing,
would not be the same as,Code:unsigned int temp=10*60;
I always assumed that constants would be treated as 32 (or even 64) bits on the PC and cast to the appropriate size during assignment.Code:unsigned int temp=600;
Mike.
unsigned int temp = (int)10 * (int) 60;
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC-18\PRO\9.66\bin\picc18.exe" --pass1 "C:\Users\Austin Schaller\Documents\MPLAB Projects\MPLAB C Projects\I²C_18LF4520_HT.c" -q --chip=18F4520 -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC-18\PRO\9.66\bin\picc18.exe" -oI²C_18LF4528_HT.cof -mI²C_18LF4528_HT.map --summary=default --output=default I²C_18LF4520_HT.p1 --chip=18F4520 -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
HI-TECH C PRO for the PIC18 MCU Family V9.66
Copyright (C) 1984-2011 HI-TECH SOFTWARE
licensed for evaluation purposes only
this licence will expire on Sat, 15 Oct 2011
Advisory[1233] Employing 18F4520 errata work-arounds:
Advisory[1234] * Corrupted fast interrupt shadow registers
Error [499] ; 0. undefined symbol:
_WriteI2C(I²C_18LF4528_HT.obj)
********** Build failed! **********
/************************************************************************
*
* Module: I²C_18LF4520_HT.C
* Description: Code to determine I²C functionality with the HI-TECH
* compiler.
* Line length: 120 characters [only if the length is longer than 80 chars]
* Functions: See Below
*
* Date: Authors: Comments:
* 24 Aug 2011 Austin Schaller Created
*
************************************************************************/
#include <htc.h>
#include <stdio.h>
#include "peripheral\i2c.h"
__CONFIG(1, MCLRE_ON & CP0_OFF & BOREN_OFF & WDT_OFF & PWRT_ON & OSC_INTIO67);
void main()
{
unsigned char data = 0xFF;
OSCCON = 0x70; // OSC = 8 MHz
StartI2C();
WriteI2C(data);
StopI2C();
}
In order to use the supplied Microchip-compatible peripheral library functions, the user must ensure
the --runtime=+plib option is passed to the driver on the command line, or "Link in Peripheral
Libraries" is selected in the "Runtime Options" section of the Project Build Options in MPLAB.
The user need not include <plib.h> directly, as including <htc.h> will automatically include
<plib.h> when the above option is used, or the macro _PLIB is defined.
MPLINK 4.40, Linker
Device Database Version 1.3
Copyright (c) 1998-2011 Microchip Technology Inc.
Error - section '.udata_c018i.o' can not fit the section. Section '.udata_c018i.o' length=0x0000000a
Errors : 1
Link step failed.
Hey DS8 the other way is to Initialise a few variables... then they are compiled in the idata section as well as the udata section... Microchip didn't figure on folks like us declaring ALL of the variables un-initialised.... There is a couple of banks reserved for both..
long var1,var2,var3;
long var1 = 0, var2 = 0, var3 = 0;
I had a program that run out of udata ( un-initialised data ) ie.
Code:long var1,var2,var3;
Changed ALL the variables to idata ( initialised data )
Code:long var1 = 0, var2 = 0, var3 = 0;
That was it!!! Tons more memory. (well a bit anyway)
T0CONbits.TMR0ON = 1; // start timer0
while(1)
{
Nop();
Nop();
Nop();
TMR0H = h++; // if you step these 2 lines it does not work
TMR0L = l++;
result = TMR0L;
result += ((unsigned int) TMR0H)<<8;
Nop(); // set BP here
Nop();
Nop();
TMR0H = 0x00; // if you step these 2 lines it does not work
TMR0L = 0x00;
result0 = TMR0L;
result0 += ((unsigned int) TMR0H)<<8;
}
}