bosko lekovic
/
EthTCPclient_05_02
p1
Diff: PGSdisplay.cpp
- Revision:
- 6:19e7658575fe
- Parent:
- 5:ecaf089d1c8a
- Child:
- 7:6a700c98b9b5
--- a/PGSdisplay.cpp Mon Feb 24 13:55:09 2020 +0000 +++ b/PGSdisplay.cpp Mon Feb 24 17:14:44 2020 +0000 @@ -18,13 +18,37 @@ tast=0; } +uint8_t rs[100]; void init_disp( void) { - rs485.format(8,RawSerial::Even,1); - + rs485.format(8,RawSerial::Even,1); + while(rs485.readable()) + { + rs485.read(rs,1,NULL); + } putOnDisp("elcom", 3); - - + int i =0; + //while(rs485.readable()==0); + wait(0.5); + if(rs485.readable()) + { + + rs485.read(rs+i,1,NULL); + i++; + } + printf("ODGOVOR: %X - %d\n\r",rs[0],i); + //int i=0; +// +// printf("%d\n\r",rs485.readable()); +// if(rs485.readable()) +// { +// printf("\n\rRECEIVE: "); +// while(rs485.readable()) +// { +// rs[i++] = rs485.getc(); +// } +// printf("%X: RECEIVED %d: \n\r",rs[0], i); +// } } unsigned char buf_tel[100] = {0x71,0x00,0x0D,0x71,0x43,DISP_ADR,0x1B,0x4A,0x01,0x01, /*0x1b,0x45,0x1,*/ 0x1B,0x43,1,0x33,0xD5,0x16}; @@ -50,6 +74,7 @@ tast=1; rs485.write(buf_tel, NO_WITH_DATA+2+2,ev); + } void putOnDispNo(int broj, char boja)