Hello again everyone! Today I am trying to get my Arduino to talk to my PIC16F690 Micro-controller. I can get them to talk, just not the same language (metaphor). Any ideas?
Parts List:
WRL-10535 Transmitter http://www.sparkfun.com/products/10535
WRL-10533 Receiver http://www.sparkfun.com/products/10533
PIC16F690 Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/41262c.pdf
Arduino Uno
And for the Arduino:
What it is showing:
///// putc(1); arduino serial monitor shows 64
///// putc(2); arduino serial monitor shows 2 pickit UART shows ˥
///// putc(3); arduino serial monitor shows 160 pickit UART shows ?
///// printf has so far been useless (generally correct on UART, incorrect on Arduino) I have tried millions of combinations, including:
int value = 2;
printf("%d", value);
and other correct printf formats. I have tried to configure it into a long as well since int in arduino is a long in ccsc. I have also used a byte for the receiver which is int in ccsc. They just aren't speaking the same language.
The code I am trying to adapt for the transmitter on the PIC (16F690) works with the arduino, and is as simple as
I really hope someone knows why Serial.print on the arduino works for the transmitter but putc and printf don't work the same in CCsC
Thanks in advance.
Parts List:
WRL-10535 Transmitter http://www.sparkfun.com/products/10535
WRL-10533 Receiver http://www.sparkfun.com/products/10533
PIC16F690 Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/41262c.pdf
Arduino Uno
Rich (BB code):
///////// CCS C Code on 16F690 (Transmitter)
#include <16F690.H>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#fuses INTRC_IO, NOWDT, NOPROTECT, NOBROWNOUT, PUT
#use delay(clock=4000000)
#use rs232(baud=4800, xmit=PIN_A0, rcv=PIN_C3)
main() {
while(1) {
putc(2);
}
}
Rich (BB code):
/////// Arduino Uno Code (Receiver)
int incomingByte = 0;
void setup(){
Serial.begin(4800);
}
void loop(){
incomingByte = Serial.read();
Serial.println(incomingByte, DEC);
}
///// putc(1); arduino serial monitor shows 64
///// putc(2); arduino serial monitor shows 2 pickit UART shows ˥
///// putc(3); arduino serial monitor shows 160 pickit UART shows ?
///// printf has so far been useless (generally correct on UART, incorrect on Arduino) I have tried millions of combinations, including:
int value = 2;
printf("%d", value);
and other correct printf formats. I have tried to configure it into a long as well since int in arduino is a long in ccsc. I have also used a byte for the receiver which is int in ccsc. They just aren't speaking the same language.
The code I am trying to adapt for the transmitter on the PIC (16F690) works with the arduino, and is as simple as
Rich (BB code):
byte this;
void setup() {
this = 2;
}
void loop() {
Serial.print(this);
}
Thanks in advance.