Thank you, please write example shows, sorry it's new CodePudding user response:
With the manufacturer to the demo CodePudding user response:
Write command string, the string to a serial port line Var ComStr: string; The begin ComStr:=CRH (27) + CRH (12);//clear screen //give the com ComStr can, the specific way to send the API and com tripartite controls, you can search the end; CodePudding user response:
Procedure TForm26. Button2Click (Sender: TObject); Var Mystr: string; The begin { 3. The ESC @ initialization command ASCII format: ESC @ Decimal format: [027] [064] Hexadecimal format: bh [1] [h] 40 Description: return to electricity boot state, 4. The CLR CLS command ASCII format: the CLR Decimal format: [012] Hexadecimal format: ch [0] Description: remove all the characters on the screen, 5. A d1d2d3 ESC Q... Dn CR to display data command ASCII format: A d1d2d3 ESC Q... Dn CR Decimal format: [027] [081] [065] d1d2d3... Dn [013] 48 & lt;=dn<57 or dn=45 or dn==46 Hexadecimal format: bh [1] [h] [h] 41 d1d2d3... Dn dh [0] 30 h & lt;=dn<39 h or dn==2 dh or dn=2 eh Description: a. to execute the command, will be sent to display the data to override mode, so you don't need to be in every show In data to perform before CAN remove the cursor line command, B. show d1... Dn no decimal point 1 & lt;=n<=8, C. show d1... Dn have a decimal point 1 & lt;=n D. show the contents of available CLR or CAN command clears, 6. ESC s n set "unit price", "total", "payment", "change" character display status command ASCII format: ESC s n 0 & lt;=n<=4 Decimal format: [027] [115] 48 n & lt;=n<=52 Hexadecimal format: bh [1] [h] 73 n 30 h & lt;=n<34 h= Illustrate: (1) when n=0, four lights all dark, (2) when n=1, "unit price" lamp light, other three dark, (3) when n=2, "total" lamp light, other three dark, (4) when n=3, "collection" lamp light, other three dark, (5) when n=4, "change" light is bright, the other three kinds of dark, //com_send (Pchar (PDStr), Length (PDStr)) } //show total MyStr=CRH (27) + CRH (115) + '2'. Try Self. CnRS2322. WriteCommData (pchar (mystr), Length (mystr)); Sleep (30); Except, end; //display amount Mystr=floattostr (self) DBGridEh1) Columns. [10] Footers [0]. SumValue); If the trim (mystr)=trim (self. Edit2. Text) then the exit; Self. Edit2. Text:=trim (mystr); //if the self. DBGridEh1. Columns. [10] Footers. [0] SumValue=https://bbs.csdn.net/topics/0 then mystr:=' '; //mystr:='+ trim (mystr); //mystr=rightstr (mystr, 8). MyStr=CRH (27) + CRH (81) + CRH (65) + myStr + CRH (13); Try Self. CnRS2322. WriteCommData (pchar (mystr), Length (mystr)); Sleep (30); Except, end; end; Before the project, the application of reference,,,, CodePudding user response:
reference 5 floor babydog01 reply: Procedure TForm26. Button2Click (Sender: TObject); Var Mystr: string; The begin { 3. The ESC @ initialization command ASCII format: ESC @ Decimal format: [027] [064] Hexadecimal format: bh [1] [h] 40 Description: return to electricity boot state, 4. The CLR CLS command ASCII format: the CLR Decimal format: [012] Hexadecimal format: ch [0] Description: remove all the characters on the screen, 5. A d1d2d3 ESC Q... Dn CR to display data command ASCII format: A d1d2d3 ESC Q... Dn CR Decimal format: [027] [081] [065] d1d2d3... Dn [013] 48 & lt;=dn<57 or dn=45 or dn==46 Hexadecimal format: bh [1] [h] [h] 41 d1d2d3... Dn dh [0] 30 h & lt;=dn<39 h or dn==2 dh or dn=2 eh Description: a. to execute the command, will be sent to display the data to override mode, so you don't need to be in every show In data to perform before CAN remove the cursor line command, B. show d1... Dn no decimal point 1 & lt;=n<=8, C. show d1... Dn have a decimal point 1 & lt;=n D. show the contents of available CLR or CAN command clears, 6. ESC s n set "unit price", "total", "payment", "change" character display status command ASCII format: ESC s n 0 & lt;=n<=4 Decimal format: [027] [115] 48 n & lt;=n<=52 Hexadecimal format: bh [1] [h] 73 n 30 h & lt;=n<34 h= Illustrate: (1) when n=0, four lights all dark, (2) when n=1, "unit price" lamp light, other three dark, (3) when n=2, "total" lamp light, other three dark, (4) when n=3, "collection" lamp light, other three dark, (5) when n=4, "change" light is bright, the other three kinds of dark, //com_send (Pchar (PDStr), Length (PDStr)) } //show total MyStr=CRH (27) + CRH (115) + '2'. Try Self. CnRS2322. WriteCommData (pchar (mystr), Length (mystr)); Sleep (30); Except, end; //display amount Mystr=floattostr (self) DBGridEh1) Columns. [10] Footers [0]. SumValue); If the trim (mystr)=trim (self. Edit2. Text) then the exit; Self. Edit2. Text:=trim (mystr); //if the self. DBGridEh1. Columns. [10] Footers. [0] SumValue=https://bbs.csdn.net/topics/0 then mystr:=' '; //mystr:='+ trim (mystr); //mystr=rightstr (mystr, 8). MyStr=CRH (27) + CRH (81) + CRH (65) + myStr + CRH (13); Try Self. CnRS2322. WriteCommData (pchar (mystr), Length (mystr)); Sleep (30); Except, end; end; Before the project, the application of reference,,,, Thank you! But "self CnRS2322" this control from there to meet? CodePudding user response:
I am using Delphi 10nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull