From fdff359ec34f9307ff079da5d808e2d4cc46d057 Mon Sep 17 00:00:00 2001 From: 7u83 <7u83@mail.ru> Date: Sun, 26 May 2024 15:48:55 +0200 Subject: [PATCH] Initial commit --- term.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 term.c diff --git a/term.c b/term.c new file mode 100644 index 0000000..f070337 --- /dev/null +++ b/term.c @@ -0,0 +1,72 @@ + +#include "mc8051fun/mc8051fun.h" +#include "pinsh.h" + + + +#define IMP1 P0_6 +#define IMP2 P0_7 + + +int pinsh_go=0; + +void uart_handler() __interrupt 4 +{ + pinsh_uart_irq_handler(); + + /* + if (RI) { + unsigned char b = SBUF; + if (b=='\r'){ + pinsh_go=1; + } else { + SBUF=b; + if (pinsh_buf_pos < PINSH_BUF_SIZE-1){ + pinsh_buf[pinsh_buf_pos++]=b; + pinsh_buf[pinsh_buf_pos]=0; + } + + } + RI=0; + } + */ +} + +#define BAUD 9600L +#define TBBAUD 256L-FOSC/12L/(BAUD*16L) + + +void main() +{ + + uart_init(9600,0); + ES=1; + EA=1; + uart_send_str("Hello!\r\n"); + + pinsh_buf_pos=0; + int pb=0; + pinsh_output_chr = uart_send_chr; + + while(1){ +// while(1); + + while(!pinsh_go); + pinsh_exec(pinsh_buf); + pinsh_go=0; + pinsh_buf_pos=0; + + + +/* + if (pb!=pinsh_buf_pos){ + pb=pinsh_buf_pos; + uart_send_str("\r\n"); + for(int i=0; i