Help: Using hyper terminal to communicate with MC68HC908...

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

Help: Using hyper terminal to communicate with MC68HC908...

2,727 Views
vero
Contributor I
Hello,
I'm new here in this forum. I'm writing some C codes using SCI to communicate with the computer. Here using MAX232 between the two parties. I probed the pin TxD, and there's some signals sending out from MCU. But in the hyper terminal, there's nothing displayed on the window. Could some one help me? hyper terminal is also new for me. I dun know whether I set the configuration correctly or not. What do I need to pay more attention when doing this, also in the C codes. Thanks a lot!:smileywink:
 
Vero
Labels (1)
0 Kudos
6 Replies

489 Views
peg
Senior Contributor IV
Hello and welcome Vero,
 
Your problem could be in so many places!!! So lots of questions.
 
1. What HC08 are you using?
2. What baudrate, stop bits, parity etc are you trying to achieve?
3. What is your buss clock?
4. Send us your clock details
5. Send us your SCI configuration
6. When you type on the PC do the characters show in the window?
7. Can you remove the micro and short the transmit to recieve at the micro socket?
8. What do you get on the screen if you type now?
 
That will do for a start!
 
 
 
0 Kudos

489 Views
vero
Contributor I
Hello Peg,
 
There are so many questions here a~ I'm new to program like this...
1. I'm using HC908JL8, it's a 32 pin MCU
2. baudrate is 9600, 8bits, no parity, 1 stop bit.
3.I dunno how to find out e bus clock...
I'm not in the office already. so just can remember part of my codes.
 
void init_SCI(void){
SCBR=0x03; //baudrate 9600,8bit,1stop bit
SCC1=0x40; //enable SCI
SCC2=0xC0;//enable transmitter and reciever
SCC3=0x00;
 
}
void Outchar(unsigned char letter){
while((CSC1&SCTE)=1){
read_csc1=CSC1;//read_csc1 is a rubish unsigned char, clear SCI transmitter empty bit by reading SCI status register1
SCDR=letter;
}
}
 
I communicate with the computer using my MCU. It should display a "4" on the window. It's not like i type on another computer here. to test my codes and connection, i just assigned letter=54 here, should be "4" after convert. so i transmit letter directly to SCDR. and in the hyper terminal should be a number"4" displayed there. in one word, i get nothing on my screen...
 
i dunno whether i ans your question or not. but these are all that i know.. Thanks a lot!
 
Vero


Message Edited by vero on 2007-06-22 04:49 PM
0 Kudos

489 Views
bigmac
Specialist III
Hello Vero,
 
I can see some problems with your code, assuming you do not have typographical errors in your post.
 
Firstly, with the SCBR value that you use, to achieve 9600 baud the OSCOUT frequency needs to be 4.9152 MHz.  This is not the same as the bus frequency.  To achieve this OSCOUT frequency, you will need a crystal frequency of 9.8304 MHz.  Is this your situation?
 
To set TE and RE bits, the SCC2 value should be -
SCC2 = 0x0C;
 
Within your Outchar() function, the CSC1 register name seems to be non-standard for the MCU.  I suspect you mean the SCS1 status register.  Did the code compile using CW?
 
I am also not sure whether you have defined SCTE as a mask value.  There also seems to be problems with your understanding of the operation of the SCTE flag, and the exit from the while loop.
 
Using standard CW register definitions, I would probably use the following code to send a single character from the SCI module -
 
void Outchar(unsigned char letter)
{
  while(SCS1_SCTE == 0);  // Wait for flag to become set
  SCDR = letter;
}
 
Regards,
Mac
 
0 Kudos

489 Views
vero
Contributor I
Hi, peg n bigmac,
 
I can not use the hardware for the weekend, so i just can test and have a look at my codes on monday.
 
The SCS1 and the SCC2 setting problems are my typing errors, sorry for this... and also for the while((CSC1&SCTE)==0)... I am using CW to compile my code, and there is no compile error already.
 
About the testing...I really don't have the hardware like that. Now is asking for my supervisor's help.  Hope my supervisor can find out the hardware like that. Thanks a lot!
 
Vero
0 Kudos

489 Views
peg
Senior Contributor IV
Hi,
 
What bigmac said plus.......
 
In you code you do an explicit read of CSC1 (see Mac's comment on this name), this is not required as the test above it does the read.
 
The reason I was asking you to type on the terminal was to test the Hyperterminal setting, your cable and your level shifter hardware. I was assuming you have implemented hardware for two directional comms. Do you have this?
 
If so my instructions where doing a loopback test right at the TTL level which would test a lot of things in one go.
 
If you see characters on the screen before you install the link you should see double characters after linking. If you get nothing before link, you should get single chars after linking.
 
If you don't already have the hardware like this (bi-directional), I would suggest you modify it so you do.
 
0 Kudos

489 Views
vero
Contributor I
Hi....
 
found out the bus clock just now. it is 4.9152MHz....
Thanks!
 
Vero
0 Kudos