Код: #include <18F452.h> #fuses XT,NOWDT,PUT,BROWNOUT,NOLVP #use delay(clock=4000000)
#define BAUDRATE 9600 #define TX_PIN PIN_C6 #define RX_PIN PIN_C7
#use rs232(baud=BAUDRATE, xmit=TX_PIN, rcv=RX_PIN, ERRORS)
void send_break(int8 time_ms) { // Disable the UART and send a Break // for the specified time. setup_uart(FALSE); output_low(TX_PIN); delay_ms(time_ms);
// Re-enable the UART. setup_uart(TRUE); set_uart_speed(BAUDRATE); }
//====================================== void main(void) { int8 i;
while(1) { // Send 10 bytes of 0x55 to show UART activity for(i=0; i<10; i++) putc(0x55); send_break(20); }
} |