dl7vfx
Joined: 20 May 2011 Posts: 3 Location: Berlin / Germany
|
PIC24F16K101 UART Problem |
Posted: Fri May 20, 2011 3:52 am |
|
|
Hello ...
I have a problem with the PIC24F16K101.
UART1 Pin11 and PIN6 is connected to a MAX232, the electronic functions are perfect, at pin 6 of the pic comes to the character from the terminal.
But the pic does not respond with the following code.
He run up to getc and stays there.
In the other direction, that's very good,
characters sent by the controller com on in the terminal program.
Code: |
#include <main.h>
#include <stdlib.h>
#include "stdio.h"
char c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, d0;
#INT_RDA
void main()
{
setup_adc_ports(ALL_ANALOG,VSS_VDD );
setup_adc(ADC_CLOCK_DIV_4|ADC_TAD_MUL_8);
enable_interrupts(intr_global);
output_bit(pin_b13,1);
output_bit(pin_b15,1);
while(1)
{
#use rs232(uart1,baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B2,bits=8)
c1 = getc();
printf("%c",c1);
output_bit(pin_b13,0);delay_ms(250);output_bit(pin_b13,1);delay_ms(250);
}
}
|
|
|