Serial Problem 68HC08AP8

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

Serial Problem 68HC08AP8

1,401 Views
el_shaka
Contributor I
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.
Labels (1)
0 Kudos
3 Replies

396 Views
thisobj
Contributor III
Hello el_shaka,

In HyperTerminal, the Enter key sends only a carriage return ( 0x0d ) unless you configure it to also send the "newline" char ( 0x0A ).  You can do this by going into Properties | Settings | Ascii Setup and checking the box, "Send line ends with line feeds".  This will send the carriage return/linefeed combination and should get past the first while loop.

There are also settings in HyperTerminal in that same location to locally echo sent characters, as well as to change the default handling of received data.

Frank

(edit:  change "Hyperterm" to "HyperTerminal")


Message Edited by thisobj on 2007-08-09 08:03 PM
0 Kudos

396 Views
fredycolombia
Contributor I
hi el_shaka


I have worked with gp 32 and the module SCI is the same to the AP8, maybe it can help you.
here is my configuration that I used, and it have been very useful for me.


**configuration sci

void GPSCISET (void) {
    SCBR = 0x20;             //prescale baudios
    SCC1_M = 0;              // number of bits , for this 8.
    SCC1_ENSCI = 1;
    SCC2_TE = 1;             //enable tx
    SCC2_RE = 1;            // enable rx
    SCC2_SCRIE = 1;      // enable interrupt
    }



   interrupt 13 void GPSCIRX(void){
        asm lda SCS1;      ///acknowledge
///your code here

     }


regards,
fredy.





0 Kudos

396 Views
el_shaka
Contributor I
Thanks you guys,

thisobj, the problem was liked you said, 0x0d, never thouht of that.

fredycolombia, Amigo Colombiano jejej, I didint know how to program in assembly while using C, I used to make new  libraries with the funtion on them, Thanks for your asm lda SCS1;, it will sure save me a lot of work


Thanks...


0 Kudos