CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC-to-PIC RS232 problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
randy.shaffer



Joined: 21 Mar 2018
Posts: 51

View user's profile Send private message

PIC-to-PIC RS232 problem
PostPosted: Fri Apr 22, 2022 11:09 am     Reply with quote

The first is an 18F55K42, the second 18LF55K42. The second sends and receives data OK, the first sends OK but does not receive (kbhit never is true in the first).

Settings for the first:

Code:
#include <18F55K42.h>
#include <stdint.h>
#device ADC = 10
#fuses NOWDT, BROWNOUT, PUT_64MS, NOLVP
#use delay(internal=64MHz)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,disable_ints,stream=VOICE_COUNTDOWN)

Settings for the second:

Code:
#include <18LF55K42.h>
#include <stdint.h>
#fuses NOWDT, PUT_64MS
#use delay(internal = 64MHz)
#pin_select NULL = PIN_C3 // disconnect i2c module from C3, C4
#pin_select NULL = PIN_C4
#pin_select U1TX = PIN_C7 // Connections are TX-TX, RX-RX on PCB
#pin_select U1RX = PIN_C6
#use rs232(UART1,baud=9600,parity=N,bits=8,disable_ints,stream=MAIN_BOARD)


The section in the first to receive is in a continuous loop:

Code:
 if(kbhit(VOICE_COUNTDOWN) == TRUE)
 {
  RX_DATA = fgetc(VOICE_COUNTDOWN);
 }


RX_DATA is uint8_t

Compiler is 5.107

This is my first attempt to get two pics to communicate, I apologize in advance for the ignorance/inexperience.
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Fri Apr 22, 2022 11:15 am     Reply with quote

Are you wiring these directly to one another without buffers?. If so,
voltage is the problem. The F will be drivng to 5v, the LF only 3.3. If the
connection is directly made, then the input to the LF will be being
overdriven (if this not a 5v tolerant pin, then this could damage the
chips). The F will not see a high enough voltage to work. The ViH at
5v, is 4v.
randy.shaffer



Joined: 21 Mar 2018
Posts: 51

View user's profile Send private message

PostPosted: Fri Apr 22, 2022 11:19 am     Reply with quote

Yes, wired directly w/o buffers, both are operating at 5v.
temtronic



Joined: 01 Jul 2010
Posts: 9224
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Apr 22, 2022 2:41 pm     Reply with quote

hmm, proper RS-232 buffers will invert the data... so I suspect if you add 'invert' to the USE RS232 (..options...), it may 'magically' work for you, providing both PICs are 5v.
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Sat Apr 23, 2022 2:48 am     Reply with quote

The LF chip is rated for 3.6v _MAX_
You will almost certainly have damaged it if you are running at 5v.

He doesn't need 'invert', since the signals will both be idle +ve on both
chips. Remember Jay, you use two RS232 buffers, so the signals are
inverted twice over an RS232 connection.

His operating voltage is illegal for the pair of chips he is using.
temtronic



Joined: 01 Jul 2010
Posts: 9224
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Apr 23, 2022 4:03 am     Reply with quote

yeah, getting old sucks,.. I was membering connecting to a PIC to PC.and the 'cheat' was to not have the MAX232 BUT had to use the 'invert' option. This was back when PICs had quartz windows on top so you could se 'under the hood'...... Embarassed
randy.shaffer



Joined: 21 Mar 2018
Posts: 51

View user's profile Send private message

PostPosted: Mon Apr 25, 2022 9:10 am     Reply with quote

Thank you, sirs, for your help. I have indeed selected the wrong chip and am headed back to the drawing board.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group