CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

rs232 communication from 16f84a [SOLVED]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
vladtess



Joined: 14 May 2011
Posts: 26

View user's profile Send private message

rs232 communication from 16f84a [SOLVED]
PostPosted: Sat May 14, 2011 11:22 am     Reply with quote

Hi fellas!

I have this simple code: I want to transmit letter 'A' via software UART.

Code:
#include <16F84A.h>
#FUSES hs,nowdt,noprotect
#use delay (clock = 4000000)
#use rs232(baud=300,xmit=PIN_B0, rcv=PIN_B1,invert, parity=n, bits = 8, force_sw)


void main() {
   set_tris_b(0x0);
   while(1){
    delay_ms(1000);
    putc('A');
   }
   
}


I delay a second to not get confused about when data is sent. I use invert because max232 needs too many caps and gets too messy on my breadboard. pic and PC (rs232 pin 5) grounds are connected. the receive pin is connected to pin 2 of the rs232 connector to PC and PortB pin 0 on PIC.

I use RS-232 Monitor version 1.2 to monitor incoming. On this software I set baud to be 600, with no parity, 8 bit reception, 1 stop bit, and no other feature turned on.

I get signal, with intervals of close to 1 secs as expected. However I get trash: a black box with a p.

Pleas help!! Screenshot is attached.

Maybe I should use some other software to monitor incoming signals?

Thanks much you all!!!


Last edited by vladtess on Sat May 14, 2011 11:44 am; edited 1 time in total
vladtess



Joined: 14 May 2011
Posts: 26

View user's profile Send private message

PostPosted: Sat May 14, 2011 11:26 am     Reply with quote

Oh my, I got it, baud on monitor was 600 while pic was set to operate at 300. My mistake. Lesson to all including me: check baud rate!!

Sorry to take up space on forum.
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sat May 14, 2011 11:29 am     Reply with quote

vladtess wrote:
Oh my, I got it, baud on monitor was 600 while pic was set to operate at 300. My mistake. Lesson to all including me: check baud rate!!

Sorry to take up space on forum.


No worries... Change the original Subject line to include "SOLVED" so others may learn from what you did.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group