Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 7 of 9

PT630 Portable Terminal Programming Reference Guide: BIOS and System Functions, pages 50 to 58

Pages 50 to 58 of 73, from PT630 Portable Terminal Programming Reference Guide

The original document is the PDF (2.0 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Unitech PT630

Page 50

PT630 Programming Reference Guide Page 50 of 59 -----------------------------------------------------------------------------------------------------------------1.6

Power Management Function ( INT 22H ) Entry Parameter: None Return Value: AX = 0 1 2

; awaken by key ; awaken by barcode scanner ; awaken by RS232

The system will enter HALT power saving mode from this BIOS call, on return the value in AX register will define the type of device that awakes the system back to ACTIVE mode.

Sample C program with INT22 int get_barcode(char * str_bar) { union REGS regs; struct SREGS sregs; regs.x.dx=(int)str_bar; segread(&sregs); regs.h.ah=0x50; intdosx(&regs,&regs,&sregs); if (regs.x.ax==1) return(0); /* no data input from barcode port */ else return(1); /* has data input from barcode port */ } int get_keyboard() { if (kbhit()==0) return(0); /* no input from key pressing */ return(1); /* has input from keyboard */ } while (

!get_barcode() && /* check if data input from barcode port */ !get_keyboard() ) /* check if data input from keyboard

{ int86(0x22,&regs,&regs); }

/* enter stand-by state if no input from either barcode port or keyboard */

*/

Page 51

PT630 Programming Reference Guide Page 51 of 59 -----------------------------------------------------------------------------------------------------------------1.7

Beeper Control Function ( INT 31H ) Entry Parameter: AX= frequency AX Frequency(Hz) 0 200 1 400 2 600 3 800 4 1K 5 2K 6 2.5K 7 3K 7 5K Return Value:

None

Example: void TD_beep_new(int fz,int tm) { regs.x.ax = fz; regs.x.bx = tm; int86(0x31,&regs,&regs); }

BX=time duration BX Time Duration(ms) 0 10 1 50 2 100 3 200 4 500 5 800 6 1K 7 1.5K 8 2K

Page 52

PT630 Programming Reference Guide Page 52 of 59 -----------------------------------------------------------------------------------------------------------------1.8 COM1 RS232 Control Functions ( INT 33H ) 1.8.1 Set Communication Parameters Entry Parameter: AH = 0 AL bits 7-4: 0001xxxx 0010xxxx 0011xxxx 0100xxxx 0101xxxx 0110xxxx 0111xxxx 1000xxxx 1001xxxx 1010xxxx bits 3-2: xxxx00xx xxxx01xx xxxx11xx bit 1: xxxxxx0x xxxxxx1x bit 0: xxxxxxx0 xxxxxxx1 Return Value: None baud 150 baud 300 baud 600 baud 1200 baud 2400 baud 4800 baud 9600 baud 19200 baud 38400 baud 57600 none parity odd parity even parity one stop bit two stop bits 7 data bits 8 data bits

Example: int TC_232_parameter(long baud,int parity,int stop,int data) { unsigned char cc=0; unsigned int i_baud; i_baud = (int)(baud / 10L); switch (i_baud) { case 11 : cc=0x00; break; case 15 : cc=0x10; break; case 30 : cc=0x20; break; case 60 : cc=0x30; break; case 120 : cc=0x40; break; case 240 : cc=0x50; break; case 480 : cc=0x60; break; case 1920 : cc=0x80; break; case 3840 : cc=0x90; break; case 5760 : cc=0xA0; break; default: cc=0x70; break; } switch (parity) { case 0 : break; case 1 : cc=cc|0x04; break;

Page 53

PT630 Programming Reference Guide Page 53 of 59 -----------------------------------------------------------------------------------------------------------------case 2 : cc=cc|0x0c; break; } switch (stop) { case 1 : break; case 2 : cc=cc|0x02; break; } switch (data) { case 7 : break; case 8 : cc=cc|0x01; break; } regs.h.ah = 0; regs.h.al = cc; int86(0x33,&regs,&regs); } 1.8.2

Get Character from RS232 Port Entry Parameter: AH = 1 Return Value: 1) AH = 0 ; has character input AL = character 2) AH = 1 ; no character input Note: Only for NONE communication protocol Example: unsigned char TC_232_char_I() { regs.h.ah = 1; int86(0x33,&regs,&regs); if (regs.h.ah == 0) { return(regs.h.al); } return(255); }

Page 54

PT630 Programming Reference Guide Page 54 of 59 -----------------------------------------------------------------------------------------------------------------1.8.3

Send Character to RS232 Port Entry Parameter: AH = 2 AL = character Return Value: None Note: Only for NONE communication protocol Example: void TC_232_char_O(unsigned char ch) { regs.h.ah = 2; regs.h.al = ch; int86(0X33&regs,&regs); }

1.8.4

Enable RS-232 Port Entry Parameter: AH = 3 Return Value: None Example: void TC_232_enable() { regs.h.ah = 3; int86(0x33,&regs,&regs); }

1.8.5

Disable RS-232 Port Entry Parameter: AH = 4 Returned Value: None Example: void TC_232_disable() { regs.h.ah = 4; int86(0X33&regs,&regs); }

Page 55

PT630 Programming Reference Guide Page 55 of 59 -----------------------------------------------------------------------------------------------------------------1.8.6

Set RTS/DTR Signal of RS232 Port Entry parameter: AH = 5 AL = 1 ; set DTR 2 ; set RTS DH = 0 ; set Enable (High voltage) 1 ; set Disable (Low voltage) Return Value: None Note: Only for NONE communication protocol Example: void TC_232_RTS(int rts) { regs.h.ah = 5; regs.h.al = 2; regs.h.dh = (unsigned char)rts; int86(0X33&regs,&regs); } void TC_232_DTR(int dtr) { regs.h.ah = 5; regs.h.al = 1; regs.h.dh = (unsigned char)dtr; int86(0X33&regs,&regs); }

1.8.7

Get CTS/DSR Signal Status of RS232 Port Entry Parameter: AH = 6 AL = 1 ; get CTS AL = 2 ; get DSR Return Value: DH = 0 ; High voltage on signal 1 ; Low voltage on signal Note: Only for NONE communication protocol Example: int TC_232_CTS() { regs.h.ah = 6; regs.h.al = 2; int86(0X33&regs,&regs); return((int)regs.h.dh); } int TC_232_DSR()

{ regs.h.ah = 6; regs.h.al = 1; int86(0X33&regs,&regs); return((int)regs.h.dh); }

1.8.8 Flush RS232 RX buffer Entry Parameter: AH = Return Value: None

8

Page 56

PT630 Programming Reference Guide Page 56 of 59 -----------------------------------------------------------------------------------------------------------------1.9 COM2 (internal COM port) RS232 Control Functions ( INT 14H ) 1.9.1 Set Communication Parameters Entry Parameter:

AH = 0 AL bits 7-4:

bits 3-2: bit 1: bit 0: Return Value:

0001xxxx 0010xxxx 0011xxxx 0100xxxx 0101xxxx 0110xxxx 0111xxxx 1000xxxx 1001xxxx 1010xxxx xxxx00xx xxxx01xx xxxx11xx xxxxxx0x xxxxxx1x xxxxxxx0 xxxxxxx1

None

Example: int TC_232_parameter(long baud,int parity,int stop,int data) { unsigned char cc=0; unsigned int i_baud; i_baud = (int)(baud / 10L); switch (i_baud) { case 11 : cc=0x00; break; case 15 : cc=0x10; break; case 30 : cc=0x20; break; case 60 : cc=0x30; break; case 120 : cc=0x40; break; case 240 : cc=0x50; break; case 480 : cc=0x60; break; case 1920 : cc=0x80; break; case 3840 : cc=0x90; break; case 5760 : cc=0xA0; break; default: cc=0x70; break; } switch (parity) { case 0 : break; case 1 : cc=cc|0x04; break; case 2 : cc=cc|0x0c; break; } switch (stop) { case 1 : break; case 2 : cc=cc|0x02; break; } switch (data) { case 7 : break; case 8 : cc=cc|0x01; break; } regs.h.ah = 0; regs.h.al = cc; int86(0x14,&regs,&regs); } baud 150 baud 300 baud 600 baud 1200 baud 2400 baud 4800 baud 9600 baud 19200 baud 38400 baud 57600 none parity odd parity even parity one stop bit two stop bits 7 data bits 8 data bits

Page 57

PT630 Programming Reference Guide Page 57 of 59 -----------------------------------------------------------------------------------------------------------------1.9.2

Get Character from COM 2 RS232 Port Entry Parameter: AH = 1 Return Value: 1) AH = 0 ; has character input AL = character 2) AH = 1 ; no character input Note: Only for NONE communication protocol Example: unsigned char TC_232_char_I() { regs.h.ah = 1; int86(0x14,&regs,&regs); if (regs.h.ah == 0) { return(regs.h.al); } return(255); }

1.9.3

Send Character to COM2 RS232 Port Entry Parameter: AH = 2 AL = character Return Value: None Note: Only for NONE communication protocol Example: void TC_232_char_O(unsigned char ch) { regs.h.ah = 2; regs.h.al = ch; int86(0X14,&regs,&regs); }

1.9.4

Enable COM2 RS-232 Port Entry Parameter: AH = 3 Return Value: None Example: void TC_232_enable() { regs.h.ah = 3; int86(0x14,&regs,&regs); }

1.9.5

Disable COM2 RS-232 Port Entry Parameter: AH = 4 Returned Value: None Example: void TC_232_disable() { regs.h.ah = 4; int86(0X14&regs,&regs); }

Page 58

PT630 Programming Reference Guide Page 58 of 59 -----------------------------------------------------------------------------------------------------------------1.9.6

Set RTS/DTR Signal of RS232 Port Entry parameter: AH = 5 AL = 1 ; set DTR 2 ; set RTS DH = 0 ; set Enable (High voltage) 1 ; set Disable (Low voltage) Return Value: None Note: Only for NONE communication protocol Example: void TC_232_RTS(int rts) { regs.h.ah = 5; regs.h.al = 2; regs.h.dh = (unsigned char)rts; int86(0X14,&regs,&regs); } void TC_232_DTR(int dtr) { regs.h.ah = 5; regs.h.al = 1; regs.h.dh = (unsigned char)dtr; int86(0X14,&regs,&regs); }

1.9.7

Get CTS/DSR Signal Status of RS232 Port Entry Parameter: AH = 6 AL = 1 ; get CTS AL = 2 ; get DSR Return Value: DH = 0 ; High voltage on signal 1 ; Low voltage on signal Note: Only for NONE communication protocol Example: int TC_232_CTS() { regs.h.ah = 6; regs.h.al = 2; int86(0X14,&regs,&regs); return((int)regs.h.dh); } int TC_232_DSR()

{ regs.h.ah = 6; regs.h.al = 1; int86(0X14,&regs,&regs); return((int)regs.h.dh); }

1.9.8 Flush RS232 RX buffer Entry Parameter: AH = Return Value: None

8