Apr 12, 2013 #1 A 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); } }
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); } }
Apr 12, 2013 #2 jayanth.devarayanadurga Banned Joined Dec 4, 2012 Messages 4,280 Helped 822 Reputation 1,654 Reaction score 791 Trophy points 1,393 Location Bangalore, India Visit site Activity points 0 char x = '2';
Apr 13, 2013 #3 A 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 my problem arduino led is "on" for any variable !
Apr 13, 2013 #4 jayanth.devarayanadurga Banned Joined Dec 4, 2012 Messages 4,280 Helped 822 Reputation 1,654 Reaction score 791 Trophy points 1,393 Location Bangalore, India Visit site Activity points 0 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); } }
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); } }
May 5, 2013 #5 A 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 think bro , 16F877A use different type of Serial (ttl) and arduino have different type , i spend 3 Moths for this code :'(
i think bro , 16F877A use different type of Serial (ttl) and arduino have different type , i spend 3 Moths for this code :'(
May 5, 2013 #6 jayanth.devarayanadurga Banned Joined Dec 4, 2012 Messages 4,280 Helped 822 Reputation 1,654 Reaction score 791 Trophy points 1,393 Location Bangalore, India Visit site Activity points 0 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?
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?
May 5, 2013 #7 A 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 arduino powered it by usb ....my project stoped for this code (( i really get crazy for this code (