| ??? 09/21/06 01:07 Read: times |
#124734 - Some Help Responding to: ???'s previous message |
Set a timer up for the proper buad rate. You may need to make it high priority if you have busy interupts. Note you can use a delay loop, or a timer with no interupts on the interupt....
switch(tx2_state)
{
case 0: // tx not in progress
break;
case 1: // send start Bit 1
TX2_BIT = SPACE;
tx2_state++;
break;
default: // states 2,3,4,5,6,7,8,9 data bits lsb first
TX2_BIT = (tx2_byte & 0x01)?MARK:SPACE; // send LSB
tx2_byte = tx2_byte >> 1; // shift for next Time
tx2_state++;
break;
case 10: // send stop Bit
TX2_BIT = MARK;
tx2_state++;
break;
}
translate to asm and you are done. enjoy |



