Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Bitbanging C sample Code

Status
Not open for further replies.

suvarna_mtech

Newbie level 2
Joined
Oct 4, 2008
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,295
Hi,

I am using P89C61X2 controller.
I want to connect one serial interfacing device to controller.
I am connecting it through bit banging.
I am not able to put time out, if the device not responds me.
Please help me out.


I am connecting device with 19200 bps,
I am confuse my used bit time is OK or not.
If my device is disconnected, my program is not timed out.
Controller remains in the loop
 

Hi,

Thanks for the help.
I am not using interrupt.

Here is the code

BRXD = 1; //This is port pin which i'm using as receive
while(BRXD); //When data receives, Receive Pin goes low. Here i'm waiting for bit to receive. I am confuse how i put timeout here. I want this to timeout if data not receives in specified time interval

Bit_Time(BIT_TIME/2); //Wait 1/2 bit-time to sample in middle
for(; i < 8; i++) // Send 8 bits to the I2C Bus
{
inbyte = inbyte >>1;
Bit_Time(BIT_TIME);

if(BRXD)
inbyte |= 0x80;
else
inbyte &= ~(0x80);

}
return inbyte;
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top