I am using EVM 8367 to learn how to program on freecale chip.
since I do not want to code with processor expert,I wrote code in C directly.
I set up a hyperterminal window on computer , bits rate 19200, 8 data bits, no parity , 1 stop bit. then I code as follows:
//***********************************************************************************************
#include <stdio.h>
#include <stdlib.h>
#define sci0br (volatile unsigned int *)0xf280
#define sci0ctr1 (vlatile unsigned int *)0xf281
#define sci0ctr2 (volatile unsigned int *)0xf282
#define sci0sr (volatile unsigned int *)0xf283
#define sci0dr (volatile unsigned int *)0xf284
#define tx 0x08
#define rx 0x04
/* prototype */
void init_sci();
void sci_outcstr(char *t);
void setsci0(char onoff);
#pragma interrupt saveall
void init_sci()
{
*sci0br=208;
*sci0ctr1=0x00;
*sci0ctr2=0x00;
}
void setsci0(char onoff)
{
*sci0ctr1=onoff;
}
void sci_outcstr( char *t)
{
unsigned short i;
while (*t!=0)
{
while (!(*sci0sr&0x8000)) { }
t++;
*sci0dr=*t;
for (i=0; i<30000; i++) { };
}
}
int main(void)
{
int i=0 ;
init_sci();
setsci0(tx|rx);
sci_outcstr("\nFreeScale\r");
for (i=0; i<30000; i++) {};
return(0);
}
//***********************************************************************
I always get some random characters in whole string like " F**rS*cal*".
Any idea? Thank you.