working with Hyper terminal

Hi

I have been trying this code using uVision emulator and it works fine, then I download it to the Infineon C167CR-L and again works fine using Monitor. I stop debugging and connect the serial port to my PC using Hyper Terminal and works fine also but when I reset the unit or I just switch off the power supply, it doesn't work right anymore. The screen on HT (Hyper Terminal) starts to display a lot of spaces, ooooos or smiles but the program doesn't work as it did using Monitor. Any advice on this?


/*-----------------------------------------------------
Define Port 7, Direction Register, and Open Drain Register.
------------------------------------------------------*/
#include <stdio.h>                /* standard I/O .h-file              */
#include <reg167.h>               /* special function register 80C167  */

char cmd;		       /* Store value received from port 3 here */

/*------------------------------------------------------------
MAIN C Function
--------------------------------------------------------*/
void main (void)
{
/*----------------------
Configure P2.15-P2.12 as Outputs.
---------------------------*/
DP2  = 0xF000;    /* Configure P2.15-P7.12 for output, */
ODP2 = 0xF000;    /* Setup P2.15-P2.12 for open-drain */

 						/* initialize the serial interface     */
#ifndef MCB167          /* do not initialize if you use Monitor-166      */
  P3  |= 0x0400;        /* SET PORT 3.10 OUTPUT LATCH (TXD)              */
  DP3 |= 0x0400;        /* SET PORT 3.10 DIRECTION CONTROL (TXD OUTPUT)  */
  DP3 &= 0xF7FF;        /* RESET PORT 3.11 DIRECTION CONTROL (RXD INPUT) */
  S0TIC = 0x80;         /* SET TRANSMIT INTERRUPT FLAG                   */
  S0RIC = 0x00;         /* DELETE RECEIVE INTERRUPT FLAG                 */
  S0BG  = 0x40;         /* SET BAUDRATE TO 9600 BAUD                     */
  S0CON = 0x8011;       /* SET SERIAL MODE                               */
#endif
/*--------------------------------------

-------------------------*/

printf ("Robot ready to receive commands ");

while (1)					/* An embedded program never stops and returns */
  {						/* Here is an endless loop to solve this and   */
  						/* monitor serial port                         */
     scanf ("%c", &cmd);
	 printf ("%c\n", cmd);

/* Check for direction robot */

	switch(cmd)
	{
		case '8' : P2 = 0x0000; break;
		case '2' : P2 = 0x5000; break;
		case '4' : P2 = 0x4000; break;
		case '6' : P2 = 0x1000; break;
		default  : P2 = 0xA000;;
	 }


	}

}


Thanks

Ed

(I hope I have explained myself ok, my english is a little bit rusty)
Ah! I'm using a phytec development board

Parents
  • I have been trying this code using uVision emulator and it works fine, then I download it to the Infineon C167CR-L and again works fine using Monitor. I stop debugging and connect the serial port to my PC using Hyper Terminal and works fine also but when I reset the unit or I just switch off the power supply, it doesn't work right anymore. The screen on HT (Hyper Terminal) starts to display a lot of spaces, ooooos or smiles but the program doesn't work as it did using Monitor. Any advice on this?

    Ahhhhh. When you download the program to the C167CR-L, where exactly is the program stored? It is stored in RAM.

    When you reset the unit, the monitor is what starts running -- not your program.

    When you power the unit down, assuming the monitor is also stored in RAM, there is nothing in memory to run. And, the BootStrapLoader starts running.

    If you want your program to run, you'll need to program it into ROM or FLASH memory.

    Jon

Reply
  • I have been trying this code using uVision emulator and it works fine, then I download it to the Infineon C167CR-L and again works fine using Monitor. I stop debugging and connect the serial port to my PC using Hyper Terminal and works fine also but when I reset the unit or I just switch off the power supply, it doesn't work right anymore. The screen on HT (Hyper Terminal) starts to display a lot of spaces, ooooos or smiles but the program doesn't work as it did using Monitor. Any advice on this?

    Ahhhhh. When you download the program to the C167CR-L, where exactly is the program stored? It is stored in RAM.

    When you reset the unit, the monitor is what starts running -- not your program.

    When you power the unit down, assuming the monitor is also stored in RAM, there is nothing in memory to run. And, the BootStrapLoader starts running.

    If you want your program to run, you'll need to program it into ROM or FLASH memory.

    Jon

Children
More questions in this forum