Abl-electronic PIC Microcontrollers PIC16 Manuel d'utilisateur Page 271

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 312
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 270
The example demonstrates simple data exchange via software UART. When PIC
MCU receives data, it immediately sends the same data back. If PIC is connected
to the PC (see the figure below), you can test the example from mikroC terminal
for RS232 communication, menu choice Tools > Terminal.
MikroElektronika:
Development
tools
-
Books
-
Compilers
263
page
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
Library Example
unsigned short data = 0, ro = 0;
unsigned short *er;
void main() {
er = &ro;
// Init (8 bit, 2400 baud rate, no parity bit, non-inverted logic)
Soft_Uart_Init(&PORTB, 1, 2, 2400, 0);
do {
do {
data = Soft_Uart_Read(er);
// Receive data
} while (*er);
Soft_Uart_Write(data);
// Send data via UART
} while (1);
}
//~!
Vue de la page 270
1 2 ... 266 267 268 269 270 271 272 273 274 275 276 ... 311 312

Commentaires sur ces manuels

Pas de commentaire