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.

problem with sending data to PIC18F2550 through RS232

Status
Not open for further replies.

stoyanoff

Full Member level 4
Joined
Aug 10, 2011
Messages
195
Helped
8
Reputation
16
Reaction score
8
Trophy points
1,298
Activity points
2,725
Hi, everyone! I made a simple pcb with PIC18F2550 and MAX232. Here is the hardware: https://dox.bg/files/dw?a=3b528d5ba9
So the controller works fine. It recieves data from the line(I`m using PC for transmitter). But when I tried to send data from the microcontroller it doesn`t send anything. Here is my code:
Code:
#include <18F2550.h> 
#fuses HS, CPUDIV1, NOVREGEN, NOPBADEN, NOWDT 
#use delay(clock=20M) 
#USE RS232 (baud=9600, xmit=PIN_C6,rcv=PIN_C7,BITS=8,PARITY=N,ERRORS) 

void main() 
{  
   while(1) 
   { 
      putc(5); 
   } 
}
It just blocks any the debugger can`t pass the #use RS232 line... I remove the MAX232 but again even without anything connected to it`s pins the microcontroller blocks there and it doesn`t transmit anything.
Do you have any idea what`s going on here??
Thanks!
 

Instead of linr putc(5)

Try this

putc('5')


And give some delay after that.

And i think with that

#use rs232 line you are usibg software uart try to use internal uart

i am not sure about syntax but ut is likr this

#use rs232(uart1,9600 like that
see ccs manual

- - - Updated - - -

Use this
//RS232 Configuration
#use rs232(baud=9600, UART1, errors)

and dont forget single quotes and delay

- - - Updated - - -

//RS232 Configuration
#use rs232(baud=9600, UART1, errors)

ise this and dont foget quotationd and delay
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top