Help for using MC9s08gt60

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Help for using MC9s08gt60

跳至解决方案
1,811 次查看
hyty
Contributor I
Hello

I have to use a MC9s08gt60 .

I would like to communicate with a computer with a zigbee connection.

I use a XBEE pro module.

For the moment I would like to send information to the computer by zigbee and I have some difficulties

Can you help me


/*********
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */


/****************************************************************
Function:smileyfrustrated:CI1INT
Input parameters: void
Output Parameters: Void
Description:This has the SCI 1  initializations
***************************************************************/
 
 void SCI1INT (void) {
  SCI1BDL=0x0D;
  SCI1C2=0x0C; 
  SCI1C1=0x00;
  SCI1BDH=0x00;
}


/***************************************************************
Function:smileysurprised:UT_ZIGBEE
Input parameters: char *a
Output Parameters: Void
Description:This functions sends data to Zigbee transciever through SCI1.
***************************************************************/


void OUT_ZIGBEE (char *a)
{
  while (*a != '\0')
  {
    while (!(SCI1S1 & 0x80));
    SCI1D = *a++;
  }
}


void main(void) {

char tab[1];
int i=0;

  for(;:smileywink: {
  tab[0]=i;
  OUT_ZIGBEE(tab);
  i++;
  if(i>9)
  i=0;

  } /* loop forever */
  /* please make sure that you never leave main */
}


标签 (1)
标记 (1)
0 项奖励
回复
1 解答
334 次查看
peg
Senior Contributor IV
Hello and welcome to the forums hyty,

After a quick look:
Your "array" that you send is only of size 1, where does the null go?
You also never attempt to terminate the string anywhere.
Also you are sending from 0 to 9 binary, did you want this or ASCII 0 to 9.
The first time through, the 0 you load looks like the terminator!

在原帖中查看解决方案

0 项奖励
回复
1 回复
335 次查看
peg
Senior Contributor IV
Hello and welcome to the forums hyty,

After a quick look:
Your "array" that you send is only of size 1, where does the null go?
You also never attempt to terminate the string anywhere.
Also you are sending from 0 to 9 binary, did you want this or ASCII 0 to 9.
The first time through, the 0 you load looks like the terminator!

0 项奖励
回复