Jump to content

anothermort

EstablishedMember
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About anothermort

  • Rank
    Newbrie
  1. Hi dont you need volatile char eeadrh; //dummy variable that is needed to link to eeprom library for PIC18s that don't have EEARDH register For pics that do not have the EEARDH register
  2. I have used this before and it works fine, cannot remember where it came from #include "a6276.h" unsigned char ten,one; unsigned char romcode[8]; void main(void) { unsigned char x,digit1,digit2; trisb=0b00110000; trisc=0; sspstat=0b01000000; //set up SPI sspcon1=0b00000010; sspcon1.SSPEN=1; latch=1; outenable=0; delay_ms(255); while(1){ readtemp(); digit2=alpha1[one]; digit1=alpha1[ten]; spi_out(digit2,digit1); delay_ms(255); } } unsigned char owreset(void) { DQ=0; //pull DQ low delay_10us(50); //for minimum 480uS DQ=1; //then release bus and set DQ to input delay_us(70); //and wait 70uS if(!portb.0){ //if presence pulse set delay_10us(43); return(0); //1-wire device successfully found } else{ delay_10us(43); return(1); //no 1-wire device found } } void owwritebit(bit thebit) { if(thebit){ DQ=0; delay_us(6); DQ=1; delay_us(64); } else{ DQ=0; delay_us(60); DQ=1; delay_us(10); } } unsigned char owreadbit(void) { unsigned char result; DQ=0; delay_us(6); DQ=1; delay_us(9); result=portb.0; delay_us(55); return result; } void owwritebyte(unsigned char byte) { unsigned char x; for(x=0;x<8;x++){ owwritebit(byte.0); byte>>=1; } } unsigned char owreadbyte(void) { unsigned char x,result=0; for(x=0;x<8;x++){ result>>=1; if(owreadbit()) result|=0x80; } return result; } void readtemp(void) { unsigned char store[10]; unsigned char x,msb,lsb; owreset(); owwritebyte(0xcc); //skip ROM owwritebyte(0x44); //start conversion delay_ms(100); owreset(); owwritebyte(0xcc); //skip ROM owwritebyte(0xbe); //read scratchpad for(x=0;x<9;x++){ store[x]=owreadbyte(); } msb=store[1];lsb=store[0]; msb=msb<<4;lsb=lsb>>4; x=0; x=x|msb|lsb; fix(x); } void fix(unsigned char dec2) { unsigned char count=0; while(dec2 >= 10){ dec2=dec2-10; count=count+1; } ten=count; one=dec2; } void spi_out(unsigned char ten,unsigned char one) { unsigned char junk; sspbuf=ten; while(!sspstat.BF); junk=sspbuf; sspbuf=one; while(!sspstat.BF); junk=sspbuf; } #include <system.h> #include <oo.h> #pragma CLOCK_FREQ 20000000 // #pragma DATA _CONFIG1H, _HS_OSC_1H & _OSCS_ON_1H // #pragma DATA _CONFIG2H, _WDT_OFF_2H // #pragma DATA _CONFIG4L, _LVP_OFF_4L void spi_out(unsigned char,unsigned char); void fix(unsigned char); unsigned char owreset(void); void owwritebit(bit); unsigned char owreadbit(void); void owwritebyte(unsigned char); unsigned char owreadbyte(void); void readtemp(void); void fix1(unsigned char); unsigned char owreset1(void); void owwritebit1(bit); unsigned char owreadbit1(void); void owwritebyte1(unsigned char); unsigned char owreadbyte1(void); void readtemp1(void); #define latch latc.0 #define outenable latc.2 #define DQ latb.7 #define DQ1 latb.6 unsigned char alpha1[] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f, 0x77,0x7c,0x39,0x5e,0x79,0x71,0x76,0x79,0x38,0x73};
  3. When I remove the option, it compiles fine again. When -idx 2 option is used the compiler uses a different build of library code that is build also with the -idx 2 option.Both library builds are contain in the same libray file, so it sounds like your library file has only the -idx 1 build in it. What is your exact version of SB are you using? Regards Dave Looks like I am getting something similar, when adding the -idx 2 option to both compiler and linker Using Version 7.03 with Mplab v8.66 Optimisation level:1 Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)' Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)' Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)' Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)' Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)' Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)' Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)' Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)' Error: Unresolved external function:'__rem_16_16(unsigned short,unsigned short)' etc.
  4. When I did this on Mplab v8.53 and Windows 7 64bit I had to point Mplab to source boost manually, as integrate did not work.
×
×
  • Create New...