Email:
sales@wcscnet.com


Competent Technical Support By Knowledgeable Engineers

View Cart

Checkout

RSS Feed
Home
Products
Services
Support
File Download
Testimonials
NewsLetters
Press Releases
Tutorials
WebLog (News)
WCSC Partners
Developer Tools

Register for WCSC email updates

Wires No More!
$159.99 a pair


Wireless Serial Adapter
(Bluetooth to RS232)

 

Credit Card Merchant Services

Custom functions for Quatech PCMCIA cards (Change frequency, set RS485 transmitter and receiver mode).


The following functions should be used with the PCMCIA cards after the port has been opened.

Functions:

  1. WCSCVxDQPSetClock() sets the frequency of the clock driving the UART.

  2. WCSCVxDQPSetES485Transmit() sets the mode of the transmitter for RS485 PCMCIA cards.

  3. WCSCVxDQPSetES485Receive() sets the mode of the receiver for the RS485 PCMCIA cards.

Quatech Specific PCMCIA Register Set Information:

  1. Quatech PCMCIA Card Register Map

  2. Quatech PCMCIA Card Register Programming

 



//**********************************************************
//*Description-
//* Changes the clock frequency on the Quatech
//* PCMCIA cards.
//*
//*On Entry-
//* int VxDPId
//* Port handle.
//* int Freq
//* 0 = 1.8432 MHz
//* 1 = 3.6864 MHz
//* 2 = 7.3728 MHz
//* 3 = 14.7456 MHz
//**********************************************************
void WCSCVxDQPSetClock(int VxDPId, int Freq)
{
int OldLCR;
int OldSCR;

//Save old LCR
WCSCVxDGetRegister(VxDPId,LCR,&OldLCR);

//Set DLAB to Access QOR
WCSCVxDPutRegister(VxDPId,LCR,OldLCR|LCR_DLAB);

//Save old SCR
WCSCVxDGetRegister(VxDPId,SCR,&OldSCR);

//Update QOR
OldSCR &= 0xFC;
switch(Freq)
{
//Frequency=1.8432 MHz
case 0:
break;

//Frequency=3.6864 MHz
case 1:
OldSCR |= 0x1;
break;

//Frequency=7.3728 MHz
case 2:
OldSCR |= 0x2;
break;

//Frequency=14.7456 MHz
case 3:
default:
OldSCR |= 0x3;
break;
}

WCSCVxDPutRegister(VxDPId,SCR,OldSCR);

//Restore LCR
WCSCVxDPutRegister(VxDPId,LCR,OldLCR);
}
//**********************************************************
 



//**********************************************************
//*Description-
//* Changes the mode of the transmitter.
//*
//*On Entry-
//* int VxDPId
//* Port handle.
//* int Mode
//* 0 = Transmitter always on
//* 1 = Toggle on DTR
//* 2 = Toggle on RTS
//* 3 = Auto Toggle
//**********************************************************
int WCSCVxDQPSetES485Transmit(int VxDPId,int Mode)
{
int OldLCR;
int OldSCR;
int OldMCR;

//Save old LCR
WCSCVxDGetRegister(VxDPId,LCR,&OldLCR);

//Set DLAB to Access QOR
WCSCVxDPutRegister(VxDPId,LCR,0xBF);

//Save old SCR
WCSCVxDGetRegister(VxDPId,SCR,&OldSCR);

//Enable QLAB
WCSCVxDPutRegister(VxDPId,SCR,OldSCR|0x10);

//Save old QMCR
WCSCVxDGetRegister(VxDPId,MCR,&OldMCR);

//Update QOR
OldMCR &= 0xFC;
switch(Mode)
{
//Transmitter always on
case 0:
break;

//Toggle on DTR
case 1:
OldMCR |= 0x1;
break;

//Toggle on RTS
case 2:
OldMCR |= 0x2;
break;

//Auto Toggle
case 3:
default:
OldMCR |= 0x3;
break;
}

WCSCVxDPutRegister(VxDPId,MCR,OldMCR);

//Restore QLAB=0 in QOR
WCSCVxDPutRegister(VxDPId,SCR,OldSCR & (~0x10));

//Restore LCR
WCSCVxDPutRegister(VxDPId,LCR,OldLCR);
}
//**********************************************************
 



//**********************************************************
//*Description-
//* Changes the mode of the receiver.
//*
//*On Entry-
//* int VxDPId
//* Port handle.
//* int Mode
//* 0 = Receiver always on
//* 1 = Receiver opposite to transmitter
//**********************************************************
int WCSCVxDQPSetES485Receive(int VxDPId,int Mode)
{
int OldLCR;
int OldSCR;
int OldMCR;

//Save old LCR
WCSCVxDGetRegister(VxDPId,LCR,&OldLCR);

//Set DLAB to Access QOR
WCSCVxDPutRegister(VxDPId,LCR,0xBF);

//Save old SCR
WCSCVxDGetRegister(VxDPId,SCR,&OldSCR);

//Enable QLAB
WCSCVxDPutRegister(VxDPId,SCR,OldSCR|0x10);

//Save old QMCR
WCSCVxDGetRegister(VxDPId,MCR,&OldMCR);

//Update QOR
OldMCR &= 0xDF;
switch(Mode)
{
//Transmitter always on
case 0:
default:
break;

//Auto Toggle
case 1:
OldMCR |= 0x20;
break;
}

WCSCVxDPutRegister(VxDPId,MCR,OldMCR);

//Restore QLAB=0 in QOR
WCSCVxDPutRegister(VxDPId,SCR,OldSCR & (~0x10));

//Restore LCR
WCSCVxDPutRegister(VxDPId,LCR,OldLCR);
}
//**********************************************************
 

 

 

Last Updated: 08/07/2008

Copyright © 2008 by Willies Computer Software Co