Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Using ccsc rs232 to PC communication -- ON PIC18

Status
Not open for further replies.

mohit

Newbie level 6
Joined
Jan 9, 2006
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,373
Hi all
I am using Pic18f4550 using ccsc MPLAb and i am a newbie and writing a program to communicate to PC through RS232 port .
I have used simply users232 directive
and simply did putc('S'); in main program.

But on Hyperterm i see many junk random characters ...

I have done lot of efforts on my own like
1)enabled interrupts both Global and INT_RDA
2)Disassembled program and matched it with a working version of assembly program i got with my kit
3)Only thing which was missing in my disassembled listing was ... that its not checking for TMRT bit in TXSTA anywhere ..i wrote assembly code for that ...still its not working ..


Please help
 

#include <18F4550.h>
#fuses HS,NOWDT
#use delay(clock=20MHz)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,BRGH1OK,STOP=1)



void main()
{
char c;
set_tris_c(0xBF);
clear_interrupt(INT_RDA);
enable_interrupts(GLOBAL);

enable_interrupts(INT_RDA);

while(TRUE)
{
c=getc(); //if getc() timeouts 0 is returned to c

putc(c);

}
}

This is my program which gives..
this following o/p on hyper terminal.in echo mode in hyperterminal ..

dD ddddddffffffaybzaybzddeettyyzzayayaybzbzbzc{
where in
most characters are correctly transmitted and rceived like d e f etc but definite charates like a , b ,c which are converted to definite wrong characters like

a is transmitted but receeived is y similarly b----> z c----> { everytime

point to be noted is
a=97 0110 0001 in ascii
y=121 0111 1001

b = 98 0110 0010
z=122 0111 1010

similar for c------>{


Please reply , I have tried for hours but not able to come out why there is problem with definite few characters ...
they only come wrong everytime....It doesnt seem to be a framing error as a,b,c might be transmitted at any time they have to come out wrong only that too definite wrong output ......pl help
 


Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top