CrazyEngineers
  • 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);
     
     
     
    }
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Harshad Italiya

    MemberDec 11, 2011

    So basically you have problem while you sending some texts to pc right? Can you please let me know your SCI settings?
    Are you sure? This action cannot be undone.
    Cancel
  • Harshad Italiya

    MemberDec 14, 2011

    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 <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);
     
     
     
    }
    I think there may be problem with initialization remaining code looks OK.
    Are you sure? This action cannot be undone.
    Cancel
  • Harshad Italiya

    MemberDec 14, 2011

    Thread moved to Electrical and Electronics Section.
    Are you sure? This action cannot be undone.
    Cancel
  • suga_babe

    MemberDec 15, 2011

    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 sure? This action cannot be undone.
    Cancel
  • Harshad Italiya

    MemberDec 15, 2011

    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?
    Are you sure? This action cannot be undone.
    Cancel
  • suga_babe

    MemberDec 22, 2011

    i thought about using the switch statment for start.. to compare between two numbers and give the smallest or the largest
    Are you sure? This action cannot be undone.
    Cancel
  • Harshad Italiya

    MemberDec 22, 2011

    Still i'm not clear with your query. You're sending numbers from hyperterminal and processing it in microcontroller?
    Are you sure? This action cannot be undone.
    Cancel
  • suga_babe

    MemberDec 25, 2011

    no ..am writing a function in the C program, send it to the microcontroller and show the output in the hyperterminal
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register