Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Problem building a program in MPLAB

Status
Not open for further replies.

panos_papajohn

Member level 2
Joined
Mar 18, 2011
Messages
46
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,640
Hello

Im writing a super simple program cause I want to learn how to use my PICkit3.Im using MPLAB v8.6 and MCC18 compiler.
Code:
#include <p18f1230.h> 
#include <stdio.h> 

#pragma config WDT = OFF 

void main (void) 
{ 
printf ("Hello, world!\n"); 
while (1) 
; 
}

(I know that this code doesn't do anything if it is programed to a PIC)
When I built my project I get the following error :

Error - section '.romdata_vfprintf.o' can not fit the section. Section '.romdata_vfprintf.o' length=0x00000011

What is that??? Have I done anything wrong? I followed the instructions on how to create a project in MPLAB. The only thing that I omitted was the linker script because I read that in the new version it is added automatically. Is it a problem with the program memory of the PIC (I use PIC18F1230)?
Bare in mind that yesterday I was using the same program and compiler, to test the USART interface and everything worked just fine.:? Any ideas?

Thanks in advance
Panos
 

I have used printf() OK on a PIC18F97J60 which has 128K of program memory
however, the device you are using, the PIC18F1230, only has 4K of program memory.
printf() is a complex function so is probably too large to fit into 4K
 

Yes I 've already figured that out.:-D I want to use UART communication between an UMTS module so I have to send AT commands . Would this be a problem for the memory. I was thinking of allocating a buffer memory and then clear the buffer after the usage . Do you think this is possible horace1?

Thank you for your reply
 

AT commands tend to be just text strings so implement a simple function to write a string to sind to the USART
e.g. something along the lines of
Code:
// return true if transmitter busy
char BusyUSART(void)
{
	return !TXSTAbits.TRMT;
}

// write to USART
void WriteUSART(char data)
{
  while(BusyUSART());	// wait for transmitter ready
  TXREG = data;      	// Write the data byte to the USART
}

// write string to transmitter
void putsUSART( char *data)
{
  do
  {  // Transmit a byte
    while(BusyUSART());
    WriteUSART(*data);
  } while( *data++ );
}

void putrsUSART(const rom char *data)
{
  do
  {  // Transmit a byte
    while(BusyUSART());
   WriteUSART(*data);
  } while( *data++ );
}
 

Yes I know the way to do it but the thing is that I want to use several AT commands for the activation of the device, setting the baudrate, query of the network status etc.. I tried the #define statement but I couldn't define more than one strings at the same time because the compiler had a problem with the memory. So I was thinking about allocating a buffer from the memory to send one AT command, and when I want to send another command I'll just have to empty the buffer and load the new command. Is that possible in PICs?
 

if you have a sequence of at commands to send why not do something like
Code:
putrsUSART("at");
putrsUSART("at+csq");
putrsUSART("at+cmgf=1");
clearly after sending each at command you need to check the reply for OK or ERROR, etc
 

:-D Yes of course, it didn't even cross my mind. Thank you very much horace1
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top