|
|
View previous topic :: View next topic |
Author |
Message |
souravkumarkar
Joined: 31 Dec 2011 Posts: 5 Location: Baripada
|
16F676 rs232 not working |
Posted: Wed Jun 13, 2012 12:42 am |
|
|
I am using internal oscillator. I already try it on many more projects. When I am trying to communicate with pc no data show. What I doing wrong ?
Code: |
#include <16F676.h>
#fuses INTRC_IO,NOWDT,NOPROTECT,NOMCLR
#use delay (clock=4000000) // 4MHz clock
#use rs232(baud=9600, xmit=PIN_C2, rcv=PIN_C1)
void main()
{
while(1)
{
printf("working"); // for show on pc
delay_ms(1000);
}
}
|
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19515
|
|
Posted: Wed Jun 13, 2012 1:15 am |
|
|
What hardware are you using to connect to the PC?. You do realise you need an RS232 transceiver between the PIC and the PC?.
Have you verified the chip is actually running (add 'output_toggle', some unused pin, after the delay), and verify that the pin does toggle just over every second. On these chips, the internal oscillator will not work, if you have done a full erase, without saving the factory clock calibration (most programmers have an option to do this).
The clock accuracy of the internal RC, can be 'borderline' for RS232, which can give character corruption, but 99% of the time it'll work, and even if the clock is too far out, you will see something.
Best Wishes |
|
|
souravkumarkar
Joined: 31 Dec 2011 Posts: 5 Location: Baripada
|
|
Posted: Mon Jun 18, 2012 2:16 am |
|
|
Tnxs sir.
After you reply I'm trying crystal oscillation. I use fuse HS for 20MHz. Also same problem as internal oscillation. No response from pc. I try same code in 16f877a and its work. Have any recommended pin in 16f676 is used as rs232 protocols. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19515
|
|
Posted: Mon Jun 18, 2012 3:24 am |
|
|
The hardware UART, is always 'better', since it allows you to do other jobs while characters are sending/receiving. However your chip doesn't have one, so it makes no difference what pins are used (excluding hardware restrictions, such as A3, only supporting input).
Have you actually tested you can toggle a pin. _Forget_ RS232, until you have proved the chip is running, and running at the right speed. It is like trying to test the towball on a car, without having first made sure the engine works....
You say you have tried the same code on an 877a, but this is a 40pin device, with a UART, while the 676, is only a 14pin device, so your hardware is different. +5v on pin1?. 0v on pin14?. etc. etc...
Best Wishes |
|
|
souravkumarkar
Joined: 31 Dec 2011 Posts: 5 Location: Baripada
|
|
Posted: Sun Jun 24, 2012 8:12 am |
|
|
Thanks you very much sir. |
|
|
|
|
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
|