Hey guys: Here's my deal. I need to send data between 2 PIC12f675s. I tried the serial examples but can't get em to work. Can someone please post an example for both sender and receiver? All I need to send is one byte. Thanks lots... Cathy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What clock speed are the 12F675s running at? The serial routines don't tend to work too well on slower chips, especially at the 9600 bps used in the examples. I often use the routines at 2400 bps and they seem to work okay.
If that still doesn't work, please let me know and I'll write some new code. I've got some Manchester code routines and some remote control routines in the works, either of which might be better.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, I couldn't get it to work at any baud rate. I am using the 4MHz internal oscillator. I also tried "1+WaitForStart" where needed and that didn't help. Below is what I am doing.
Thanks
#CHIP 12F675, 4
#config OSC = int, MCLR = OFF
#define StartUpDelay 10 ms
Dim Counter as Byte
DIR GPIO.0 OUT
Startup:
Wait StartUpDelay
InitSer (1, r1200, 1, 8, 1, none, normal)
Main:
For Counter = 1 to 250
SerSend (1, Counter)
Wait 800 ms
Next
Goto Main
#CHIP 12F675, 4
#config OSC = INT, MCLR = OFF
#define StartUpDelay 10 ms
Dim Timed as byte
DIR GPIO.0 IN
Startup:
Wait StartUpDelay
InitSer (1, r1200, 1, 8, 1, none, normal)
Timed = 0
Main:
SerReceive (1, Timed)
Wait 100 ms
Goto Main
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You need to tell GCBASIC which pin to use for the serial routines.
On the sender, add these lines:
#define SendAHigh Set GPIO.0 On
#define SendALow Set GPIO.0 Off
And on the receiver, these lines:
#define RecAHigh GPIO.0 On
#define RecALow GPIO.0 Off
On the sender the constants are used to give the command to send a high, and the command to send a low. On the receiver, they give a condition that is true when a high is being received, and a condition that is true when a low is being received.
Hopefully this works!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey guys: Here's my deal. I need to send data between 2 PIC12f675s. I tried the serial examples but can't get em to work. Can someone please post an example for both sender and receiver? All I need to send is one byte. Thanks lots... Cathy
What clock speed are the 12F675s running at? The serial routines don't tend to work too well on slower chips, especially at the 9600 bps used in the examples. I often use the routines at 2400 bps and they seem to work okay.
If that still doesn't work, please let me know and I'll write some new code. I've got some Manchester code routines and some remote control routines in the works, either of which might be better.
No, I couldn't get it to work at any baud rate. I am using the 4MHz internal oscillator. I also tried "1+WaitForStart" where needed and that didn't help. Below is what I am doing.
Thanks
#CHIP 12F675, 4
#config OSC = int, MCLR = OFF
#define StartUpDelay 10 ms
Dim Counter as Byte
DIR GPIO.0 OUT
Startup:
Wait StartUpDelay
InitSer (1, r1200, 1, 8, 1, none, normal)
Main:
For Counter = 1 to 250
SerSend (1, Counter)
Wait 800 ms
Next
Goto Main
#CHIP 12F675, 4
#config OSC = INT, MCLR = OFF
#define StartUpDelay 10 ms
Dim Timed as byte
DIR GPIO.0 IN
Startup:
Wait StartUpDelay
InitSer (1, r1200, 1, 8, 1, none, normal)
Timed = 0
Main:
SerReceive (1, Timed)
Wait 100 ms
Goto Main
You need to tell GCBASIC which pin to use for the serial routines.
On the sender, add these lines:
#define SendAHigh Set GPIO.0 On
#define SendALow Set GPIO.0 Off
And on the receiver, these lines:
#define RecAHigh GPIO.0 On
#define RecALow GPIO.0 Off
On the sender the constants are used to give the command to send a high, and the command to send a low. On the receiver, they give a condition that is true when a high is being received, and a condition that is true when a low is being received.
Hopefully this works!
Tried that and it didn't work. Both chips do other things fine so I would believe they are working fine. Should one side be set normal and one invert?
Thanks!