M
ma
- Jan 1, 1970
- 0
Hello,
I have build a PIC based on 18f2620 and write a very simple code
that would put 1 'a' to rs232 to test that the board working well.
I used PIC-C compiler from CCS and use the following line to setup rs232 in
C program:
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
and the source code is as follow:
void main()
{
int8 i;
setup_adc_ports(AN0_TO_AN1|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
// enable_interrupts(INT_RTCC);
// enable_interrupts(GLOBAL);
for(i=0;i<10;i++)
{
putc('a');
}
}
I used the build in "serial port monitor" in PIC-C to read the comport in
PC.
What I got in PC is 20 timnes of 00. exactly two times the number of chars
that I write to comport in PIC but the data is always zero.
The setup in PC is as follow:
Buad rate 9600
Parity=non
Data bit=8
Stopbit=1
Software flow control = non
Hardware flow control= use DTR, use RTS, Req DRS, Req CTS.
What is the problem?
One note: I used the maxim IC to transfer level from TTL to RS232 so I think
the level should be ok.
Is it a hardware problem or a software problem?
Did you every had such problem before? Any help appreciated
Best regards
I have build a PIC based on 18f2620 and write a very simple code
that would put 1 'a' to rs232 to test that the board working well.
I used PIC-C compiler from CCS and use the following line to setup rs232 in
C program:
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
and the source code is as follow:
void main()
{
int8 i;
setup_adc_ports(AN0_TO_AN1|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
// enable_interrupts(INT_RTCC);
// enable_interrupts(GLOBAL);
for(i=0;i<10;i++)
{
putc('a');
}
}
I used the build in "serial port monitor" in PIC-C to read the comport in
PC.
What I got in PC is 20 timnes of 00. exactly two times the number of chars
that I write to comport in PIC but the data is always zero.
The setup in PC is as follow:
Buad rate 9600
Parity=non
Data bit=8
Stopbit=1
Software flow control = non
Hardware flow control= use DTR, use RTS, Req DRS, Req CTS.
What is the problem?
One note: I used the maxim IC to transfer level from TTL to RS232 so I think
the level should be ok.
Is it a hardware problem or a software problem?
Did you every had such problem before? Any help appreciated
Best regards