your mail

From: THETechnoid_at_home.com <(THETechnoid_at_home.com)>
Date: Tue Apr 10 17:24:50 2001

Not to nitpick, but the original message was missing a title too....


Regards,

Jeff

P.S. Thanks for VCF East. My wife says she'd like to come with. I can't
wait.


In <Pine.LNX.4.10.10104100821090.19005-100000_at_siconic.com>, on 04/10/01
   at 06:24 PM, Sellam Ismail <foo_at_siconic.com> said:


>Ah yes, you're missing a semi-colon, silly!

>:)

>On Tue, 10 Apr 2001, Mekonnen Tekeste wrote:

>>
>> Can Any one help me please? i am trying to interface a bar code reader
>> to PCI Bus via a 82C51 (UART), and i wrote a code to support my
>> hardware design but the software it seem wrong. Here is the code:
>>
>>
>>
>> #include <conio.h>
>> #include <stdio.h>
>> #include <dos.h>
>>
>> /* Type Definitions */
>>
>> typedef unsigned char UBYTE; /* Old habbit... */
>>
>> /* Serial Port Definitions */
>>
>> #define STATUS 0x308 /* Status Base Address */
>> #define CONTROL 0x300 /* Control Base Address */
>> #define TXREG 0x30C /* Transmit Base Address */
>> #define RXREG 0x304 /* Receive Base Address */
>> #define TRUE 1
>>
>> /* Function Prototypes */
>>
>> void InitUSART(void); /* Initialize USART */
>> void TxData(UBYTE); /* Transmit Data */
>> UBYTE RxData(void); /* Receive Data */
>>
>> /*
>> InitUSART() - Initialize USART to 153600, 8 Data Bits, No Parity, 1 Stop
>> Bit
>> */
>> void InitUSART(void)
>> {
>> outp(CONTROL, 0x40); // Reset UART
>> outp(CONTROL, 0x4E); // Stop, no parity, 8-bit, %16 baud
>> outp(CONTROL, 0x05); // UART now ready
>> }
>>
>> /*
>> TxData() - Send Data to Serial Port
>> Entry:
>> data = Data to transmit
>> */
>> void TxData(UBYTE data)
>> {
>> UBYTE x;
>>
>> /* Check for Tx Buffer Empty */
>> do
>> {
>> x = inp(STATUS);
>> x &= 0x01;
>> } while(x == 0);
>>
>> outp(TXREG, data); /* Send Data */
>> }
>>
>> /*
>> RxData() - Receive Data from the Serial Port
>> Exit:
>> data = Rx Data byte
>> */
>> UBYTE RxData(void)
>> {
>> UBYTE x;
>> UBYTE data = 0;
>>
>> while(TRUE) /* Check for Rx Data */
>> {
>> x = inp(STATUS);
>> x &= 0x02;
>> if(x == 0x02)
>> {
>> data = inp(RXREG); /* Get Data */
>> break;
>> }
>>
>> /* Optional. Aborts if keypress */
>>
>> if(kbhit()) /* Abort if Keypress */
>> {
>> getch();
>> printf("\n");
>> break;
>> }
>> }
>> return(data);
>> }
>>
>>
>> void main(void)
>> {
>>
>>
>> InitUSART();
>>
>> while(TRUE)
>> putch(RxData());
>> }
>>
>>
>>
>>
>>
>>
>>
>>


>Sellam Ismail Vintage Computer
>Festival
>------------------------------------------------------------------------------
>International Man of Intrigue and Danger
>http://www.vintage.org


-- 
-----------------------------------------------------------
Jeffrey S. Worley
President
Complete Computer Services, Inc.
30 Greenwood Rd.
Asheville, NC 28803
828-277-5959
Visit our website at HTTP://www.Real-Techs.com
THETechnoid_at_home.com
-----------------------------------------------------------
Received on Tue Apr 10 2001 - 17:24:50 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:33:25 BST