Alejandro Murrieta

Serial Problem 68HC08AP8

Discussion created by Alejandro Murrieta on Aug 10, 2007
Latest reply on Aug 10, 2007 by Alejandro Murrieta
well Ive been trying many things and i cant recieve anything from my serial port.
When I send the data over the Hyperterminal or over Realterm, when I press Enter (0x0A in my code) it just stops and i dont know why..

here goes the code...

unsigned int Recive (void)
{
  unsigned char unidades=0;
  unsigned char decenas=0;

  while (dato[z-1] != 0x0A );    // Waiting for an Enter.
  if (z==4) {
    decenas = 10*(dato[0]-0x30); // First Digit
  }
    unidades =  dato[z-1]-0x30;    // Last Digit
 
  return(unidades + decenas);    // Unity + Decens.
}


void main (void)
unsigned int pos;
.....
.....
.....
  SCC1 = 0x53;
  SCC2 = 0x2C;
  SCBR = 0x03;
    Transmit (" Type Position\n\r");
  pos = Recive();                // Waits for the answer
  if (pos == 15) {
    Transmit ("\r You Typed 15\n\r");
  PTA_PTA4 = 1;                  // External Breakpoint
  }
  else
  {
    Transmit ("\r Try Again");
  PTA_PTA5 = 1;                 // External Breakpoint
  }


interrupt 13 void SCI_Rx_ISR (void) /* SCI Receive vector (UART RX) */
{
   PTA_PTA7 = 1;                // External Breakpoint
   SCS1_SCRF;
   SCS1;
   SCS1_SCTE;
   dato[z++] = SCDR;  /* Store the Received Data */
   
}/* END SCI_Rx_ISR() */

Any Help, Thanks.

Outcomes