programming novice here,
tryin to transmit a start bit 3 variables and a stop bit.
all varaibles contain numbers
I have written the code (refer end of post) to perform the RS232 transmission and am monitoring the data recieved on a prgramme called serial watcher, which shows me data in decimal.
The problem is on of the variables is 16bit variable (off_time), hence i am only recieving the lower 8 bits.
this is because the protocol is data width - 8 bits.
Any ideas as to how to overcome this problem wld be much appreciated.
Thanks
Nick.
Code:
init:
{ SPBRG=64; //baud rate 4800
BRGH=0;
SYNC=0; //asynchronous mode
SPEN=1;
TX9=0;
TXEN=1;
}
transmit:
{ start = 1;
TXREG = start;
while(TRMT == 0){};
TXREG = off_time; // 16 bit variable
while(TRMT == 0){};
TXREG = mux_number;
while(TRMT == 0){};
TXREG = grid_number;
while(TRMT == 0){};
TXREG = start; //transmits Stop bit - 1
while(TRMT == 0){};
}
tryin to transmit a start bit 3 variables and a stop bit.
all varaibles contain numbers
I have written the code (refer end of post) to perform the RS232 transmission and am monitoring the data recieved on a prgramme called serial watcher, which shows me data in decimal.
The problem is on of the variables is 16bit variable (off_time), hence i am only recieving the lower 8 bits.
this is because the protocol is data width - 8 bits.
Any ideas as to how to overcome this problem wld be much appreciated.
Thanks
Nick.
Code:
init:
{ SPBRG=64; //baud rate 4800
BRGH=0;
SYNC=0; //asynchronous mode
SPEN=1;
TX9=0;
TXEN=1;
}
transmit:
{ start = 1;
TXREG = start;
while(TRMT == 0){};
TXREG = off_time; // 16 bit variable
while(TRMT == 0){};
TXREG = mux_number;
while(TRMT == 0){};
TXREG = grid_number;
while(TRMT == 0){};
TXREG = start; //transmits Stop bit - 1
while(TRMT == 0){};
}