We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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;; } } }
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
Thanks very much!!! That makes sense to me. I'll give it a try tomorrow and I'll post again if it worked.
Ok, tryed different address and nothing so I went back to zero and tryed one of the examples from Keil. The "Hello" program. I've followed step by step the instrucctions given by phytec. Compile the program and flash the hello.h68 using Flash Tool 16W. Until here everything right but when I open HT windows.... a lot of blank spaces start to appear or some lost character. I read that it may be possible because the frequency of the uC and the oscillator. So I tryed also at 25MHz but nothing. Any hint on this? I'm very lost now so any help would be very appreciated!! The unit is a phyCORE 167