hyperterminal error

Discussion in 'Embedded Systems and Microcontrollers' started by thorwendel, Oct 5, 2012.

  1. thorwendel

    Thread Starter New Member

    Oct 5, 2012
    2
    0
    i have my interfacing for PIC16F877a, i'm using C programming, when i view my output on hyperterminal it shows some special characters, what's wrong with this?? please help..
     
  2. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,814
    834
    Probably because the output from the PIC is sending binary or control characters to hyperterminal. If a non-ASCII or non-printable character is sent to hyperterminal, special characters will be displayed that will look "junky". For example, a byte with a decimal value of 175 (or hex AF or binary 1010 1111) is sent - hyperterminal will display a » on the screen.

    By binary or control character, I mean somethng outside the ASCI printable characater set. Those in the ASCI printable character set are codes/bytes of value within 20hex to 7Ehex. (decimal 32 to 126) They represent letters, digits, punctuation marks, and a few miscellaneous symbols. There are 95 printable characters in total.

    You may have to format all of your output to a string value before sending it to hyperterminal.
     
    thorwendel likes this.
  3. thorwendel

    Thread Starter New Member

    Oct 5, 2012
    2
    0
    thanks! can you check my codes??

    Code ( (Unknown Language)):
    1.  
    2. int adc_rd;
    3. char txt1[10], txt2[10], txt3[10], txt4[10];
    4.  
    5.  void main() {
    6.  
    7. ADCON1 = 0;
    8. TRISA =0xFF;
    9.  
    10. UART1_Init(9600);
    11. Delay_ms(100);
    12.  
    13. while(1){
    14. adc_rd=ADC_Read(0);
    15. IntToStr(adc_rd, txt1);
    16. Delay_ms(2);
    17. adc_rd=ADC_Read(1);
    18. IntToStr(adc_rd, txt2);
    19. Delay_ms(2);
    20. adc_rd=ADC_Read(2);
    21. IntToStr(adc_rd, txt3);
    22. Delay_ms(2);
    23. adc_rd=ADC_Read(3);
    24. IntToStr(adc_rd, txt4);
    25. UART1_Write('A');
    26. UART1_Write(',');
    27. UART1_Write_Text(txt1);
    28. UART1_Write(',');
    29. UART1_Write_Text(txt2);
    30. UART1_Write(',');
    31. UART1_Write_Text(txt3);
    32. UART1_Write(',');
    33. UART1_Write_Text(txt4);
    34. UART1_Write(',');
    35.  
    36. Delay_ms(1000);
    37. }
    38.  
    }
     
    Last edited by a moderator: Oct 9, 2012
Loading...