PIC16F628 transmit to Arduino UNO~~~helppp!!

hihi....im trying to send a character 'a' from PIC to arduino UNO then based on that value received, light a LED in arduino port.
i will use cheap wireless 433Mhz module transmitter and receiver.

transmitter = Cytron.io - Simplifying Digital Making
receiver = Cytron.io - Simplifying Digital Making

So question is,

  1. what is the best way to communicate between PIC and arduino UNO.?

  2. anyone interface these two before wirelessly?

  3. is it posscible to use manchester code from mikroC for PIC and manchester code of ARDUINO....

pardon me for some newbie question.....

Hi,

Why a PIC and an Arduino? You make your problem twice as difficult. Stick to one or the other is my advice. Yes, I believe there are libraries that use manchester code for 433MHz communication between Arduinos. Those same libraries wont work unmodified with PIC. I would be surprised if anyone here knows how to do it, but if you had two Arduinos...

Paul

Do you know how to program two PICs to use that transmitter and receiver?

Do you know how to program two Arduinos to use that transmitter and receiver?

The microprocessors won't know or care what is connected to the other wireless device.

...R

when wire TX of PIC to RX of arduino direstly.....the code works . however when i connect it to the RF modules, LED on the arduino does not light up.

code for PIC

#include <stdio.h>
#include <stdlib.h>
#include <xc.h>
#include <stdint.h>
#include <pic16f628.h>

#pragma config FOSC = XT // Oscillator Selection bits (INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = ON // Power-up Timer Enable bit (PWRT enabled)
#pragma config MCLRE = OFF // RA5/MCLR/VPP Pin Function Select bit (RA5/MCLR/VPP pin function is digital input, MCLR internally tied to VDD)
#pragma config BOREN = OFF // Brown-out Detect Enable bit (BOD disabled)
#pragma config LVP = OFF // Low-Voltage Programming Enable bit (RB4/PGM pin has digital I/O function, HV on MCLR must be used for programming)
#pragma config CPD = OFF // Data EE Memory Code Protection bit (Data memory code protection off)
#pragma config CP = OFF

#define _XTAL_FREQ 4000000
#define send PORTBbits.RB5
#define sendbut TRISBbits.TRISB5
//#define button
//#define pbutton TRISAbits.TRISA1
#define LED1 PORTBbits.RB0
#define led TRISBbits.TRISB0
#define syncdata 0x00
#define header 0xAA
//#define lol 'a'

void uart_send(unsigned char data);
void send_word(unsigned char XX);

void main(void) {

led=0;
sendbut = 1;

//assign variable
unsigned char info = 'a';

//setup USART
BRGH = 0; //baud rate low speed option
SYNC = 0; //asynchronous
SPEN = 1; //enable serial port
TXEN = 1; //enable transmission
SPBRG = 51; //set boud rate to 1200bps for 4Mhz crystal
TX9 = 0; //8-bit transmission

while(1) //infinity loop

{
LED1 = 0;
if(send==1) //send the value
{

while(send==1);
{} //wait until the button is released
send_word(info);
LED1 = 1;
__delay_ms(1000);
}

else
{
LED1=0;
}

}

}
//===================================================================================
// functions
//===================================================================================
void uart_send(unsigned char data)
{
while(TXIF==0); //only send the new data after
TXREG=data; //the previous data finish sent
}

void send_word(unsigned char XX)
{
unsigned char i;

// Buffer for the data in one packet.
unsigned char buffer[3];

// Byte 0 is the header.
buffer[0] = header;

// Byte 1 is the data.
buffer[1] = XX;

// Byte 2 is the checksum.
buffer[2] = 0xAF;

// Clocking for a while before sending the data so that the Tx and Rx are in sync.
for (i = 0; i < 6; i++)uart_send(syncdata);

// Transmit the packet using UART.
for (i = 0; i < 3; i++)uart_send(buffer*);*

}
code for receiver
#define syncdata 0x00
#define header 0xAA
#define checksum1 0xFF
#define led 4
#define led2 10
#define led3 5
byte val=0;
byte checksum=0;
void setup()
{

  • Serial.begin(1200);*

  • pinMode(led, OUTPUT);*

  • pinMode(led2, OUTPUT);*

  • pinMode(led3, OUTPUT);*
    }
    void loop()
    {
    digitalWrite (led2,LOW);
    digitalWrite (led,LOW);
    digitalWrite (led3,LOW);
    delay(500);

  • check();*

  • if (val=='a')*

  • {*

  • digitalWrite (led2,HIGH);*

  • delay(1000);*

  • } *

  • else*

  • {*

  • digitalWrite (led2,LOW);*

  • delay(500);*

  • } *
    *} *
    unsigned char check (void)
    {
    int i=0;
    unsigned char letter;

  • if(Serial.available() >0) // *

  • {*

  • digitalWrite (led3,HIGH);*

  • delay(500);*

  • if (Serial.read()==header)*

  • {*

  • val = Serial.read();*

  • checksum=Serial.read();*

  • digitalWrite (led,HIGH);*

  • delay(500);*

  • if ( checksum==0xAF)*

  • {*

  • //digitalWrite (led2,HIGH);*

  • // delay (1000);*

  • return val;*

  • }*

  • else*

  • val=0;*

  • return val;*

  • }*

  • else*

  • val=0;*

  • return val;*

  • }*

  • else*

  • val=0;*

  • return val; *

*} *
arduino receiver part is it ok?

You cant use those cheap RF modules to send async data, because they wont emulate a hard wired link.
The receiver is totally dumb, and in the absence of any input signal produces garbage on its data pin which is fed into a hardware usart will cause massive overrun and framing errors, and in the worst case will cause the usart to lockup.
You need , as a minimum some form of data coding like Manchester, and some form of pulse position modulation to transmit the data.
Have a look at how the Virtual Wire library works to achieve what you want.
http://www.airspayce.com/mikem/arduino/VirtualWire/

ohh okok.....will hav a look....thx mauried