Vizier87
Active Member
Hi guys, I wrote this code, where basically I'm only trying to control a motor using a L293 by transmitting RF data via UART. One direction worked perfect for reading 0xFF, but the other direction turn doesn't work with 0xAA matched to the receiver.
Here's the transmitter code (MikroC):
And this is the receiver:
I set the baud rate as per the specs of the RF module, and the data transmission for matching the value 0xFF between the receiver and transmitter worked pretty well. The problem is the other direction, and I suspect my code is shabby.
Really appreciate the time spent on this.
Cheers.
Vizier87.
Here's the transmitter code (MikroC):
C:
while (1){
if (Left==1){ // Just a designation for a pin, which is an input, for "left"
// as anti-clockwise data
rb7_bit=1;
UART1_Write(0xff);
}
else if (Right==1){ // "Right" as clockwise data
rb7_bit=1;
UART1_Write(0xaa);
}
else {
UART1_Write(0x00);
rb7_bit=0;
}
}
And this is the receiver:
C:
while (1) {
if (UART1_Data_Ready()==1) { // If data is received,
x_=UART1_Read();
}
else if (x_==0xff){
rd6_bit=0; // clockwise (worked fine at the receiver's end)
rd5_bit=1;
}
else if (x_==0xaa){
rd6_bit=1; //anti-clockwise (supposedly, but didn't work)
rd5_bit=0;
}
else portd=0;
}
I set the baud rate as per the specs of the RF module, and the data transmission for matching the value 0xFF between the receiver and transmitter worked pretty well. The problem is the other direction, and I suspect my code is shabby.
Really appreciate the time spent on this.
Cheers.
Vizier87.
Last edited: