Home
PCM-3640 Manual
Contents
1. Program DEMO01 C Description This demo program transmits a string to COM1 and receives a string from COM2 Compiler Turbo C 2 0 FICCI CIO ICICI IOI ICICI ICICI ICICI ICICI ICICI ICI I IO A I I A A ae include lt dos h gt include lt io h gt include lt stdio h gt include lt conio h gt define TIME_OUT 10000 static int base0 0x3f8 Base address of port 0 RARA int basel 0x2f8 Base address of port 1 LAT char rec l6 Buffer for received string static char cmd 16 Buffer for transmitted string void main f int i Counter for character being sent received char flag Flag for end of output input data int timeout Timeout counter outport base0 2 Oxc9 outport basel 2 Oxc9 enable port 0 FIFO enable port 1 FIFO Set communication parameters for port 0 outp base0 3 0x80 Set DLAB 1 Set baud 115200 outp base0 0x01 outp basel 1 0 Set data 8 stop l no parity outp base0 3 0x03 Disable port 0 interrupt outp base0 1 0x00 Set communication parameters for port 1 outp basel 3 0x80 Set DLAB 1 Set baud 115200 outp basel 0x01 outp basel l1 0 Set data 8 stop l no parity outp basel 3 0x03 Disable port 1 interrupt outp basel 1 0x00 printf nEnter a string to be transmitted 15 characters or less or Q to quit gets cmd
2. 5 IF STATUS AND amp H1E THEN 280 IF STATUS AND amp H1 0 THEN 280 D INP PORT PRINT DATA CHR D RETURN Program for second computer 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 ekkkeeeeKE STEP1 INITIALIZATION ee HH Clear screen CLS Define variables A TO Z as integer DEFINT A Z Set port base address must match hardware PORT amp H2F8 Set baud rate to 300 OUT PORT 3 amp H80 OUT PORT amp H80 OUT PORT 1 OUT PORT 3 amp HIF STEP 2 RECEIVE DATA FROM ANOTHER PC FOR I 65 TO 90 GOSUB 190 NEXT I PRINT PRINT PRINT PRINT DATA RECEIVES END THEN DATA SEND BEGIN NING 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 PRINT PRINT PRESS ANY KEY IF INKEY THEN 180 ELSE 260 STATUS INP PORT 5 IF STATUS AND amp H1E THEN GOTO 190 IF STATUS AND amp H1 0 THEN 190 d INP PORT PRINT DATA CHR d RETURN Lkkk keke STEP 3 SEND DATA etek RARE FOR I 65 TO 90 d I GOSUB 310 NEXT I END STATUS INP PORT 5 AND amp H20 IF STATUS 0 THEN 310 OUT PORT d FOR J 0 TO 1200 NEXT J RETURN C language test program You can use the following C program to test the PCM 3640 s send and receive functions FICCI CIO ICI I IOI ICICI III CII CIC ICICI ICICI ICICI ICI ICR A I I A Ae e pA E FE
3. while cmd 0 q amp amp cmd 0 Q i 0 cmd strlen cmd 0x0d flag 1 while flag outportb base0 cmd i Send data if cmd i 0x0d flag 0 T i 0 flag 1 timeout TIME_OUT while flag Check if receiver data is ready if inportb basel 5 amp 1 0 rec i inportb basel Receive data if rec i 0x0d rec itl 0 6 PCM 3640 User s Manual flag 0 printf nReceived data s n rec itt BASE 1 else Check timeout timeout if timeout 0 flag 0 printf nTimeout error n printf nEnter a string to be transmitted 15 characters or less or Q to quit gets cmd BASE 2 Register structure and format This section gives short description of each of the module s registers For more information please refer to the data book for the STARTECH 16C550 UART chip All registers are one byte Bit 0 is the least significant bit and bit 7 is the most significant bit The address of each register is specified as an offset from the port base address BASE selected with DIP switch SW1 DLAB is the Divisor Latch Access Bit bit 7 of BASE 3 BASE 0 Receiver buffer register wnen DLAB 0 and the operation is a read BASE 0 Transmitter holding register when DLAB 0 BASE 3 and the operation is a write BASE 0 Divisor latch bits 0 7 when DLAB 1 BASE 1 Divisor latch bits 8 15 when DLAB
4. 4 5 6 7 and 8 The default is 7 stop The number of stop bits Valid values are 1 and 2 The default is 2 for 75 and 110 bps 1 for all others RS Suppresses RTS PCM 3640 User s Manual CS Controls CTS DS Controls DSR CD Controls CD LF Sends a line feed following each carriage return PE Enables parity checking filenum filenum is an integer expression which evaluates to a valid file number You must put the speed parity data and stop parameters in this position and order but you can put the RS CS DS CD LF and PE parameters in any order The n argument in the CS DS and CD parameters specifies the number of milliseconds to wait for the signal before returning a device timeout error n may range from 0 to 65535 If you omit n or set it equal to 0 then the line status is not checked at all Refer to the IBM BASIC reference manual for more detailed information Programming example standard COM ports You can use the following BASIC program to test the PCM 3640 s send and receive functions 10 I ICICI IC I I III IO ICICI ICR ICI I E E E ICI I I IIA I a ee ae 20 Program DEMO01 BAS 30 Description This demo program transmits a 40 string through COM1 and receives it through 50 COM2 70 IOS IIIS IIIS ISIC ICICI ICICI III I ICI I I 160 Set the proper parameters 170 COM1 amp COM2 baud rate 9600 no parity check 180 Data bit 8 stop bit
5. mo to Shr qaadaedqaded In standard mode the I O address of the ports are as follows MODE Port I O address Interrupt No Port1 3F8 Selectable see p 3 Port2 2F8 Selectable see p 3 Port3 3E8 Selectable see p 3 Port4 2E8 Selectable see p 3 Enhanced mode La S Base address selection SW1 In enhanced mode you can select a different base address The base address determines the address for each of the four ports The I O addresses for the four ports are as follows Port 1 0 address Port 1 Base 00H Port 2 Base 08H Port 3 Base 10H Port 4 Base 18H You use switches 1 6 of DIP switch SW1 a 7 position DIP switch to set the base address You can set the base address anywhere from hex 200 to 3F8 A8 A9 Lu 3322732 i To set the base address you have to calculate the base address as follows NOTE On the PCM 3640 the address line A9 does not appear on the DIP switch as it is permanently hard wired to HEX 200 on the card The following table shows different base address settings Port base address SW1 Base Address A3 A4 A5 AG AT A8 200 207 e e e e e e 208 20F O e e e e e 2E8 2EF O e O O O e 3E8 3EF O e O O O O 3F8 3FF O O O O O O 0N O OFF Default Note If your CPU module or card has serial interface ports you will need to adjust the I O port addresses or disable the ports to avoid conf
6. once to 90 clear any random data 100 FOR I PORT1 TO PORT1 6 110 DUM INP I 120 NEXT I 130 FOR I PORT2 TO PORT2 6 140 DUM INP I 150 NEXT I 160 Initialize the registers of 170 portl First set DLAB 1 so the 180 desired baud rate can be programmed 190 OUT PORT1 3 amp H80 200 Write the value of divisor into 210 registers hex 180 dec 384 300 BAUD 220 OUT PORT1 amp H80 OUT PORT1 1 amp H1 230 Set word length 8 bits stop bits 2 240 even parity DLAB 0 250 OUT PORT1 3 amp HIF 260 Do the same thing for port2 270 OUT PORT2 3 amp H80 280 OUT PORT2 amp H80 O0UT PORT2 1 amp H1 290 OUT PORT2 3 amp HIF 300 Loop over data 0 255 and send it 310 from portl to port2 320 FOR BYTE 0 TO 255 330 Wait until the transmitter buffer 340 is empty 350 IF INP PORT1 5 AND 32 0 GOTO 350 360 Output the data through portl 370 OUT PORT1 BYTE 380 See if the data is available by checking 390 the Data Ready bit 400 IF INP PORT2 5 AND 1 0 GOTO 400 410 J INP PORT2 420 Print out the data byte received 430 PRINT port HEX PORT2 HEX J 440 If the value sent lt gt the received value then error 450 IF J lt gt BYTE GOTO 620 460 NEXT BYTE 470 Loop over data 0 255 and send it 480 from port2 to portl 490 FOR BYTE 0 TO 255 500 See if the transmitter buffer is empty 510 IF INP PORT2 5 AND 32 0 G
7. 00 377 not used 22 SA9 IRQ6 a 378 37F printer port 23 SA8 IRQ5 X 380 3AF not used 24 SA7 IRQ4 3B0 3BF monochrome adapter and printer 25 SA6 IRQ3 3C0 3CF not used 26 SA5 DACK2 as 3D0 3DF color and graphics adapters 27 SA4 TC se ix 3E0 3EF not used 28 SA3 BALE gt 3F0 3F7 floppy diskette drive 29 SA2 5V nz a 3F8 3FF COM1 30 SA1 OSC 31 SAO OV 32 ov OV PCM 3640 User s Manual PCM 3640 User s Manual
8. 1 The two bytes BASE 0 and BASE 1 together form a 16 bit number the divisor which determines the baud rate Set the divisor as follows Baud rate Divisor 50 2304 75 1536 110 1047 133 5 857 150 768 300 384 600 192 1300 96 BASE 4 1800 64 2000 58 2400 48 BASE 5 3600 32 4800 24 7200 16 9600 12 19200 6 38400 3 56000 2 115200 1 Interrupt Status Register ISR when DLAB 0 bit 0 Enable received data available interrupt bit 1 Enable transmitter holding register empty interrupt bit 2 Enable receiver line status interrupt bit 3 Enable modem status interrupt FIFO Control Register FCR bit 0 Enable transmit and receive FIFOs bit 1 Clear contents of receive FIFO bit 2 Clear contents of transmit FIFO bit 3 Change RXRDY and TXRDY from mode 0 to mode 1 bits 6 7 Set trigger level for receiver FIFO interrupt Bit 7 Bit 6 FIFO trigger level 0 0 01 0 1 04 1 0 08 1 1 14 Line Control Register LCR bit 0 Word length select bit 0 bit 1 Word length select bit 1 Bit 1 Bit 0 Word length bits 0 0 5 0 1 6 1 0 7 1 1 8 bit 2 Number of stop bits bit 3 Parity enable bit 4 Even parity select bit 5 Stick parity bit 6 Set break bit 7 Divisor Latch Access Bit DLAB Modem Control Register MCR bit 0 DTR bit 1 RTS Line Status Register LSR bit 0 Receiver data ready bit 1 Overrun erro
9. 1 190 Ignore the CTS RTS and DSR signals 200 OPEN COM1 9600 N 8 1 RS CS DS CD FOR RANDOM AS 1 210 OPEN COM2 9600 N 8 1 RS CS DS CD FOR RANDOM AS 1 220 INPUT INPUT COMMAND CMDS 230 IF CMD Q OR q THEN CLOSE END ELSE GOSUB 250 240 GOSUB 300 GOTO 220 250 Transmit data sub routine 260 PRINT 1 CMD 270 RETURN 300 Receive data sub routine 310 T TIMER TEMP RXx 320 IF TIMER gt T 5 THEN PRINT TIMEOUT ERROR RETURN 330 IF LOC 2 gt 0 THEN TEMP INPUT 1 2 ELSE GOTO 320 340 RX RX TEMP 350 IF TEMP CHR 13 THEN GOTO 360 ELSE GOTO 320 360 PRINT RECEIVE DATA RX RETURN Using other I O port addresses If you are going to use I O ports other than COM1 or COM2 you will need to directly program the registers of the PCM3640 s 16C550 chip See page 7 for information on the format and programming of these registers See page 8 if you have trouble finding a free I O port base address You can use the following program as a base as you develop your own driver The program exchanges data the numbers 0 to 256 between two ports It uses I O port addresses hex 2E8 and 3E8 Set JP4 JP5 and JP10 for RS485 or RS 422 mode described on page 2 Programming example arbitrary I O ports 20 Clear the screen 30 CLS 40 Set the I O port base addresses for 50 both cards 60 PORT1 amp H2E8 70 PORT2 amp H3E8 80 Read all registers
10. D RTS CTS DSR GND 7 DTR DCD GND RIO D O N M o The maximum length of a RS 232 cable is 100 ft If you need to connect over longer distances longer than 100 ft you will have to use another standard like RS 422 or RS 485 If you do not use CTS RTS DSR DTR signals please loop them back otherwise the PC ComLIB software will not function correctly PC ComLIB always checks for handshake signals Hardware installation Warning TURN OFF your PC power supply whenever you install or remove the PCM 3640 or connect and disconnect cables Installing the module on a CPU card 1 Turn the PC s power off Turn the power off to any peripheral devices such as printers and monitors 2 Disconnect the power cord and any other cables from the back of the computer 3 Remove the system unit cover see the user s guide for your chassis if necessary 4 Remove the CPU card from the chassis if necessary to gain access to the card s PC 104 connector 5 Screw the brass spacer included with the module into the threaded hole on the CPU card Do not tighten too much or the threads may be damaged 6 Carefully align the pins of the PCM 3640 with the PC 104 connector Slide the module into the connector The module pins may not slide all the way into the connector do not push too hard or the module may be damaged 7 Secure the module to the CPU card to the threaded hole in the CPU ca
11. LEDs indicate status of TX RX lines red LED JP2 Channel 2 Interrupt level represents TX green LED represents RX JP3 Channel 3 Interrupt level Supported by PC ComLib serial communication JP4 Channel 4 Interrupt level programming library optional Specifications Dimensions 3 775 x 3 550 9 6 cm x 9 0 cm Board Layout Bus PC 104 Baud rate 50 to 115 200 bps Character length 5 6 7 or 8 bits Parity Even odd or none Stop bit 1 1 5 5 bit data only or 2 1 0 connectors Four male DB 9 Interrupt level IRQ 3 4 5 6 7 or 9 Clock input 1 8432 MHz Power consumption 5 V 220 mA max PC 104 and the PC 104 logo are trademarks of the PC 104 Consortium Part no 2000364000 1st Edition Printed in Taiwan December 1994 Default jumper settings The PCM 3640 will be shipped in standard mode with the following I O address and IRQ settings Port V O address IRQ no Port 1 3F8 IRQ4 Port 2 2F8 IRQ3 Port 3 3E8 IRQ12 Port 4 2E8 IRQ15 Jumper and Switch settings The PCM 3640 can be used in two modes standard or enhanced mode In standard mode the I O addresses are compatible with the standard PC communication ports COM1 COM4 In enhanced mode you can select a different base address The offset of each port from the base address is fixed Standard Enhanced mode selection Switch 7 of DIP switch SW1 selects between standard and enhanced mode Standard mode
12. OTO 510 520 OUT PORT2 BYTE 530 See if the data is available by 540 checking the Data Ready bit 550 IF INP PORT1 5 AND 1 0 GOTO 550 560 J INP PORT1 570 PRINT port HEX PORT1 HEX J 580 IF J lt gt BYTE GOTO 620 590 NEXT BYTE 600 If everything is OK then stop 610 END 620 PRINT Data transmission error BEEP END Programming example communication The following pair of example programs show how you can set up communication between two computers The first program sends data then receives data The second program receives data then sends data Run the first program on one computer and the second on another Program for first computer 10 TREE RE EML ES STEPS Lei TM ELTA LOM 6 SSSH ERICK ES E 20 Clear screen 30 CLS 40 Define variables A to Z as integer 50 DEFINT A Z 60 Set port base address must match hardware 70 PORT amp H3F8 80 Set baud rate to 300 90 OUT PORT 3 amp H80 100 OUT PORT amp H80 110 OUT PORT 1 120 OUT PORT 3 amp HIF LAO FRERRESES STEED Zt SEND DATA PSPS eee 150 FOR I 65 TO 90 160 170 GOSUB 200 180 NEXT I 190 GOTO 260 PCM 3640 User s Manual 200 210 220 230 240 250 260 270 280 290 300 310 320 330 STATUS INP PORT 5 AND amp H20 IF STATUS 0 THEN 200 OUT PORT I FOR J 0 TO 1200 NEXT J RETURN AEE STEP Fi RECKIVE DATA 4 FOR I 65 TO 90 GOSUB 280 NEXT I END STATUS INP PORT
13. PCM 3640 PC 104 4 port RS 232 Module Introduction Initial inspection oo D gt U z p gt T a m J n N S N The PCM 3640 is a PC 104 compatible 4 port RS 232 We carefully inspected the PCM 3640 both serial interface module It works with PC 104 CPU modules mechanically and electrically before we shipped it or CPU cards which accept PC 104 expansion modules It It should be free of marks and scratches and in provides four independent serial interfaces accessed perfect electrical order on receipt through male DB 9 connectors Handle the board only by its edges The static The module s industry standard 16C550 asynchronous charge on your body may damage its integrated communication chip is fully programmable The module circuits Keep the card in its anti static package requires no special commands or control codes if you use whenever it is not installed You can use this the standard COM1 COM4 port addresses package to return the card if it should need repair Switches and jumpers Four RS 232 serial interfaces The following chart shows the switches and jumpers used to configure the PCM 3640 High speed data transmission up to 115 200 Bps Switch selectable addresses COM1 COM4 or any other address from hex 200 to 3F8 Switch Function 16 bytes FIFOs SW1 I O base address enhanced mode Jumper selectable interrupt level JPA Channel 1 Interrupt level Eight
14. he user s manual for your device for installation instructions You may find the following helpful In general DTE Data Terminal Equipment refers to the device that is leading the communication Examples include PC s terminals and some printers DCE refers to the device being communicated with or controlled Examples include modems DSU s digital service units printers and lab factory equipment In some situations you may be able to get by with just three lines data on TxD a Signal Ground and a handshaking line Examples are printer or plotter connections troubleshooting and situations where you require only one wire communication Terminal or PC DTE connections PCM 3640 DTE DB 9 Terminal DTE DB 25 Pin Signal Pin Signal 3 TxD 3 RxD 2 RxD 2 TxD 7 RTS 5 CTS 8 CTS 4 RTS 6 DSR 20 DTR 5 GND 7 GND 4 DTR 6 DSR 1 DCD 8 DCD Modem connections PCm 3640 DB 9 Male Modem DCE Pin Signal Pin Signal 3 TxD 2 RxD 2 RxD 3 TxD 7 RTS 4 CTS 8 CTS 5 RTS 6 DSR 6 DTR 5 GND 7 GND PCM 3640 User s Manual 4 DTR 20 DSR 1 DCD 8 DCD For DTE to DCE connection use straight through cable connections i e you don t have to reverse lines 2 and 3 lines 4 and 5 and lines 6 and 20 Because in general DCE RS 232 interfaces are reversed themselves Terminal without handshake PCM 3640 DB 9 MALE Terminal DTE Pin Signal Pin Signal TxD 3 RxD RxD 2 Tx
15. licts PCM 3640 User s Manual Interrupt level selection JP1 JP4 You can set the interrupt level for each port from 3 to15 except 8 13 and 14 Jumpers JP1 JP2 JP3 and JP4 sets the interrupt level for port 1 port 2 port 3 and port 4 respectively Simply short the pins on the jumper corresponding to the interrupt level required as illustrated below 9 10 11 12 15 o0o000 0 O oOo Oo oO ooo o O Oo 9 10 1112 15 oo o O oo000 0 0 9 10 111215 O O O0 0000000 G 0 IRQ 324 5 56 7 000000000 00000000 0 Do not use interrupts that are used by other cards ports unless you have made provision for interrupt sharing in your programs JP1 0 JP2 O 0 o a e had 0 O JP3 O 0 O O O 9 10 111215 JP4 Note Signal wiring Connector pin assignments You access the PCM 3640 s ports through four external male DB 9 connectors RS 232 connector pin assignments are as follows Pin description DCD receive line signal detector RD received data TD transmitted data DTR data terminal ready GND ground DSR data set ready RTS request to send CTS clear to send RI ring indicator OJINI OJAJAJOUJNJ RS 232 Signal wiring Since the RS 232 interface is not strictly defined many devices have their own connection methods which may ignore some signal lines or define reserved lines to other functions It is best to refer to t
16. r bit 2 Parity error bit 3 Framing error bit 4 Break interrupt bit 5 Transmitter holding register empty bit 6 Transmitter shift register empty bit 7 At least one parity error framing error or break indication in the PCM 3640 User s Manual PC 104 Bus signal assignments REQ BASE 6 Modem Status Register MSR a E bro Deta CTS 0 Z OV OV bit 1 Delta DSR 1 IOCHCHK 0V SBHE MEMCS16 bit 2 Trailing edge ring indicator 2 SD7 RESETDRV LA23 bit 3 Delta received line signal detect IOCS16 bit 4 CTS 3 SD6 5V LA22 RQ10 bit 5 DSR 4 SD5 IRQ9 LA21 RQ11 bit 6 RI 5 SD4 5V LA20 RQ12 bit 7 Received line signal detect 6 SD3 DRQ2 LA19 RQ15 BASE 7 Temporary data register 7 SD2 12V LA18 RQ14 8 SD1 ENDXFR LA17 DACKO 9 SDO 12V MEMR DRQO 10 IOCHRDY KEY MEMW DACK5 ui AEN SMEMW SD8 DRQ5 The following chart shows the I O addresses used by 12 SA19 SMEMR SD9 DACK6 standard PC peripheral devices 13 SA18 IOW SD10 DRQ6 14 SA17 IOR SD11 DACK7 I O address hex Assignment 15 SA16 DACK3 SD12 DRQ7 000 1FF used by base system board 16 SA15 DRQ3 SD13 5V 200 not used 17 SA14 DACK1 SD14 MASTER 201 game control 18 SA13 DRQ1 SD15 ov 202 277 not used 19 SA12 REFRESH KEY 278 27F second printer port ov 280 2F7 not used 20 SA11 SYSCLK 2F8 2FF COM2 21 SA10 IRQ7 a 3
17. rd using the included screw 8 Attach any accessories to the PCM 3640 9 Reinstall the CPU card and replace the system unit cover Reconnect the cables you removed in step 2 Turn the power on Connecting to another PC 104 module 1 Insert the pins of connector JP6 on the end of the PCM 3640 module into the piggyback connector on the other PC 104 module PC 104 Module PCM 3640 gt PC 104 Module _ _ gt E 2 Screw the PCM 3640 to the brass spacer This completes the hardware installation Programming with COM1 or COM2 If you set the PCM 3640 s ports as COM1 and COM2 you can send and receive data using the normal communica tion functions found in high level languages The following examples use BASIC to demonstrate PCM 3640 programming The BASIC communication process starts with the OPEN COMn Statement This statement assigns a buffer for communication purposes and sets up the communication parameters Command format OPEN COMn speed parity data stop RS CS n DS n CD n LF PE AS filenum Example OPEN COM1 9600 N 8 CS DS CD AS 1 Where COMn nis 1 or 2 indicating either COM1 or COM2 speed An integer constant specifying the baud rate in bits per second parity One of the following characters S space O odd M mark E even N none data An integer constant indicating the number of data bits Valid values are
Download Pdf Manuals
Related Search
Related Contents
Turbomole USER`S MANUAL Russell Hobbs OXFORD THERMAL 3M X20 User's Manual ダウンロード Agilent Gaschromatograph der Serie 7890 Installation Instructions attention Cogent 2000 User`s Manual Kenmore POWER MISER 153.33616 User's Manual Copyright © All rights reserved.
Failed to retrieve file