433 MHz RF Transceiver (#27982)
ro16102003
Posts: 6
i was trying to use the 433 MHz RF Transceiver (#27982) modules for 8 bit data transmission on two iRobot create command modules
i am reading the data through UART on MTTY
i had programmed earlier using 433 MHz RF Transceiver (#27997), it was working fine but with the new module i am simply getting garbage values
i have made Tx - 1 (PC0), data - 1 (PC1),
and Rx - 0 (PC1) and data - 0 (PC1)
not understanding what i am messing up
i am reading the data through UART on MTTY
i had programmed earlier using 433 MHz RF Transceiver (#27997), it was working fine but with the new module i am simply getting garbage values
i have made Tx - 1 (PC0), data - 1 (PC1),
and Rx - 0 (PC1) and data - 0 (PC1)
not understanding what i am messing up
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
/* Transmitter.c
Program to transmit a Character using the Transceiver Module
*/
#include <avr/interrupt.h>
#include <avr/io.h>
#include <util/delay.h>
#include "oi.h"
void delay10ms(uint16_t delay_10ms);
void main(void)
{
/*Connect the Transmit Pin to PORT C PIN0 */
/*PC0 configured in output mode*/
DDRC = 0XFF;
PORTC =0XFF;
DDRC = 0X01;
PORTC = 0X01;
_delay_us(417);
_delay_us(417);
_delay_us(417);
while(1)
{
/*TRANSMIT A CHARACTER "00001111"*/
/*Make PC0 high or low depending on the value of
the bit that has to be transmitted*/
_delay_us(417);
PORTC = 0X00;
_delay_us(417);
PORTC = 0X00;
_delay_us(417);
_delay_us(417);
PORTC = 0X00;
_delay_us(417);
_delay_us(417);
PORTC = 0X00;
_delay_us(417);
_delay_us(417);
PORTC = 0X00;
_delay_us(417);
_delay_us(417);
PORTC = 0X01;
_delay_us(417);
_delay_us(417);
PORTC = 0X01;
_delay_us(417);
_delay_us(417);
PORTC = 0X01;
_delay_us(417);
_delay_us(417);
PORTC = 0X01;
_delay_us(417);
_delay_us(417);
PORTC = 0X01;
_delay_us(417);
_delay_us(417);
_delay_us(417);
delay10ms(5);
}
}
void delay10ms(uint16_t delay_10ms)
{
// Delay for (delay_10ms * 10) ms
while(delay_10ms-- > 0)
{
// Call a 10 ms delay loop
_delay_loop_2(46080);
}
}
Tx/Rx Pin - cargo bay port pin 2 (PC0)
Data Pin - center port pin 2 (PC1)
Vcc 5V - PIN 4
GND - PIN 5
i am transmitting "00001111" in a while loop continuously
the RSSI pin shows me a voltage of 0 - 1.5V at the receiver
void main(void)
{
#if transceiver == 1
DDRC = 0x02; // Set PC0 serialinput and PC1 as output Tx
while(1)
{
transmitDelay();
PORTC &= ~0x01; // Transmit Start bit 0
transmitDelay();
_delay_us(417); //sending bits 11100011 or 0xE3
_delay_us(417);
PORTC = 0x01; //Bit 7
_delay_us(417);
_delay_us(417);
PORTC = 0x01; //Bit 6
_delay_us(417);
_delay_us(417);
PORTC = 0x00; //Bit 5
_delay_us(417);
_delay_us(417);
PORTC = 0x00; //Bit 4
_delay_us(417);
_delay_us(417);
PORTC = 0x00; //Bit 3
_delay_us(417);
_delay_us(417);
PORTC = 0x01; //Bit 2
_delay_us(417);
_delay_us(417);
PORTC = 0x01; //Bit 1
_delay_us(417);
_delay_us(417);
PORTC = 0x01; //Bit 0
_delay_us(417);
}//end While
transmitDelay();
PORTC |= 0x01; // Transmit Stop bit 1
transmitDelay();
delay10ms(5);
#endif
#if transceiver == 2
Init_Uart();
writeChar(0x43, USB);
writeChar(0x68, USB);
writeChar(0x65, USB);
writeChar(0x63, USB);
writeChar(0x6B, USB);
writeChar(0x69, USB);
writeChar(0x6E, USB);
writeChar(0x67, USB);
writeChar(0x2E, USB);
writeChar(0x2E, USB);
writeChar(0x2E, USB);
writeChar(13, USB);
writeChar(10, USB);
uint8_t rxData;
while(1)
{
writeChar(0x3D, USB);
rxData = receive();
writeChar(rxData, USB);
writeChar(0x3D, USB);
for (int i=7; i>=0; i--)
{
writeChar(((rxData & (1<<i)) >> i) + 0x30, USB);
}
writeChar(13, USB);
writeChar(10, USB);
delay10ms(2);
}
#endif
}
// Receiving signal
uint8_t receive(void)
{
DDRC = 0x00; // Set PC0 as serialout and PC1 Rx as input
PORTC = 0x00;
uint8_t received = 0;
uint8_t working = 1;
while(working)
{
rxDelay();
if ((PINC & 0x01) == 0) // If Start bit = 0
{
rxDelay();
for (int i=7; i>=0; i--)
{
rxDelay();
received |= ((PINC & 0x01) << i);
rxDelay();
}
rxDelay();
// Check the stop bit
if ((PINC & 0x01) == 1)
{
working=0;
break; // exit the while loop
}
// otherwise, discard and try to receive again
}
//working=0;
}
return received;
}
any help in debugging ?
i tried with boebots and implemented the sample code, but even dat just displays the message and then i get a receive error
is my wiring incorrect
i connected gnd - vss, +5V - vdd
then data - pin 15, tx-rx - pin 14