MPLAB C30 : main is not int hatası

Başlatan Voltajcı, 15 Ekim 2016, 19:18:47

Voltajcı

8 adet daha .c uzantılı dosya var fakat main.c yazılımı aşağıda ki gibi hata veriyor. Yanlış bir yer bulamıyorum, atladığm bir yer mi var acaba .

#include "MCP3911_EVB.h"

_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & BKBUG_OFF & COE_OFF & ICS_PGx2 & FWDTEN_OFF & WINDIS_OFF & FWPSA_PR128 & WDTPS_PS32768)
_CONFIG2( IESO_OFF & FNOSC_PRIPLL & FCKSM_CSDCMD & OSCIOFNC_OFF & IOL1WAY_OFF & I2C2SEL_PRI & POSCMOD_XT )
_CONFIG3( WPCFG_WPCFGDIS & WPDIS_WPDIS )

signed char voltage_msb[buffer_lenght], voltage_nsb[buffer_lenght], voltage_lsb[buffer_lenght], current_msb[buffer_lenght], current_nsb[buffer_lenght], current_lsb[buffer_lenght];
unsigned int counter_buffer, counter_tx, count_rx, rx_function, register_write_cnt;
unsigned char tx_buf[10], tx_bufc[3], types, internal_registers[24], rxcounter, char_to_int[3];
unsigned char urxdata, rxbuffer[96], start_cycle, rx_data, write_reg_count;

void main (void)
{
	unsigned long i;
	Init();
	unlockIO();
	ioMap();
	lockIO();
	initLCD(); 		
    clrLCD();
    RESET=1;
  //  Write3911(statusL, 56);
    Read_Internal_Registers();
    SRbits.IPL=3;
    
	while(1)
	{	
	homeLCD();
	putsLCD("  MCP3911 PIC24 ");
   	cmdLCD(0xc0);
	putsLCD("Evaluation board");
//	LEDR=~LEDR;
	for(i=0;i<100000;i++){}
	}
}



HATA :

Executing: "C:\Program Files (x86)\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=24FJ256GA110 -x c -c   "main.c" -o"main.o" -I"C:\Hapenciuc\Hapenciuc\Projects\MCP3911 PIC24F" -g -Wall -mlarge-code -mlarge-data -mconst-in-code
main.c:13: warning: return type of 'main' is not 'int'
Hatasını alıyorum

mozkan87

void main (void)
satırını
int main(void)
olarak değiştirip deneyin.

Voltajcı

#2
Alıntı yapılan: mozkan87 - 15 Ekim 2016, 19:30:33
void main (void)
satırını
int main(void)
olarak değiştirip deneyin.

teşekkür ederim sayın @mozkan87 hocam.


Devamında 2 adet hata ve 2 uyarım var bu kullandığım pic24fj256ga101' de ki register ayarlarından kaynaklanıyor sanırım.
init.c dosyası:



#include "MCP3911_EVB.h"

void Init(void)
{
	unsigned long i;
	unsigned char j;
INTCON1bits.NSTDIS=0;   // enable nested interupts
SRbits.IPL=7;           // disable user interupts
INTCON2bits.INT3EP=0;   // int3 positive edge
IFS3bits.INT3IF=0;      // clear INt3 flag
IPC13bits.INT3IP=2;     // int3 interrupt priority 3
IEC3bits.INT3IE=0;      // int3 interrupt enable (but unly after the SRbits.IPl <6 )

OSCTUNbits.TUN=0;       // FRC frequency 8MHz

CLKDIVbits.ROI=0;       // interrupts have no effect on the DOZEN bit
CLKDIVbits.DOZE=0;      // processor clock reduction select bits Fcy/1
CLKDIVbits.DOZEN=1;     // procesor clock/ peripheral clock ratio is given by DOZE bits
CLKDIVbits.RCDIV=0;    // Internal fast oscilator postscaler FRC divide by 1

OSCCONbits.COSC=0b011;      // Oscilator selection: XT with PLL
OSCCONbits.NOSC=0b011;      // New Oscilator selection: XT with PLL (16MIPS)
OSCCONbits.CLKLOCK=0;   // clock lock enable - not locked
OSCCONbits.LPOSCEN=0;   // Secondary oscilator enable: disable
OSCCONbits.OSWEN=0;     // Oscilator swich enable bit : complete
OSCCONbits.CLKLOCK=1;   // clock lock enable - locked
RCON=0x00; // Reset control register

INTCON2bits.INT2EP=0;	//INT2 is used for DR detect
IEC1bits.INT2IE=1;		
IPC7bits.INT2IP=2;


//ALTRPbits.SCK1CM = 1;

SPI1CON1bits.SMP=0;		//SPI1 is used for communicating with the ADC
SPI1CON1bits.CKE=1;
SPI1CON1bits.CKP=0;
SPI1CON1bits.MSTEN=1;
SPI1CON1bits.SPRE=6;
SPI1CON1bits.PPRE=3;

SPI1STATbits.SPIEN=1;

				// OC1 is used for controlling the sampling speed
OC1CON1 = 0; // It is a good practice to clear off the control bits initially 
OC1CON2 = 0;
OC1CON1bits.OCTSEL = 0b111; // This selects the peripheral clock as the clock input to the OC module 

OC1CON1bits.OCM = 0b111; 	// This selects and starts the Edge Aligned PWM mode
OC1CON2bits.SYNCSEL=0b11111;

OC1R = 0; 					// This is just a typical number, user must calculate based on the waveform requirements and the system clock
OC1RS = 1; 					// Determines the Period 

IEC0bits.OC2IE=1;			// OC2 is used to send data to PC thru UART TX
IPC1bits.OC2IP=2;

OC2CON1 = 0; 
OC2CON2 = 0;
OC2CON1bits.OCTSEL = 0b111; 
OC2R = 2000; 
OC2RS = 4000; 
OC2CON1bits.OCM = 0b111; 
OC2CON2bits.SYNCSEL=0b11111;

IFS0bits.U1RXIF=0;			// UART RX interrupt is used to receive the data from PC
IPC2bits.U1RXIP=5;
IEC0bits.U1RXIE=1;

IFS4bits.U1ERIF=0;
IEC4bits.U1ERIE=1;
IPC16bits.U1ERIP=2;

U1MODEbits.UARTEN=1;
U1MODEbits.BRGH=1;

U1STAbits.UTXEN=1;
U1STAbits.URXISEL=0b00;
U1BRG=3;			//the baud rate used is 912kbauds

AD1PCFG=0xFFFF;

T2CONbits.TON=0;
T2CONbits.TSIDL=0;
T2CONbits.TGATE=0;
T2CONbits.TCKPS1=1;
T2CONbits.TCKPS0=0;
T2CONbits.T32=1;
T2CONbits.TCS=0;

PR2=0;				//  timer 3 is used to control the acquisition time (not sampling speed)
PR3=10;

IFS0bits.T3IF=0;
IEC0bits.T3IE=1;
IPC2bits.T3IP=4;


T4CONbits.TON=0;	//  timer 4 (32 bits) is used to measure the sampling speed
T4CONbits.TSIDL=0;
T4CONbits.TGATE=0;
T4CONbits.TCKPS1=0;
T4CONbits.TCKPS0=0;
T4CONbits.T32=1;
T4CONbits.TCS=0;

DRESET=0;
RESET=0;//MUST BE HIGH FOR the ADC TO WORK

DDR=1;
DR=1;

LATEbits.LATE9=1; 
TRISEbits.TRISE9=1;

DCS=0;
CS=1;

DLEDR=0;
LEDR=0;

DLEDG=0;
LEDG=0;

DEN232=0;
EN232=0;

DMCLK=0;
MCLK=1;

DSCLK=0;
SCLK=1;

DMOSI=0;
MOSI=0;
  
DMISO=1;
MISO=0;
	
DTX1=0;
TX1=1;

DRX1=1;
RX1=1;

CN19=1;
CN16=1;
CN15=1;
DCN19=1;
DCN16=1;
DCN15=1;

counter_buffer=0;
counter_tx=0;
count_rx=0;
rx_function=0;
types=1;
rxcounter=0;
//internal_registers[4]=0b10000000;
internal_registers[20]=0;
internal_registers[21]=192;
internal_registers[22]=70;
internal_registers[23]=22;
start_cycle=0;
//j=56;
//	Write3911(statusL, j);
write_reg_count=0;
}



Hata :

Executing: "C:\Program Files (x86)\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=24FJ256GA110 -x c -c   "init.c" -o"init.o" -I"C:\Hapenciuc\Hapenciuc\Projects\MCP3911 PIC24F" -g -Wall -mlarge-code -mlarge-data -mconst-in-code
init.c: In function 'Init':
init.c:9: error: 'INTCON2BITS' has no member named 'INT3EP'
init.c:65: error: 'OC2CON2BITS' has no member named 'SYNCSEL'
init.c:6: warning: unused variable 'j'
init.c:5: warning: unused variable 'i'
Halting build on first failure as requested.
----------------------------------------------------------------------
Release build of project `C:\Users\FRKN\Desktop\MCP3911EvalBd_Fw_PIC24F_v1.0.0\MCP3911EvalBd_Fw_PIC24F_v1.0.0\MCP3911 PIC24F.mcp' failed.
Sat Oct 15 19:32:48 2016
----------------------------------------------------------------------
BUILD FAILED

mozkan87

Mesaja kod eklerken yazı şeklinde eklemeyin lütfen
#include "MCP3911_EVB.h"

altına
#include "p24FJ256GA110.h"

ekleyin

Voltajcı

Alıntı yapılan: mozkan87 - 15 Ekim 2016, 19:40:41
Mesaja kod eklerken yazı şeklinde eklemeyin lütfen
#include "MCP3911_EVB.h"

altına
#include "p24FJ256GA110.h"

ekleyin

Kodları dediğiniz gibi ekleyeyim bundan sonra teşekkürler :)

@mozkan87 hocam aynı hatayı verdi yine ..

RaMu

init.c:9: error: 'INTCON2BITS' has no member named 'INT3EP'
init.c:65: error: 'OC2CON2BITS' has no member named 'SYNCSEL'


'INTCON2BITS' şu adda bir  üyesi yoktur 'INT3EP'
'OC2CON2BITS'  şu adda bir üyesi yoktur 'SYNCSEL'

yani INTCON2 registerının INT3EP diye bir biti yoktur,
OC2CON2 regısterının SYNCSEL diye bir biti yoktur.

Anlaşılan kullandığın kod başka bir mcu için yazılmış,
o mcu da bu bitler varmış ayarlanmış,
ayarlanmışsa, niye ayarlanmış, yeni mcu da ayarlanmasa ne olur araştırmak lazım,
en kısa yoldan bu error satırlarını kapatabilirsin - yorum yapabilirsin, derlemeye çalışmaz.

Datasheet ten INTCON2 register ına bakıp,
hangi bitlerinin olduğuna ve ne işe yaradığına,
kullandığın mcu nun header dosyasındanda
INTCON2 regısterının hangi bitlerinin tanımlandığına bakabilirsin.
Sorularınıza hızlı cevap alın: http://www.picproje.org/index.php/topic,57135.0.html