Help for using MC9s08gt60

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Help for using MC9s08gt60

ソリューションへジャンプ
1,835件の閲覧回数
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 解決策
358件の閲覧回数
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 返信
359件の閲覧回数
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 件の賞賛
返信