Fraser Dickson

SCI port help - MC9S08QG8

Discussion created by Fraser Dickson on Jan 26, 2008
Latest reply on Feb 8, 2008 by erooll
Hi im new to microcontrollers and im trying to use the SCI port on a S08QG8 its just a simple program to make sure i am transmitting data, im using the output of the micro connected to a Maxim232 chip and using hyperterminal to view the results.  Athough i cannot get any data to transmit what am i doing wrong? i suspect its something to do with the baud rate which im trying to set to 9600.  The 232 and hyperterminal setup is working fine as i have tested this with another device
 
my program ;
 
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
#include "MC9S08QG8.h" /* include peripheral declarations */

void main(void){

          int i;
        PTBPE = 0x00;
        PTAPE = 0x00;     
        PTBDD = 0x00;
        PTADD = 0x00;
 
for(;; )
{
  __RESET_WATCHDOG(); /* feeds the dog */
 
  SCIBDH = 0;
  SCIBDL = 0x82;   /* 9600 baud */
  SCIC1 = 0x00; /* Normal mode, 8 bits,  no parity */
  SCIC2 = 0x0C; /* Enable transmitter and receiver, no interrupts */
/*********************************************************************/
/* send the character */
/*********************************************************************/
   
for (i=1; i<1000; i++) {       /* delay before/after sending each character */
    }
  
  SCID = 0x41;  /* Send the letter A */
  while ((SCIS1 & 0x80) == 0);   /* Wait for TDRE */
 
} /* loop forever */
}
 
 
 
cheers



Message Edited by Fraz on 2008-01-26 02:08 PM

 

Added part number to subject.



Message Edited by NLFSJ on 2008-01-27 10:27 AM

Outcomes