1. Home >
  2. Apps >
  3. Groups >

Making A Hyperterminal Calculator By Interfacing With Hcs12e128

Question asked by suga_babe in #Coffee Room on Dec 11, 2011
suga_babe
suga_babe · Dec 11, 2011
Rank E1 - BEGINNER
i have a project to design a calculator with the hyperterminal by writing a source code and compile it with the CodeWarrior. i am using the motorolla S12E128.
i have wrote a code for the interfacing between the two, but i am stuck when coming to the calculator's part. here is the code i wrote so far - which was tested-
i need help in writing the rest... thanks



#include <hidef.h> /* common defines and macros */
 
#include <mc9s12e128.h> /* derivative information */
 
#pragma LINK_INFO DERIVATIVE "SampleS12"
 
void periphlnit(void){
 
SCI1BDH=0x00;
 
SCI1BDL=0x34; //sets SCI baud rate to 9600,N,8,1
 
SCI1CR2=0x08;
 
}
 
void Write(const char*text){
 
while(*text !='\0'){
 
while(!(SCI1SR1 & 0x80))
 
;
 
SCI1DRL=*text++;
 
}
 
}
 
void delay(int);
 
void delay(int n){
 
while(n>0)n--;
 
}
 
void main(void){
 
periphlnit();
 
EnableInterrupts;
 
for(;{
 
Write ("Tested on Micro lab\n\r");
 
delay(32000);
 
 
 
}
Posted in: #Coffee Room
Harshad Italiya
Harshad Italiya · Dec 12, 2011
Rank A1 - PRO
So basically you have problem while you sending some texts to pc right? Can you please let me know your SCI settings?
Harshad Italiya
Harshad Italiya · Dec 15, 2011
Rank A1 - PRO
suga_babe
i have a project to design a calculator with the hyperterminal by writing a source code and compile it with the CodeWarrior. i am using the motorolla S12E128.
i have wrote a code for the interfacing between the two, but i am stuck when coming to the calculator's part. here is the code i wrote so far - which was tested-
i need help in writing the rest... thanks



#include  /* common defines and macros */
 
#include  /* derivative information */
 
#pragma LINK_INFO DERIVATIVE "SampleS12"
 
void periphlnit(void){
 
SCI1BDH=0x00;
 
SCI1BDL=0x34; //sets SCI baud rate to 9600,N,8,1
 
SCI1CR2=0x08;
 
}
 
void Write(const char*text){
 
while(*text !='\0'){
 
while(!(SCI1SR1 & 0x80))
 
;
 
SCI1DRL=*text++;
 
}
 
}
 
void delay(int);
 
void delay(int n){
 
while(n>0)n--;
 
}
 
void main(void){
 
periphlnit();
 
EnableInterrupts;
 
for(;{
 
Write ("Tested on Micro lab\n\r");
 
delay(32000);
 
 
 
}
I think there may be problem with initialization remaining code looks OK.
Harshad Italiya
Harshad Italiya · Dec 15, 2011
Rank A1 - PRO
Thread moved to Electrical and Electronics Section.
suga_babe
suga_babe · Dec 16, 2011
Rank E1 - BEGINNER
my main issue is how to desogn the calculator itself.. how to assign the values and commands in the source code so the calculations can be performed.. got me ? :/
Harshad Italiya
Harshad Italiya · Dec 16, 2011
Rank A1 - PRO
suga_babe
my main issue is how to desogn the calculator itself.. how to assign the values and commands in the source code so the calculations can be performed.. got me ? :/
Are you going to design GUI at PC side? microcontroller or PC who performs the calculation?
suga_babe
suga_babe · Dec 23, 2011
Rank E1 - BEGINNER
i thought about using the switch statment for start.. to compare between two numbers and give the smallest or the largest
Harshad Italiya
Harshad Italiya · Dec 23, 2011
Rank A1 - PRO
Still i'm not clear with your query. You're sending numbers from hyperterminal and processing it in microcontroller?
suga_babe
suga_babe · Dec 25, 2011
Rank E1 - BEGINNER
no ..am writing a function in the C program, send it to the microcontroller and show the output in the hyperterminal

You must log-in or sign-up to reply to this post.

Click to Log-In or Sign-Up