pic24fprogrammer
Newbie level 3
Hi I am using PIC14FJ64Gb002 and i am trying to communicate with my PC using hyperterminal.
I send a character from PC to the receive Pin with 8 bit data no parity 1 stop bit but the problem is the microcontroller doesn't take all the 8 bits. sometimes 3 sometimes 2 sometimes 5bits and so on.
I have tried all the possible ways. I must be missing something simple to make it accept all 8 bits
Please can someone help me out.
The same thing happen when I transmit a character to PC as well. I send a character "a" and instead of 61 it shows E8. Can someone also explain why it doesn't transmit the exact ascii code?
COde:
#include <main.h>
#include <LCD1.C>
#include <KBD1.C>
#fuses HS, PR_PLL, NOWDT, NOPROTECT, NODEBUG, SOSC_IO,OSCIO ,PLL96MHZ, PLLDIV5,
#use fast_io(A)
#use fast_io(B)
#use rs232(UART1A, baud=4800,xmit =PIN_B13, rcv=PIN_B11,BITS=8,PARITY=N,STOP=1) //for serial communication
char k;
//Main function
void main()
{
printf(lcd_putc,"\fSerial");
delay_ms(2000);
printf(lcd_putc,"\f");
while(true)
{
if(kbhit())
{
k = getc();
putc('k');
}
else
printf(lcd_putc,"\f%c",k);
delay_ms(500);
}
}
I send a character from PC to the receive Pin with 8 bit data no parity 1 stop bit but the problem is the microcontroller doesn't take all the 8 bits. sometimes 3 sometimes 2 sometimes 5bits and so on.
I have tried all the possible ways. I must be missing something simple to make it accept all 8 bits
Please can someone help me out.
The same thing happen when I transmit a character to PC as well. I send a character "a" and instead of 61 it shows E8. Can someone also explain why it doesn't transmit the exact ascii code?
COde:
#include <main.h>
#include <LCD1.C>
#include <KBD1.C>
#fuses HS, PR_PLL, NOWDT, NOPROTECT, NODEBUG, SOSC_IO,OSCIO ,PLL96MHZ, PLLDIV5,
#use fast_io(A)
#use fast_io(B)
#use rs232(UART1A, baud=4800,xmit =PIN_B13, rcv=PIN_B11,BITS=8,PARITY=N,STOP=1) //for serial communication
char k;
//Main function
void main()
{
printf(lcd_putc,"\fSerial");
delay_ms(2000);
printf(lcd_putc,"\f");
while(true)
{
if(kbhit())
{
k = getc();
putc('k');
}
else
printf(lcd_putc,"\f%c",k);
delay_ms(500);
}
}