Help for using MC9s08gt60

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help for using MC9s08gt60

Jump to solution
1,926 Views
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 */
}


Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
449 Views
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!

View solution in original post

0 Kudos
Reply
1 Reply
450 Views
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 Kudos
Reply