Olá pessoal, bom dia.
Gostaria de uma ajuda. Estou precisando implementar uma comunicação serial num PIC16F877A, sendo que esta deverá ser via Software, uma vez que já está sendo utilizada a serial normal dela para comunicação com outro dispositivo.
O PIC não irá enviar nada, somente irá receber Um número de 4 dígitos correspondente a minutos e segundos (mm,ss), vindo de um teclado que transmite a 1200. Preciso utilizar o pino 18 para isso.
Se alguém puder me ajudar, agradeço.
meu E-mail: cgjunior2000@yahoo.com.br
Abraços a todos.
Comunicação Serial por Software
- tihomir.losic
- mikroElektronika team
- Posts: 2138
- Joined: 02 Dec 2009 14:16
- Location: Serbia
- Contact:
Re: Comunicação Serial por Software
Hello Carlos,
please, follow these instructions:
- download our mikroC PRO for PIC
- open our example for UART
- change code, and try this:
- Turn on switches RC6 and RC7 (USART pins)
- Build and Program this project (Ctrl + F11)
- Run USART terminal (Ctrl + T)
- Set baudrate to 1200
- Click on connect, and type any text in order to send it to PC.
Best regards,
Losic Tihomir
p.s. Please continue to write their interaction in English.
please, follow these instructions:
- download our mikroC PRO for PIC
- open our example for UART
- change code, and try this:
Code: Select all
char uart_rd;
void main() {
UART1_Init(1200); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
UART1_Write_Text("Start");
while (1) { // Endless loop
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read(); // read the received data,
UART1_Write(uart_rd); // and send data via UART
}
}
}
- Build and Program this project (Ctrl + F11)
- Run USART terminal (Ctrl + T)
- Set baudrate to 1200
- Click on connect, and type any text in order to send it to PC.
Best regards,
Losic Tihomir
p.s. Please continue to write their interaction in English.
mikroElektronika [Support team]