Compare commits
3 Commits
ecbae839d3
...
master
Author | SHA1 | Date | |
---|---|---|---|
55f04968df | |||
fdff359ec3 | |||
8308356257 |
2
Makefile
2
Makefile
@ -1,3 +1,5 @@
|
|||||||
|
-include defs.mak
|
||||||
|
|
||||||
SDCC ?= sdcc
|
SDCC ?= sdcc
|
||||||
SDAR ?= sdar
|
SDAR ?= sdar
|
||||||
STCCODESIZE ?= 8192
|
STCCODESIZE ?= 8192
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
# pinsh8051
|
# pinsh8051
|
||||||
|
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
Submodule mc8051fun updated: 30f410891c...e7b50704d0
8
pinsh.c
8
pinsh.c
@ -6,7 +6,7 @@ uint8_t pinsh_buf[PINSH_BUF_SIZE];
|
|||||||
volatile int pinsh_buf_pos=0;
|
volatile int pinsh_buf_pos=0;
|
||||||
|
|
||||||
|
|
||||||
void pinsh_irq_handler()
|
void pinsh_uart_irq_handler()
|
||||||
{
|
{
|
||||||
if (RI) {
|
if (RI) {
|
||||||
unsigned char b = SBUF;
|
unsigned char b = SBUF;
|
||||||
@ -134,7 +134,6 @@ static void assign_port(int n, const char*cmd)
|
|||||||
|
|
||||||
static void pinsh_exec_p(const char *cmd)
|
static void pinsh_exec_p(const char *cmd)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!cmd[0]){
|
if (!cmd[0]){
|
||||||
show_stat();
|
show_stat();
|
||||||
return;
|
return;
|
||||||
@ -161,6 +160,11 @@ static void pinsh_exec_p(const char *cmd)
|
|||||||
|
|
||||||
void pinsh_exec(const char *cmd)
|
void pinsh_exec(const char *cmd)
|
||||||
{
|
{
|
||||||
|
pinsh_output("\r\n");
|
||||||
|
|
||||||
if(cmd[0]=='p')
|
if(cmd[0]=='p')
|
||||||
pinsh_exec_p(cmd+1);
|
pinsh_exec_p(cmd+1);
|
||||||
|
|
||||||
|
|
||||||
|
pinsh_buf_pos=0;
|
||||||
}
|
}
|
||||||
|
72
term.c
Normal file
72
term.c
Normal file
@ -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<pinsh_buf_pos; i++){
|
||||||
|
uart_send_str("*");
|
||||||
|
}
|
||||||
|
uart_send_str("\r\n");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user