Sir, i have made the appropriate code for taking a ten bit number from the user and finding its hamming code(for the last 4 bits), the correct hamming code is even being displayed on the lcd.........but when i used USART to print the answer(hamming code)...it didn t work
can you tell me how to you use USART_Transmit.....do we use printf?
this is the code i used:
while(j>=0)
{
x=b[j];
USART_Transmit(x);
j--;
}
}
try this
If you are getting a wrong answer on terminal..i mean that your pc and uc are communicating but giving wrong results..then try dis out..
volatile unsigned char x=0;
while(j>=0)
{
x=b[j];
USART_Transmit(x+48);
j--;
}
no.....its actually not
no.....its actually not displaying anything on the pc only
first--load the following
first--load the following program in your uc and connect it with your computer
second--open terminal(i hope u know that)
third--settings stop bits-1
parity none
databits-8
fourth--press connect
if successful u did fine else try out changes in baud rate..it may help..else i need a deeper view of your problem..
//code
#include
#define F_CPU 8000000UL
#include
#include
#include"usart.h"
void USART_Transmit( unsigned char data );
void USART_Init( unsigned int baud );
unsigned char USART_Receive( void );
volatile unsigned char i=1;
int main(void)
{
USART_Init(51);
while(1)
{
USART_Transmit(i+48);
}
}
i tried your logic and it
i tried your logic and it worked.... :)
and then i tried another logic using if else it worked too...
I really don t know why my same logic wasn t displaying anything before(i was following the same procedure earlier too)......but now its working perfectly
Thanks a lot for all the help