Hello
I opened teh project you send over in CodeWarrior for HC12 V4.5 and I could build,it without any problem.
I did not get any error message.
I made sure the lines
sprintf(Buff,"IP = %d",ip_address);
LCDPuts_Line2(Buff);
LCDPuts_Line2("Please Proceed The Work!");
are uncommented. Am I missing something?
CrasyCat
Hi,
Thanks for your reply. First things is for currently, I'm usign Codewarrior v3.1, so may be in your version it can be compile. By the way, this is not the problem. For the pass few days, I'm trying for include the LCD display at output for when select the LED bar in the webpage, then the LED will light up on the board and as well the LCD will display which LED are lighten up. This can be done with no error. However, I've try to reduce the code in the "main loop", then the LCD command that you've possed will be function.
I've disable some pervious function that I've posted in the forum, and found out the IP value that shows in LCD are not same as defined. The value shows is, when in Hex is F233, and when I want to change to Dec value "change to %d", then the value is -3533. What can I do to display the actual value of the IP address? Did the program that I've modified have any mistake? Below are the program been modified:-
void main(void)
{
//main() variable list
INT16 len;
char Buff[32];
/*
* Step 1: Intialize CRG, SCI, EMAC, and EPHY
* Main Loop: Process Recieved Packets
*
*
* NOTE.- THIS EXAMPLE IS BUILD WITH THE FOLLOWING CONFIGURATIONS (see ne64config.h)*
*
* WORD_ACCESS 1 - use word access
* ZERO_COPY 1 - use zero copy
* RX_POLL_MODE 0 - use buffer interrupts
*/
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
Indication(TRUE);
// Set our network information. This is for static configuration.
/* IP address */
localmachine.localip = *((UINT32 *)ip_address);
/* Default gateway */
localmachine.defgw = *((UINT32 *)ip_gateway);
/* Subnet mask */
localmachine.netmask = *((UINT32 *)ip_netmask);
/* Ethernet (MAC) address */
localmachine.localHW[0] = hard_addr[0];
localmachine.localHW[1] = hard_addr[1];
localmachine.localHW[2] = hard_addr[2];
localmachine.localHW[3] = hard_addr[3];
localmachine.localHW[4] = hard_addr[4];
localmachine.localHW[5] = hard_addr[5];
/* Init system services */
timer_pool_init();
/* Initialize all buffer descriptors */
mBufInit ();
/*interrupts can be enabled AFTER timer pool has been initialized */
/* Initialize all network layers */
EtherInit();
__asm CLI; /* Enable Interrupts */
#if USE_EXTBUS
ExternalBusCfg();
#endif
arp_init();
(void)udp_init();
(void)tcp_init();
/* Initialize applications */
(void)https_init ();
// THIS FUNCTION IS NOT NEEDED FOR EXAMPLE 2 smtpc_init ();
(void)udp_demo_init();
//REMOVE FOR EXAMPLE 2 // RTI_Enable ();
//RTI1_Init();
/* Add user application init code here */
MyAppInit();
LCDInit();
for (; /* do forever */
{
#if USE_SWLED
UseSWLedRun();
#endif
if (gotlink) {
LCDPuts_Line1(" Ethernet Was Connected ");
sprintf(Buff,"IP = %X",hard_addr);
LCDPuts_Line2(Buff);
} // if (gotlink)
else
{
/* Link is DOWN - Add user application code here */
MyAppNotLinked();
LCDPuts_Line1("Ethernet Was Not Connect");
//LCDPuts_Line2("CAT 5 Cable Not Connect!");
} /* if (gotlink) */
} /* Forever loop */
for(;{}
}
May I know how this function are connected in the demo program:- "INT32 udp_demo_eventlistener()" link to and link from? This function can be found in udpinterface.c. And also can you also tell me this function "void porth_isr_handler(void)" link to and link from?
However, do you have any method for testing the connection of TCP/IP where we can capture the data sedning from the MCU and also we can send the data to from PC to MCU. In this way we can control the MCU through sending the command data from PC through Internet to MCU like those application in RS-232?
How actually to getting more understand how's the data flow and also the connection of the TCP/IP? This may help when writting the firmware in MCU.
Regards
kahjoo
Hello
Well did I understand well that the only remaining problem is that the PC is written as a signed int and you want to get it printed differently?
If you want to get it printed as an unsigned int you have to use the modifies %u in sprintf.
If you want to print it as an hexadecimal value, use modified %X.
Now How are you retrieving the value of thy IP?
Which is its format when you get it?
CrasyCat
Hi Cath and Malaysia,
I quickly read through the post and might say something completely stupid.
Still, as I want to say it, I jump:
Isn't it possible that because you call the function "fprintf" an additional library is compiled and this ends up being too big ?
I wonder coz I had a similar problem when I tried with floats on HC08. I know... not very clever... We all have our moments
Cheers,
Alban.
Hello
Actually the message Out of allocation space in segment ROM_PAGE3D at address 0x3DBFD2 indicates that the code is too big and cannot be allocated on page 3D anymore.
In order to be able to build the application, you need to provide more space to store the code.
If you are building in BANKED memory model, you can just modify your .PRM file as follows:
Write
MyConstSegPage1, DEFAULT_ROM INTO ROM_PAGE3C, ROAM_PAGE3D;
instead of
MyConstSegPage1 INTO ROAM_PAGE3C;
DEFAULT_ROM INTO ROAM_PAGE3D;
This may help a little bit.
I am not sure though if you have enough memory available on page 3C.
Then which are the errors shown by the compiler when you add the sprintf?
Did you include stdio.h at the begining of the C source file to get a proper prototype there?
CrasyCat