karthickiw
Joined: 09 Aug 2007 Posts: 82 Location: TN, India
|
problem with RS232 in 12F675 |
Posted: Thu Mar 06, 2008 8:32 am |
|
|
hello,
i try to write the program to set the set of hex command to PC. but i can't got any data from PIC IC...
my complier version is IDE - 3.41
PCB - 3.185
PCM -3.185
PCH - 3.185
Code: | #include <12F675.h>
#device adc=8
#use delay(clock=4000000)
#fuses NOWDT,INTRC_IO, CPD, PROTECT, NOMCLR, PUT, BROWNOUT
#byte OSCCAL=0x90
#define GP0 PIN_A0
#define GP1 PIN_A1
#define GP2 PIN_A2
#define GP3 PIN_A3
#define GP4 PIN_A4
#define GP5 PIN_A5
//========================
#byte ADCON0 = 0x1F
#byte ANSEL = 0x9F
#byte CMCON = 0x19
#rom 0x3ff = {0x3470} // input the calibration code
#use rs232(baud=9600,xmit=PIN_A4,rcv=PIN_A5,bits=8)
void main()
{
set_tris_a(0b101111);
delay_ms(500);
putc(0X7E);
putc(0X07);
putc(0XA0);
putc(0X30);
putc(0X31);
putc(0X30);
putc(0X30);
putc(0X30);
putc(0X7E);
while(1) {
}
}
}
|
please give the solution for problem... |
|
kolio
Joined: 06 Feb 2008 Posts: 26
|
|
Posted: Thu Mar 06, 2008 8:45 am |
|
|
Two hints:
1. Although calibrated, the internal oscillator is not reliable enough for UART communication.
2. Try: while(1){ putc(0x55); delay_ms(10);} . You terminal screen should be filled with 'UUUUUU'.
3. I'm not quite sure whether such an old compiler version properly sets A/D channels (specially A4, which is the transmitter) to disabled. Try setup_adc_ports(NO_ANALOGS);
wish you luck |
|