send value from pic to Arduino

Status
Not open for further replies.

asdouf

Newbie level 4
Joined
Dec 18, 2009
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
egypt
Visit site
Activity points
1,307
i want to send number from Pic16F877A By MikroC To Arduino but i have problem , any one Know where is the problem ???

Code Arduino
Code:
#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3
#define ledPin 12
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);

void setup()
{
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
pinMode(ledPin, OUTPUT);
mySerial.begin(9600);
}

void loop()
{ 

char c= mySerial.read();

if (c ==2)

{digitalWrite(ledPin,HIGH);} 

}

Code of MikroC
Code:
 char   x =2;
void main() 
{
uart1_init(9600);
delay_ms(1000);
trisc=0;
        while(1)       
       {
              uart1_write(x);
          }  
       }
 

mikroC PRO AVR Code


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
char   x = '\0';
 
void main() 
{
    TRISC = 0b01000000;
    PORTC = 0x00;
 
    uart1_init(9600);
    delay_ms(100);
 
    x = '2';
    
        while(1)       
        {
                uart1_write(x);
        Delay_ms(500);
        }  
}

 
Reactions: asdouf

    asdouf

    Points: 2
    Helpful Answer Positive Rating
i think bro , 16F877A use different type of Serial (ttl) and arduino have different type , i spend 3 Moths for this code :'(
 

Digital devices use TTL or CMOS level. Many people have done serial communication between MCU and Arduino. It is not a problem. At what voltage does your Arduino board works? 5V or 3.3V?
 

arduino powered it by usb ....my project stoped for this code ((
i really get crazy for this code (
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…