diff options
-rw-r--r-- | rs422lib/rsbus.c | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/rs422lib/rsbus.c b/rs422lib/rsbus.c index 705736f..2e63594 100644 --- a/rs422lib/rsbus.c +++ b/rs422lib/rsbus.c @@ -18,7 +18,7 @@ rshdlr rxhdlr; enum rs_stat{REST,ST,ADDR,READ,DISCARD,ED,DED};
enum rs_stat rs_st=REST;
-unsigned char rs_tx[12]={STBIT1,0,RSADDR,MACTYPE,0,0,0,0,0,0,0,0};
+unsigned char rs_tx[15]={STBIT1,0,RSADDR,MACTYPE};
unsigned char tx_len;
unsigned char tx_pos;
@@ -88,7 +88,7 @@ __interrupt void rsbus_rx(void) if (len<2)
{
ret=(SYSRET ^ MACTYPE);
- SYSCALL_IRQ(RSSYSRET); // RETURN machine type
+ SYSCALL_IRQ(RSSYSRET); // TODO RETURN CURRENT STATUS
}
else
SYSCALL_IRQ(RSSYSBIT); // SYSCTL call happened here!!!
@@ -109,9 +109,6 @@ __interrupt void rsbus_rx(void) }
break;
}
- /*//This is a repeater
- if (IFG2&UCA0TXIFG)
- UCA0TXBUF=dat;*/
}
void rsbus_w(int addr,unsigned char* buf,unsigned int len)
@@ -133,44 +130,6 @@ void rsbus_w(int addr,unsigned char* buf,unsigned int len) UC0IE |= UCA0TXIE;
}
-/*void rsbus_w(int addr,char* buf,int len)
-{
- // Acquire output
- RSOUT |= RSPIN;
- delay_ms(2);
- unsigned int i=0;
- unsigned int parity=addr^RSADDR;
- // Start bits
- while ((IFG2&UCA0TXIFG) == 0);
- UCA0TXBUF=(STBIT0 & 0xff);
- while ((IFG2&UCA0TXIFG) == 0);
- UCA0TXBUF=(STBIT1 & 0xff);
- // Addr
- while ((IFG2&UCA0TXIFG) == 0);
- UCA0TXBUF=(addr & 0xff);
- // RSADDR
- while ((IFG2&UCA0TXIFG) == 0);
- UCA0TXBUF=(RSADDR & 0xff);
- // Data
- while (i<len)
- {
- parity^=buf[i];
- while ((IFG2&UCA0TXIFG) == 0);
- UCA0TXBUF=buf[i++];
- }
- // Parity bit
- while ((IFG2&UCA0TXIFG) == 0);
- UCA0TXBUF=(parity & 0xff);
- // End bits
- while ((IFG2&UCA0TXIFG) == 0);
- UCA0TXBUF=(EDBIT0 & 0xff);
- while ((IFG2&UCA0TXIFG) == 0);
- UCA0TXBUF=(EDBIT1 & 0xff);
- while ((IFG2&UCA0TXIFG) == 0);
- // Release output
- RSOUT &= ~(RSPIN);
-}*/
-
void rsbus_syscall()
{
rxhdlr(rs_rxbuf,len-1);
|